From fd003f8c14898f23130026e71cdcd51fa57cf44c Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 11 Feb 2025 14:53:41 +0100 Subject: [PATCH 001/358] improve high complexity of param_mc_prm_est: MC/7-1-4/128kBit reduced by 166 WMOPS --- lib_com/options.h | 1 + lib_enc/ivas_mc_param_enc.c | 83 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 1b2c15f87..11a10b5b0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,4 +154,5 @@ #define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ #endif diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 0577df340..e3eb59445 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -723,9 +723,16 @@ static void ivas_param_mc_param_est_enc_fx( } } +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + Word16 gb = find_guarded_bits_fx( l_ts ); + Word16 add20gb = add( 20, gb ); +#endif + FOR( ts = start_ts; ts < num_time_slots; ts++ ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST Word16 gb = find_guarded_bits_fx( l_ts ); +#endif ivas_fb_mixer_get_windowed_fr_fx( hParamMC->hFbMixer, pcm_in_fx, p_slot_frame_f_real_fx, p_slot_frame_f_imag_fx, l_ts, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans, gb ); ivas_fb_mixer_update_prior_input_fx( hParamMC->hFbMixer, pcm_in_fx, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans ); @@ -810,10 +817,25 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); +#else + 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); + 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 ); + c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); + c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); + c_e = sub( add20gb, c_e ); + d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); + d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); + d_e = sub( add20gb, d_e ); +#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 ); @@ -844,6 +866,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -863,13 +886,49 @@ static void ivas_param_mc_param_est_enc_fx( move32(); p_dmx_fac_fx++; } +#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, add( 20, gb ), &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 IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + 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 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -891,6 +950,12 @@ 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(); } } @@ -898,12 +963,30 @@ 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 + 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 ); + 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 ); +#endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); +#else + + c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); + c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); + c_e = sub( add20gb, c_e ); + d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); + d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); + d_e = sub( add20gb, d_e ); +#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 ); -- GitLab From 31ef1423be708164aeae8527d161e4098115f331 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 11 Feb 2025 15:26:46 +0100 Subject: [PATCH 002/358] fix clang-fomat-issues --- lib_enc/ivas_mc_param_enc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index e3eb59445..438451ceb 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -823,9 +823,9 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - 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); + 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 ); 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 ); @@ -887,7 +887,7 @@ static void ivas_param_mc_param_est_enc_fx( p_dmx_fac_fx++; } #else - Word32 real_fx = L_add(0, 0); + Word32 real_fx = L_add( 0, 0 ); Word16 real_e = 0; move16(); Word32 imag_fx = L_add( 0, 0 ); -- GitLab From 91f046f47e652e6addc52b1fca20391f0087325f Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 13 Feb 2025 22:07:15 +0100 Subject: [PATCH 003/358] completed tuning of MC param: no more BE now --- lib_com/options.h | 2 +- lib_enc/ivas_mc_param_enc.c | 59 ++++++++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 11 deletions(-) mode change 100644 => 100755 lib_enc/ivas_mc_param_enc.c diff --git a/lib_com/options.h b/lib_com/options.h index b7a3eaddb..7d6004fcc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,5 +158,5 @@ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #endif diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c old mode 100644 new mode 100755 index 438451ceb..b99a8ef74 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -815,6 +815,24 @@ 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 + 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 FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { #ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST @@ -823,20 +841,23 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - 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 ); - 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 ); c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); c_e = sub( add20gb, c_e ); + if ( c_fx == 0 ) + { + c_e = 0; + move16(); + } d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); d_e = sub( add20gb, d_e ); + if ( d_fx == 0 ) + { + d_e = 0; + 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 ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], @@ -899,7 +920,7 @@ static void ivas_param_mc_param_est_enc_fx( 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, add( 20, gb ), &imag_e ); + 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; @@ -967,9 +988,19 @@ static void ivas_param_mc_param_est_enc_fx( 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 FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { @@ -979,15 +1010,23 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); c_e = sub( add20gb, c_e ); + if ( c_fx == 0 ) + { + c_e = 0; + move16(); + } d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); d_e = sub( add20gb, d_e ); + if ( d_fx == 0 ) + { + d_e = 0; + 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 ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, -- GitLab From d9eb2c888d202ebc3e1f51595d9903fbaf8e5813 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 10:44:28 +0100 Subject: [PATCH 004/358] deactivate switches for testing --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2fc2f64b4..c87cd23da 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,8 +159,8 @@ #define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +// #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ +// #define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ #define FIX_ISSUE_1247 -- GitLab From 8fcadb93851018d4702a386c6dcf388e72810373 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 12:23:28 +0100 Subject: [PATCH 005/358] added some push/pop wmops , introduced FIX_1072_SPEEDUP_output_synthesis_procSlot --- lib_com/ivas_dirac_com.c | 51 ++++++++ lib_com/options.h | 5 + lib_dec/ivas_dirac_dec.c | 23 +++- lib_rend/ivas_dirac_output_synthesis_dec.c | 143 ++++++++++++++++++++- 4 files changed, 214 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index ebd958e1b..796fc8960 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -960,6 +960,7 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); + push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ @@ -967,6 +968,28 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); + +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB + Word16 shift_q = sub( q_tmp, q_ene ); + Word32 shiftEquiv; + Word16 shift_qtotal; + if( shift_q < 0 ) + { + shiftEquiv = L_lshl( 0x80000000, shift_q ); + shift_qtotal = sub( min_q_shift1, 0 ); + } + if( shift_q >= 0 ) + { + shiftEquiv = L_add( 0x7FFFFFFF, 0 ); + shift_qtotal = sub( min_q_shift1, shift_q ); + } + FOR( k = 0; k < num_freq_bands; k++ ) + { + tmp = L_shl( p_tmp_c[k], shift_qtotal ); + energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); + move32(); + } +#else Word16 shift_q = sub( q_tmp, q_ene ); IF( shift_q < 0 ) { @@ -986,6 +1009,9 @@ void computeDiffuseness_fixed( move32(); } } +#endif + + q_ene = s_min( q_ene, q_tmp ); @@ -993,6 +1019,28 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB + if( shift_q >= 0 ) + { + shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); + shift_qtotal = sub( min_q_shift2, shift_q ); + } + if ( shift_q < 0 ) + { + shiftEquiv = L_lshl( 0x80000000, shift_q ); + shift_qtotal = sub( min_q_shift2, 0 ); + } + FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) + { + p_tmp = buffer_intensity[j][i]; + FOR( k = 0; k < num_freq_bands; k++ ) + { + tmp = L_shl( p_tmp[k], shift_qtotal ); + intensity_slow[j * num_freq_bands + k] = Madd_32_32_r( tmp, intensity_slow[j * num_freq_bands + k], shiftEquiv ); + move32(); + } + } +#else IF( shift_q > 0 ) { FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) @@ -1019,8 +1067,11 @@ void computeDiffuseness_fixed( } } } +#endif + q_intensity = s_min( q_intensity, q_tmp ); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" );/*/ min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); diff --git a/lib_com/options.h b/lib_com/options.h index fa1fd8f4e..47a8f8b2c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,3 +153,8 @@ #define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ #endif #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ + + +#define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ +#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ \ No newline at end of file diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 95cca12a0..318a3ec55 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2231,7 +2231,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); Word16 tmp1; - push_wmops( "ivas_dirac_dec_render" ); + push_wmops( "ivas_dirac_dec_render (IDR)" ); /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2341,6 +2341,7 @@ void ivas_dirac_dec_render_sf_fx( } ELSE IF( !( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { + push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" ); Word16 outchannels; idx_lfe = 0; move16(); @@ -2409,6 +2410,7 @@ void ivas_dirac_dec_render_sf_fx( } } } + pop_wmops(); /*push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" );*/ } size = imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); @@ -2555,7 +2557,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; @@ -2706,6 +2708,7 @@ void ivas_dirac_dec_render_sf_fx( } } + push_wmops( "(IDR) LOOP1" ); FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = add( slot_idx_start, slot_idx ); @@ -2923,6 +2926,8 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: + pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; @@ -2932,6 +2937,7 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * Compute DirAC parameters at decoder side *-----------------------------------------------------------------*/ + push_wmops( "(IDR) LOOP1 DirACparams |" ); IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); @@ -2980,8 +2986,11 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q; move16(); + push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" ); 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 ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" );/*/ } + pop_wmops(); /* push_wmops( "(IDR) LOOP1 DirACparams |" );*/ /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -3083,6 +3092,7 @@ void ivas_dirac_dec_render_sf_fx( } /*Compute PSDs*/ + push_wmops( "(IDR) LOOP1 PSDs |" ); h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); num_channels_dir = hDirACRend->num_outputs_dir; @@ -3165,6 +3175,7 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" ); ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, DirAC_mem.reference_power_q, p_onset_filter_fx, @@ -3182,6 +3193,7 @@ void ivas_dirac_dec_render_sf_fx( md_idx, hodirac_flag, hDirAC->hConfig->dec_param_estim ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" );/*/ } IF( hDirAC->hConfig->dec_param_estim ) @@ -3252,7 +3264,9 @@ void ivas_dirac_dec_render_sf_fx( 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 ); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs |" );*/ } + pop_wmops(); /*push_wmops( "(IDR) LOOP1" );*/ minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -3581,7 +3595,6 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ - index_slot = slot_idx_start_cldfb_synth; move16(); @@ -3963,6 +3976,7 @@ void ivas_dirac_dec_render_sf_fx( } } + hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); move16(); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); @@ -4077,8 +4091,7 @@ void ivas_dirac_dec_render_sf_fx( } } } - - pop_wmops(); + pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 4686ca1e6..320492c66 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -710,11 +710,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } + push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" ); test(); IF( dec_param_estim == FALSE && hodirac_flag ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" ); v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], @@ -737,19 +739,24 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); h_dirac_output_synthesis_state->direct_power_factor_q = 30; move16(); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" );/*/ } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" ); ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_fx, &h_dirac_output_synthesis_state->direct_power_factor_q, &h_dirac_output_synthesis_state->diffuse_power_factor_q ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" );*/ } } ELSE IF( EQ_16( dec_param_estim, TRUE ) ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" ); + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" ); /* compute direct responses */ ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, @@ -764,7 +771,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); - + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" );*/ { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -811,12 +818,14 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; move16(); } - + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" ); FOR( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) { Word16 k; IF( ch_idx != 0 ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" ); + ; 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; @@ -906,6 +915,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } 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*/ + + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" ); 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 @@ -931,11 +942,63 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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)*/ } } +#ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot + q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( 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, 4 ); 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 + /*Todo: simplify so that mpy+add can be merged to madd*/ + + //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)*/ + + { + Word16 mpy_diff_c_exp = sub( 31, q_diff_c ); + Word16 q_diff_aab_exp = sub( 31, q_diff_aab ); + + Word32 L_tmp; + Word16 shift; + + if ( !mpy_diff_c ) + mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); + + if ( !mpy_diff_aab ) + q_diff_aab_exp = add( mpy_diff_c_exp, 0 ); + + shift = sub( mpy_diff_c_exp, q_diff_aab_exp ); + shift = s_max( -31, shift ); + shift = s_min( 31, shift ); + if ( shift < 0 ) + { + /* exponent of b is greater than exponent of a, shr mpy_diff_c */ + mpy_diff_c = L_shl( mpy_diff_c, shift ); + } + if ( shift > 0 ) + { + /* exponent of a is greater than exponent of b */ + mpy_diff_aab = L_shr( mpy_diff_aab, shift ); + } + mpy_diff_c_exp = add( s_max( mpy_diff_c_exp, q_diff_aab_exp ), 1 ); + L_tmp = L_add( L_shr( mpy_diff_c, 1 ), L_shr( mpy_diff_aab, 1 ) ); + shift = norm_l( L_tmp ); + if ( shift ) + L_tmp = L_shl( L_tmp, shift ); + if ( L_tmp == 0 ) + mpy_diff_c_exp = add( 0, 0 ); + if ( L_tmp != 0 ) + mpy_diff_c_exp = sub( mpy_diff_c_exp, shift ); + sqr_exp = mpy_diff_c_exp; + + sqr_inp = L_tmp; + } + +#else + 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 + q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( 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, 4 ); @@ -959,6 +1022,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } +#endif + 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 ) @@ -987,9 +1052,12 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" );*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" );*/ } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" ); Word32 sqr_inp, mpy_diff, sqr; Word16 sqr_exp; /*Diffuseness modellling nrg compensation*/ @@ -1027,6 +1095,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" ); 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 @@ -1060,8 +1129,12 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ + pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ + Word16 temp = MAX_16; /*q0*/ move16(); tmp16 = imult1616( num_freq_bands, num_channels_dir ); @@ -1078,9 +1151,21 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } free( Q_temp_cy_cross_dir_smooth_fx ); /*Directional gain (panning)*/ + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" ); + 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 ) ) { +#ifdef FIX_1072_SPEEDUP_gainpanning /*is there any difference in any bitstream?*/ + 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(); +#else 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_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ->temp_q*/ @@ -1088,7 +1173,53 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); +#endif + + } +#ifdef FIX_1072_SPEEDUP_gainpanning + 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++ ) + { + IF( NE_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) + { + Word16 i; + Word32 aux; + IF(temp_q1 < 0) + { + Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); + FOR( i = 0; i < num_freq_bands; i++ ) + { + aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); + move32(); + } + } + ELSE + { + FOR( i = 0; i < num_freq_bands; i++ ) + { + aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + aux = L_shl( aux, temp_q1 ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux ); + move32(); + } + } + + } + ELSE + { + Word16 i; + FOR( i = 0; i < num_freq_bands; i++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + move32(); + } + } + + } + +#else FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { v_mult_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, @@ -1107,6 +1238,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ } +#endif + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" );*/ + /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { @@ -1124,7 +1258,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], num_freq_bands_diff, 0 ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ } - + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3 <<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ return; } ELSE @@ -1143,7 +1278,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ diff_start_band = 0; move16(); -- GitLab From e195b40a9d3cc49024483b47e5b60932b3a298a2 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 15:21:55 +0100 Subject: [PATCH 006/358] delete FIX_1072_SPEEDUP_output_synthesis_procSlot --- lib_com/options.h | 3 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 33 +++++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9e9295f22..b3a1e4238 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -/*#define WMOPS*/ /* Activate complexity and memory counters */ +#define WMOPS /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -170,6 +170,5 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ -#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ #endif \ No newline at end of file diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 320492c66..39d52be9f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -942,28 +942,27 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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)*/ } } +#define FIX_1072_SPEEDUP_output_synthesis_procSlot #ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( 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, 4 ); - 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 - - /*Todo: simplify so that mpy+add can be merged to madd*/ - - //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)*/ - { Word16 mpy_diff_c_exp = sub( 31, q_diff_c ); Word16 q_diff_aab_exp = sub( 31, q_diff_aab ); - Word32 L_tmp; + Word32 L_tmp, L_tmp1, L_tmp2; Word16 shift; - if ( !mpy_diff_c ) - mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); + 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 + + L_tmp = L_add( diffuseness[k], 0 ); + if ( !diffuseness[k] ) + mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); + if ( !c ) + mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); if ( !mpy_diff_aab ) q_diff_aab_exp = add( mpy_diff_c_exp, 0 ); @@ -973,7 +972,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( if ( shift < 0 ) { /* exponent of b is greater than exponent of a, shr mpy_diff_c */ - mpy_diff_c = L_shl( mpy_diff_c, shift ); + L_tmp = L_shl( L_tmp, shift ); } if ( shift > 0 ) { @@ -981,7 +980,15 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( mpy_diff_aab = L_shr( mpy_diff_aab, shift ); } mpy_diff_c_exp = add( s_max( mpy_diff_c_exp, q_diff_aab_exp ), 1 ); - L_tmp = L_add( L_shr( mpy_diff_c, 1 ), L_shr( mpy_diff_aab, 1 ) ); + L_tmp = L_shr( L_tmp, 1 ); + L_tmp1 = L_shr( mpy_diff_aab, 1 ); + + L_tmp = Madd_32_32( L_tmp1, L_tmp, c ); // Q = q_diffuseness - 4 + + /*Todo: simplify so that mpy+add can be merged to madd*/ + + // 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)*/ + shift = norm_l( L_tmp ); if ( shift ) L_tmp = L_shl( L_tmp, shift ); -- GitLab From 7ffce0ac054813b100e1d6fa03aaf7cc8139c5a8 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 15:22:21 +0100 Subject: [PATCH 007/358] delete FIX_1072_SPEEDUP_output_synthesis_procSlot 2 --- lib_rend/ivas_dirac_output_synthesis_dec.c | 61 ---------------------- 1 file changed, 61 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 39d52be9f..6a7a73c18 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -942,66 +942,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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)*/ } } -#define FIX_1072_SPEEDUP_output_synthesis_procSlot -#ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( 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, 4 ); - - { - Word16 mpy_diff_c_exp = sub( 31, q_diff_c ); - Word16 q_diff_aab_exp = sub( 31, q_diff_aab ); - - Word32 L_tmp, L_tmp1, L_tmp2; - Word16 shift; - - 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 - - L_tmp = L_add( diffuseness[k], 0 ); - - if ( !diffuseness[k] ) - mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); - if ( !c ) - mpy_diff_c_exp = add( q_diff_aab_exp, 0 ); - if ( !mpy_diff_aab ) - q_diff_aab_exp = add( mpy_diff_c_exp, 0 ); - - shift = sub( mpy_diff_c_exp, q_diff_aab_exp ); - shift = s_max( -31, shift ); - shift = s_min( 31, shift ); - if ( shift < 0 ) - { - /* exponent of b is greater than exponent of a, shr mpy_diff_c */ - L_tmp = L_shl( L_tmp, shift ); - } - if ( shift > 0 ) - { - /* exponent of a is greater than exponent of b */ - mpy_diff_aab = L_shr( mpy_diff_aab, shift ); - } - mpy_diff_c_exp = add( s_max( mpy_diff_c_exp, q_diff_aab_exp ), 1 ); - L_tmp = L_shr( L_tmp, 1 ); - L_tmp1 = L_shr( mpy_diff_aab, 1 ); - - L_tmp = Madd_32_32( L_tmp1, L_tmp, c ); // Q = q_diffuseness - 4 - - /*Todo: simplify so that mpy+add can be merged to madd*/ - - // 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)*/ - - shift = norm_l( L_tmp ); - if ( shift ) - L_tmp = L_shl( L_tmp, shift ); - if ( L_tmp == 0 ) - mpy_diff_c_exp = add( 0, 0 ); - if ( L_tmp != 0 ) - mpy_diff_c_exp = sub( mpy_diff_c_exp, shift ); - sqr_exp = mpy_diff_c_exp; - - sqr_inp = L_tmp; - } - -#else 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 @@ -1029,7 +969,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } -#endif sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ -- GitLab From 9ab12acf35c129fae7d4bfc27bde0200a2331f59 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 16:01:44 +0100 Subject: [PATCH 008/358] Some more push/pop wmops --- lib_com/ivas_dirac_com.c | 4 ++-- lib_com/options.h | 2 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 796fc8960..97c8a88bd 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -969,7 +969,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; @@ -1019,7 +1019,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS if( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); diff --git a/lib_com/options.h b/lib_com/options.h index b3a1e4238..44e1e3623 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,6 +169,6 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* "-" */ #endif \ No newline at end of file diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 6a7a73c18..540934a63 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -623,7 +623,6 @@ 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 Word16 q_reference_power, /* i : Estimated power Q */ @@ -756,7 +755,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( ELSE IF( EQ_16( dec_param_estim, TRUE ) ) { push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" ); - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" ); /* compute direct responses */ ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, @@ -771,7 +769,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" );*/ { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -945,7 +942,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( 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, 4 ); @@ -2974,6 +2970,8 @@ void ivas_dirac_dec_compute_directional_responses_fx( Word16 dipole_freq_range[2]; MASA_TRANSPORT_SIGNAL_TYPE transport_signal_type; + push_wmops( "(IDR PATH3 B3.1)" ); + Q_direct_response_ls = Q31; move16(); exp_direct_response_ls = 0; @@ -3035,6 +3033,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( LT_16( k, MASA_band_grouping_24[masa_band_mapping[add( codingBand, 1 )]] ) && NE_16( k, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ) ) { + push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " ); /* Panning gains have to be computed only for the first bin of the coding band in MASA, for other bins the previous values can be used */ IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { @@ -3046,12 +3045,15 @@ void ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ + pop_wmops();/*push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " );*/ } ELSE { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " ); /* HOA3 PANNING */ IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) ) { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF" ); set32_fx( direct_response_hoa_fx, ONE_IN_Q29, MAX_OUTPUT_CHANNELS ); /*q29*/ set32_fx( direct_response_dir2_fx, ONE_IN_Q29, MAX_OUTPUT_CHANNELS ); /*q29*/ @@ -3350,9 +3352,11 @@ void ivas_dirac_dec_compute_directional_responses_fx( { assert( 0 && "Not supported synthesis method!" ); } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF" );*/ } ELSE IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) /*VBAP*/ { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" ); /* Synthesize the first direction */ spreadCoherencePanningVbap_fx( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence_fx[md_idx][k], direct_response_ls_fx, &Q_direct_response_ls, num_channels_dir, hVBAPdata ); @@ -3604,11 +3608,13 @@ void ivas_dirac_dec_compute_directional_responses_fx( mvr2r_inc_fixed( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" );*/ } ELSE { assert( 0 && "Not supported panning method!" ); } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " );*/ } } @@ -3617,6 +3623,8 @@ void ivas_dirac_dec_compute_directional_responses_fx( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = direct_response_square_q; move16(); + + pop_wmops(); return; } -- GitLab From b949948e2b31ca8013cc26ca8e6a3b8cf8cca02d Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:23:33 +0100 Subject: [PATCH 009/358] version now with 2 macros for NONBE and BE code parts --- lib_com/options.h | 4 +++- lib_enc/ivas_mc_param_enc.c | 44 ++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c87cd23da..9ee0d46fc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,9 @@ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ // #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -// #define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +/* 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_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ #define FIX_ISSUE_1247 diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index e205a015e..b5bc92016 100755 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -723,14 +723,14 @@ static void ivas_param_mc_param_est_enc_fx( } } -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#if defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE ) || defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE ) Word16 gb = find_guarded_bits_fx( l_ts ); Word16 add20gb = add( 20, gb ); #endif FOR( ts = start_ts; ts < num_time_slots; ts++ ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#if !defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE ) && !defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE ) Word16 gb = find_guarded_bits_fx( l_ts ); #endif ivas_fb_mixer_get_windowed_fr_fx( hParamMC->hFbMixer, pcm_in_fx, p_slot_frame_f_real_fx, p_slot_frame_f_imag_fx, l_ts, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans, gb ); @@ -741,6 +741,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( i = 0; i < nchan_input; i++ ) { pcm_in_fx[i] += l_ts; + move32(); } /* Computing the downmix */ FOR( cur_param_band = 0; cur_param_band < hParamMC->max_param_band_abs_cov; cur_param_band++ ) @@ -758,6 +759,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -776,6 +778,28 @@ static void ivas_param_mc_param_est_enc_fx( move32(); p_dmx_fac_fx++; } +#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 */ @@ -815,7 +839,7 @@ 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 +#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 ); @@ -835,7 +859,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); @@ -887,7 +911,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -937,7 +961,7 @@ static void ivas_param_mc_param_est_enc_fx( /* Cx for transport channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -949,7 +973,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -984,7 +1008,7 @@ 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 +#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 ); @@ -1004,7 +1028,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); @@ -1031,7 +1055,7 @@ 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 ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); - move32(); +pri move32(); } } } -- GitLab From d07b495424684c5238177f60d920ca6a2584cb30 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:25:46 +0100 Subject: [PATCH 010/358] fix stupid typo --- lib_enc/ivas_mc_param_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index b5bc92016..248f80d81 100755 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -1055,7 +1055,7 @@ 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 ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); -pri move32(); + move32(); } } } -- GitLab From cfa5fa996e7797541a2b2bd9fe04305f77ea7379 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:28:27 +0100 Subject: [PATCH 011/358] fix clang-format-issues --- lib_enc/ivas_mc_param_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 lib_enc/ivas_mc_param_enc.c diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c old mode 100755 new mode 100644 index 248f80d81..c50f58ff3 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -779,8 +779,8 @@ static void ivas_param_mc_param_est_enc_fx( p_dmx_fac_fx++; } #else - Word32 real_fx = L_add(0,0); - Word16 real_e = add(0, 0); + 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++ ) -- GitLab From 1bb7dd5c70dda96a488f52e4c56dc475ecf35c86 Mon Sep 17 00:00:00 2001 From: Bauer Date: Thu, 20 Feb 2025 10:46:34 +0100 Subject: [PATCH 012/358] added/changed FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot & FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx --- lib_com/ivas_prot_fx.h | 8 ++ lib_com/ivas_spar_com.c | 135 +++++++++++++++++++++ lib_com/options.h | 7 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 117 +++++++++++++----- 4 files changed, 237 insertions(+), 30 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 5ce037b9a..ed72fd178 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -4994,6 +4994,14 @@ void ivas_dirac_dec_get_response_fx( const Word16 ambisonics_order, Word16 Q_out ); +#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +void ivas_dirac_dec_get_response_fx_29( + const Word16 azimuth, + const Word16 elevation, + Word32 *response_fx, /*Q_out*/ + const Word16 ambisonics_order); + #endif + void calculate_hodirac_sector_parameters_fx( DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ Word32 RealBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 14de6cc15..cd5bab07c 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -7173,6 +7173,141 @@ void ivas_dirac_dec_get_response_fx( return; } +#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +void ivas_dirac_dec_get_response_fx_29( + const Word16 azimuth, + const Word16 elevation, + Word32 *response_fx, /*Q_out*/ + const Word16 ambisonics_order) +{ + Word16 index_azimuth, index_elevation; + Word16 el, az; + Word32 cos_1_fx, cos_2_fx, sin_1_fx, cos_az_fx[3]; + Word32 sin_az_fx[3]; + Word32 f_fx; + Word32 c_fx_better; + Word16 l, m; + Word16 b, b1, b_2, b1_2; + //Word16 Q_out = 29; + + push_wmops( "ivas_dirac_dec_get_response_fx_29" ); + index_azimuth = add( azimuth, 180 ) % 360; + move16(); + index_elevation = add( elevation, 90 ); + + Word32 e_fac = L_add(0x7FFFFFFF, 0); + + if ( GT_16( index_elevation, 90 ) ) + { + e_fac = L_add(0x80000000, 0); + } + + + el = index_elevation; + move16(); + + if ( GT_16( index_elevation, 90 ) ) + { + el = sub( 180, index_elevation ); + } + + az = index_azimuth; + move16(); + + if ( GT_16( index_azimuth, 180 ) ) + { + az = sub( 360, index_azimuth ); + } + + f_fx = 1; + move16(); + + if ( GT_16( index_azimuth, 180 ) ) + { + f_fx = -1; + } + + cos_1_fx = L_shr( dirac_gains_trg_term_fx[az][0], 1 ); // q30 + cos_2_fx = L_shl( Mpy_32_32( cos_1_fx, cos_1_fx ), 1 ); // q30 + sin_1_fx = L_shr( dirac_gains_trg_term_fx[az][1], 1 ); // q30 + + if ( EQ_32( f_fx, -1 ) ) + { + sin_1_fx = L_negate( sin_1_fx ); // q30 + } + cos_az_fx[0] = cos_1_fx; // q30 + move32(); + cos_az_fx[1] = L_shl( L_sub( cos_2_fx, ONE_IN_Q29 /*0.5 q30*/ ), 1 ); /*q30*/ + move32(); + cos_az_fx[2] = L_sub( L_shl( Mpy_32_32( cos_1_fx, cos_az_fx[1] ), 2 ), cos_az_fx[0] /* cos_az_fx[0] q30*/ ); /*q30*/ + move32(); + sin_az_fx[0] = sin_1_fx; /*q30*/ + move32(); + sin_az_fx[1] = L_shl( Mpy_32_32( sin_1_fx, cos_1_fx ), 2 ); /*q30*/ + move32(); + sin_az_fx[2] = L_shl( Mpy_32_32( sin_1_fx, L_sub( cos_2_fx, ONE_IN_Q28 /*1/4 q30*/ ) ), 3 ); /*q30*/ + move32(); + + //response_fx[0] = L_shl_sat( 1, Q_out ); // Q_out + response_fx[0] = 0x20000000; + move32(); + + //q_diff = sub( Q_out, 29 ); + + push_wmops( "ivas_dirac_dec_get_response_fx_29_LOOPS" ); + +FOR( l = 1; l <= ambisonics_order; l++ ) + { + Word16 a; + b_2 = imult1616( l, l ); + b1_2 = add( b_2, shl( l, 1 ) ); + FOR( m = 0; m < l; m += 2 ) + { + b = b_2 + m; + a = dirac_gains_P_idx[b]; + + c_fx_better = local_result_table[el][a]; // q30 + move32(); + response_fx[b] = Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] ); // Q_out + move32(); + + b1 = b1_2 - m; + response_fx[b1] = Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] ); // Q_out + move32(); + } + + FOR( m = 1; m < l; m += 2 ) + { + b = b_2 + m; + a = dirac_gains_P_idx[b]; + c_fx_better = local_result_table[el][a]; // q30 + move32(); + c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 + response_fx[b] = Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] ); // Q_out + move32(); + + b1 = b1_2 - m; + response_fx[b1] = Mpy_32_32( c_fx_better, cos_az_fx[l - m - 1] ); // Q_out + move32(); + } + + b = add( b_2, l ); + a = dirac_gains_P_idx[b]; + c_fx_better = local_result_table_2[el][a]; // q30 + move32(); + if ( s_and( l, 0x01 ) ) + { + c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 + } + response_fx[b] = L_shl( c_fx_better, -1 ); // Q_out + move32(); + } + + pop_wmops(); /*push_wmops( "ivas_dirac_dec_get_response_fx_29_LOOPS" );*/ + pop_wmops(); /*push_wmops( "ivas_dirac_dec_get_response_fx_29" );*/ + return; +} +#endif /*FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx*/ /*-----------------------------------------------------------------------------------------* * Function ivas_get_bits_to_encode * diff --git a/lib_com/options.h b/lib_com/options.h index 44e1e3623..8fe969bb6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,11 +164,12 @@ #define FIX_ISSUE_1247 #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_1285_DECODER_CRASH - #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ +#define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* "-" */ -#define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* "-" */ +#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ +#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ #endif \ No newline at end of file diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 540934a63..f7d18b65d 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -821,7 +821,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word16 k; IF( ch_idx != 0 ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" ); + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop A <<<<<-|" ); ; Word32 a, c; Word16 b, b_exp, sqr_exp, q_diff_aab, q_diff_c; @@ -912,8 +912,50 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } 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*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop A <<<<<-|" );*/ + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" ); +#ifdef FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot + 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 + { + 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 + //q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q, add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); + q_diff_c = sub( q_diffuseness, 4 ); + + 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 + { + 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 + //q_diff_aab = add( add(h_dirac_output_synthesis_state->direct_responses_q , sub( sub( 15, b_exp ), 15 )), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); + q_diff_c = sub( q_diffuseness, 4 ); - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" ); + 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)*/ + + } + } + sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ + sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ + } +#else 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 @@ -942,7 +984,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( sub( 15, b_exp ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + q_diff_aab = add( add( h_dirac_output_synthesis_state->direct_responses_q, sub( 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, 4 ); test(); @@ -968,38 +1010,40 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 ) + } +#endif + + 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 ) ) { - 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(); - 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*/ - 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]*/ + 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(); + Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); + move16(); } 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(); - Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); + 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*/ + 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(); + Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); + move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" );*/ + + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" );*/ } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" ); + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop C <<<<<-|" ); Word32 sqr_inp, mpy_diff, sqr; Word16 sqr_exp; /*Diffuseness modellling nrg compensation*/ @@ -1037,7 +1081,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop C <<<<<<-|" );*/ + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop D <<<<<<-|" ); 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 @@ -1071,8 +1116,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ - pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ + + pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop D <<<<<-|" );/*/ } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ @@ -3066,24 +3111,38 @@ void ivas_dirac_dec_compute_directional_responses_fx( exp_direct_response_dir2 = 0; move16(); + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse" ); IF( p_Rmat != 0 ) { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse_SPLIT_FX" ); ivas_dirac_dec_get_response_split_order_fx( azimuth[k], elevation[k], direct_response_hoa_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_hoa ); IF( hodirac_flag ) { ivas_dirac_dec_get_response_split_order_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_dir2 ); } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse_SPLIT_FX" );*/ } ELSE { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" ); +#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx + ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order); +#else ivas_dirac_dec_get_response_fx( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_hoa ); +#endif IF( hodirac_flag ) { +#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx + ivas_dirac_dec_get_response_fx_29( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order); +#else ivas_dirac_dec_get_response_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_dir2 ); +#endif } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" );*/ } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse" );*/ test(); test(); @@ -3091,16 +3150,19 @@ void ivas_dirac_dec_compute_directional_responses_fx( test(); IF( masa_band_mapping == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH1" ); mvr2r_inc_fixed( direct_response_hoa_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_hoa*/ IF( hodirac_flag ) { mvr2r_inc_fixed( direct_response_dir2_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_dir2*/ } + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH1" );*/ } ELSE IF( ( ( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) && ( masa_band_mapping != NULL ) ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { + push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" ); /* Synthesize the first direction */ IF( GT_16( Q_direct_response_hoa, Q29 ) ) { @@ -3347,6 +3409,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( } mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*q29*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" );*/ } ELSE { -- GitLab From 62d1d624acb3f90d7b7b3405ef026972dd794a33 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 11:32:40 +0100 Subject: [PATCH 013/358] deactivated temporarily the NONBE part of this MR to check the pipeline results --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9ee0d46fc..bee60af30 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,7 +162,7 @@ // #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ /* 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_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ #define FIX_ISSUE_1247 -- GitLab From abc297aae68e774f96cdb5ac108997b539f289a4 Mon Sep 17 00:00:00 2001 From: Bauer Date: Thu, 20 Feb 2025 13:57:31 +0100 Subject: [PATCH 014/358] some more mods to FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot --- lib_rend/ivas_dirac_output_synthesis_dec.c | 56 ++++++++++++++++------ 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index f7d18b65d..d96165ba4 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -821,8 +821,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word16 k; IF( ch_idx != 0 ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop A <<<<<-|" ); - ; 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; @@ -912,7 +910,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } 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*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop A <<<<<-|" );*/ + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" ); #ifdef FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot FOR( ; k < num_freq_bands; k++ ) @@ -926,16 +924,20 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } 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 //q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q, add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); - q_diff_c = sub( q_diffuseness, 4 ); + //q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); + 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 ) ) ); + //q_diff_c = sub( q_diffuseness, 4 ); + diff_c_exp = sub( 31 + 4, q_diffuseness ); - 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)*/ + 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 { @@ -945,16 +947,44 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 //q_diff_aab = add( add(h_dirac_output_synthesis_state->direct_responses_q , sub( sub( 15, b_exp ), 15 )), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); - q_diff_c = sub( q_diffuseness, 4 ); + //q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); + 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 ); + //q_diff_c = sub( q_diffuseness, 4 ); + diff_c_exp = sub( 31 + 4, q_diffuseness ); - 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)*/ + 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(); + 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*/ + 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(); + Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); + move16(); + } #else FOR( ; k < num_freq_bands; k++ ) { @@ -1011,7 +1041,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ } -#endif IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) { @@ -1038,12 +1067,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); move16(); } +#endif + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" );*/ } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop C <<<<<-|" ); Word32 sqr_inp, mpy_diff, sqr; Word16 sqr_exp; /*Diffuseness modellling nrg compensation*/ @@ -1081,8 +1111,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop C <<<<<<-|" );*/ - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop D <<<<<<-|" ); 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 @@ -1116,8 +1144,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - - pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop D <<<<<-|" );/*/ } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ -- GitLab From 552ffd749e2a208554bcf06ed5afb13cd9acbc85 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 14:57:16 +0100 Subject: [PATCH 015/358] reactivated NONBE modifications to see pipeline effects --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 006a3811d..1a2e77c95 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,7 +162,7 @@ // #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ /* 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_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ -//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ #define FIX_ISSUE_1247 -- GitLab From 592784dde6f72cd513196a8066255e1b0a1d4be6 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Feb 2025 14:52:16 +0000 Subject: [PATCH 016/358] Revert some unwanted changes --- lib_com/ivas_prot_fx.h | 2 +- lib_com/options.h | 1 - lib_dec/ivas_dirac_dec.c | 3 ++- lib_rend/ivas_dirac_output_synthesis_dec.c | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 21583afe5..96a628408 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -5001,7 +5001,7 @@ void ivas_dirac_dec_get_response_fx_29( const Word16 elevation, Word32 *response_fx, /*Q_out*/ const Word16 ambisonics_order); - #endif +#endif void calculate_hodirac_sector_parameters_fx( DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ diff --git a/lib_com/options.h b/lib_com/options.h index 8fe969bb6..88bb82c2e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,7 +164,6 @@ #define FIX_ISSUE_1247 #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_1285_DECODER_CRASH -#define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, in development*/ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* "-" */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 318a3ec55..13ba3479b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3595,6 +3595,7 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ + index_slot = slot_idx_start_cldfb_synth; move16(); @@ -3976,7 +3977,6 @@ void ivas_dirac_dec_render_sf_fx( } } - hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); move16(); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); @@ -4091,6 +4091,7 @@ void ivas_dirac_dec_render_sf_fx( } } } + pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ return; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index d96165ba4..a620095a0 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -623,6 +623,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)*/ const Word16 q_reference_power, /* i : Estimated power Q */ @@ -769,6 +770,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); + { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -1011,9 +1013,11 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 + q_diff_aab = add( add( h_dirac_output_synthesis_state->direct_responses_q, sub( 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, 4 ); @@ -1037,7 +1041,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ } -- GitLab From 9c1092282d7f2d8635aec151f01ee76ff1640463 Mon Sep 17 00:00:00 2001 From: Bauer Date: Thu, 20 Feb 2025 15:57:09 +0100 Subject: [PATCH 017/358] applied clang patch --- lib_com/ivas_dirac_com.c | 7 ++-- lib_com/ivas_prot_fx.h | 2 +- lib_com/ivas_spar_com.c | 18 +++++------ lib_com/options.h | 4 +-- lib_dec/ivas_dirac_dec.c | 6 ++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 37 ++++++++++------------ 6 files changed, 34 insertions(+), 40 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 97c8a88bd..d03191084 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -973,12 +973,12 @@ void computeDiffuseness_fixed( Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; - if( shift_q < 0 ) + if ( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); shift_qtotal = sub( min_q_shift1, 0 ); } - if( shift_q >= 0 ) + if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift1, shift_q ); @@ -1012,7 +1012,6 @@ void computeDiffuseness_fixed( #endif - q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ @@ -1020,7 +1019,7 @@ void computeDiffuseness_fixed( shift_q = sub( q_tmp, q_intensity ); #ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS - if( shift_q >= 0 ) + if ( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift2, shift_q ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 96a628408..95dde1650 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -5000,7 +5000,7 @@ void ivas_dirac_dec_get_response_fx_29( const Word16 azimuth, const Word16 elevation, Word32 *response_fx, /*Q_out*/ - const Word16 ambisonics_order); + const Word16 ambisonics_order ); #endif void calculate_hodirac_sector_parameters_fx( diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index cd5bab07c..c6194b8de 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -7178,7 +7178,7 @@ void ivas_dirac_dec_get_response_fx_29( const Word16 azimuth, const Word16 elevation, Word32 *response_fx, /*Q_out*/ - const Word16 ambisonics_order) + const Word16 ambisonics_order ) { Word16 index_azimuth, index_elevation; Word16 el, az; @@ -7188,18 +7188,18 @@ void ivas_dirac_dec_get_response_fx_29( Word32 c_fx_better; Word16 l, m; Word16 b, b1, b_2, b1_2; - //Word16 Q_out = 29; + // Word16 Q_out = 29; push_wmops( "ivas_dirac_dec_get_response_fx_29" ); index_azimuth = add( azimuth, 180 ) % 360; move16(); index_elevation = add( elevation, 90 ); - Word32 e_fac = L_add(0x7FFFFFFF, 0); + Word32 e_fac = L_add( 0x7FFFFFFF, 0 ); if ( GT_16( index_elevation, 90 ) ) { - e_fac = L_add(0x80000000, 0); + e_fac = L_add( 0x80000000, 0 ); } @@ -7248,15 +7248,15 @@ void ivas_dirac_dec_get_response_fx_29( sin_az_fx[2] = L_shl( Mpy_32_32( sin_1_fx, L_sub( cos_2_fx, ONE_IN_Q28 /*1/4 q30*/ ) ), 3 ); /*q30*/ move32(); - //response_fx[0] = L_shl_sat( 1, Q_out ); // Q_out + // response_fx[0] = L_shl_sat( 1, Q_out ); // Q_out response_fx[0] = 0x20000000; move32(); - //q_diff = sub( Q_out, 29 ); + // q_diff = sub( Q_out, 29 ); push_wmops( "ivas_dirac_dec_get_response_fx_29_LOOPS" ); -FOR( l = 1; l <= ambisonics_order; l++ ) + FOR( l = 1; l <= ambisonics_order; l++ ) { Word16 a; b_2 = imult1616( l, l ); @@ -7282,7 +7282,7 @@ FOR( l = 1; l <= ambisonics_order; l++ ) a = dirac_gains_P_idx[b]; c_fx_better = local_result_table[el][a]; // q30 move32(); - c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 + c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 response_fx[b] = Mpy_32_32( c_fx_better, sin_az_fx[l - m - 1] ); // Q_out move32(); @@ -7297,7 +7297,7 @@ FOR( l = 1; l <= ambisonics_order; l++ ) move32(); if ( s_and( l, 0x01 ) ) { - c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 + c_fx_better = Mpy_32_32( c_fx_better, e_fac ); // q30 } response_fx[b] = L_shl( c_fx_better, -1 ); // Q_out move32(); diff --git a/lib_com/options.h b/lib_com/options.h index 88bb82c2e..4ef49845c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -#define WMOPS /* Activate complexity and memory counters */ +//#define WMOPS /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -171,4 +171,4 @@ #define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ #define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ -#endif \ No newline at end of file +#endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 13ba3479b..77287dc76 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2557,7 +2557,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; @@ -2926,7 +2926,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: - pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } @@ -4091,7 +4091,7 @@ void ivas_dirac_dec_render_sf_fx( } } } - + pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ return; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index a620095a0..bc4970bcc 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -770,7 +770,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); - + { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -933,10 +933,10 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - //q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q, add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - //q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); + // q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q, add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + // q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); 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 ) ) ); - //q_diff_c = sub( q_diffuseness, 4 ); + // q_diff_c = sub( q_diffuseness, 4 ); 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)*/ @@ -948,14 +948,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - //q_diff_aab = add( add(h_dirac_output_synthesis_state->direct_responses_q , sub( sub( 15, b_exp ), 15 )), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - //q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); + // q_diff_aab = add( add(h_dirac_output_synthesis_state->direct_responses_q , sub( sub( 15, b_exp ), 15 )), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + // q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); 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 ); - //q_diff_c = sub( q_diffuseness, 4 ); + // q_diff_c = sub( q_diffuseness, 4 ); 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)*/ @@ -1190,7 +1189,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); #endif - } #ifdef FIX_1072_SPEEDUP_gainpanning Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); @@ -1200,13 +1198,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { Word16 i; Word32 aux; - IF(temp_q1 < 0) + IF( temp_q1 < 0 ) { Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux, temp_q1_equiv ); move32(); } } @@ -1220,7 +1218,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - } ELSE { @@ -1231,8 +1228,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - - } #else @@ -1294,7 +1289,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ @@ -3119,7 +3114,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ - pop_wmops();/*push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " );*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " );*/ } ELSE { @@ -3156,7 +3151,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( { push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" ); #ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx - ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order); + ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order ); #else ivas_dirac_dec_get_response_fx( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_hoa ); #endif @@ -3164,7 +3159,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( IF( hodirac_flag ) { #ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx - ivas_dirac_dec_get_response_fx_29( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order); + ivas_dirac_dec_get_response_fx_29( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order ); #else ivas_dirac_dec_get_response_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_dir2 ); #endif @@ -3438,7 +3433,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( } mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*q29*/ - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" );*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" );*/ } ELSE { @@ -3700,13 +3695,13 @@ void ivas_dirac_dec_compute_directional_responses_fx( mvr2r_inc_fixed( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" );*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" );*/ } ELSE { assert( 0 && "Not supported panning method!" ); } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " );*/ + pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " );*/ } } -- GitLab From 94133433546736a505d76d3e6dd51c5bc7df0c6b Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 21 Feb 2025 15:17:45 +0100 Subject: [PATCH 018/358] Use input_scaling for testing --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c1e56d48d..cbab6a130 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ variables: REF_DECODER_PATH: "./IVAS_dec_ref" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' - BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" + BASOP_CI_BRANCH_PC_REPO: "ci/basop-ci-branch-input-scaling" PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" TESTCASE_TIMEOUT_STV: 900 TESTCASE_TIMEOUT_LTV: 2400 @@ -343,7 +343,7 @@ stages: - fi - *build-and-create-reference-outputs - - comp_args="--mld --ssnr --odg" + - comp_args="--mld --ssnr --odg --input_scaling $LEVEL_SCALING" - if [ "$ENCODER_TEST" = "true" ]; then - comp_args="${comp_args} --enc_stats" - fi @@ -444,11 +444,13 @@ stages: - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - allow_regressions_flag=$(grep -c --ignore-case "\[allow[ -]*regression\]" tmp.txt) || true + - comp_args="--mld --ssnr --odg --input_scaling $LEVEL_SCALING" + ### run branch first # this per default builds the branch and the reference and creates the reference outputs - *build-and-create-reference-outputs - exit_code=0 - - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH $comp_args --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true - python3 scripts/parse_xml_report.py $XML_REPORT_BRANCH $CSV_BRANCH -- GitLab From d4452776da4bc08bbf1c56271369f398d11fb963 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 25 Feb 2025 10:41:19 +0000 Subject: [PATCH 019/358] undo some unintended changes - deactivate inDev-defines --- lib_com/options.h | 4 ++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be20cf739..788eb80b9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,7 @@ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ -#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ -#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ +//#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ +//#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ #endif diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index b55a50afb..3556575fa 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -959,7 +959,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } 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 ) { @@ -986,6 +986,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); move16(); } + } #else FOR( ; k < num_freq_bands; k++ ) { @@ -1042,8 +1043,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } 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 ) ) @@ -1069,6 +1068,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); move16(); } + } #endif -- GitLab From bad5dd7ac52dbe6723eae97978a6f12d9e75757f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 25 Feb 2025 11:44:59 +0100 Subject: [PATCH 020/358] applied clang format patch --- lib_rend/ivas_dirac_output_synthesis_dec.c | 74 +++++++++++----------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 3556575fa..5ac5b676b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -959,33 +959,33 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } 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 ) ) + + IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) { - 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 )*/ + 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(); + 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*/ + 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(); - 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*/ - Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = 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_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q(31- sqr_exp)*/ + move32(); + Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); 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(); - Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } } #else FOR( ; k < num_freq_bands; k++ ) @@ -1043,31 +1043,31 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } 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 ) ) + IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) { - 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 )*/ + 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(); + 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*/ + 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(); - 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*/ - Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = 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_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k], sqr ); /*Q(31- sqr_exp)*/ + move32(); + Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); 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(); - Q_temp_cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] = sub( 31, sqr_exp ); - move16(); - } } #endif -- GitLab From 5fd61388a3eef1e1de4b9e97f0f2b3fe1e02a017 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 25 Feb 2025 12:01:48 +0100 Subject: [PATCH 021/358] fixed builderror --- lib_rend/ivas_dirac_output_synthesis_dec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 5ac5b676b..1bbecc555 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1248,8 +1248,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ } -#endif - #endif pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" );*/ -- GitLab From f854c6a7ad1d22159d570a7a0761bae6461a2c41 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 25 Feb 2025 13:06:40 +0100 Subject: [PATCH 022/358] activate inDev macros --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 788eb80b9..be20cf739 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,7 @@ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ -//#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ -//#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ +#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ #endif -- GitLab From 2b317eb444c38f6676598ef15e37554784883a2f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 25 Feb 2025 15:20:53 +0100 Subject: [PATCH 023/358] activated inDev macros --- lib_com/options.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be20cf739..8d464ccef 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -//#define WMOPS /* Activate complexity and memory counters */ +#define WMOPS /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -172,7 +172,8 @@ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ -#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ -#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ // -1.5 WMOPS +#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ // -1 WMOPS + #endif -- GitLab From da62e16d5fe1e91d6895d3e1d99b694e3a63c4bb Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 26 Feb 2025 13:25:08 +0100 Subject: [PATCH 024/358] some cleaning --- lib_com/ivas_prot_fx.h | 5 +++-- lib_com/ivas_spar_com.c | 5 +++-- lib_com/options.h | 7 +++---- lib_rend/ivas_dirac_output_synthesis_dec.c | 12 +++--------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 95dde1650..debac9a73 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -4995,11 +4995,12 @@ void ivas_dirac_dec_get_response_fx( const Word16 ambisonics_order, Word16 Q_out ); -#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +#ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx +/*This is a derivate to ivas_dirac_dec_get_response_fx with fixed Q_out=29*/ void ivas_dirac_dec_get_response_fx_29( const Word16 azimuth, const Word16 elevation, - Word32 *response_fx, /*Q_out*/ + Word32 *response_fx, /*Q_out=29*/ const Word16 ambisonics_order ); #endif diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index c6194b8de..9ef094977 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -7173,7 +7173,8 @@ void ivas_dirac_dec_get_response_fx( return; } -#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +#ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx +/*This is a derivate to ivas_dirac_dec_get_response_fx with fixed Q_out=29*/ void ivas_dirac_dec_get_response_fx_29( const Word16 azimuth, const Word16 elevation, @@ -7307,7 +7308,7 @@ void ivas_dirac_dec_get_response_fx_29( pop_wmops(); /*push_wmops( "ivas_dirac_dec_get_response_fx_29" );*/ return; } -#endif /*FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx*/ +#endif /*FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx*/ /*-----------------------------------------------------------------------------------------* * Function ivas_get_bits_to_encode * diff --git a/lib_com/options.h b/lib_com/options.h index 8d464ccef..68914fa45 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -#define WMOPS /* Activate complexity and memory counters */ +//#define WMOPS /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -171,9 +171,8 @@ #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ - -#define FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, in development*/ // -1.5 WMOPS -#define FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, in development*/ // -1 WMOPS +#define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ +#define FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, nonbe*/ #endif diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 1bbecc555..68ca49ad9 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -914,7 +914,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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*/ push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" ); -#ifdef FIX1072_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot +#ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot 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 @@ -933,10 +933,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - // q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q, add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - // q_diff_aab = sub( add( h_dirac_output_synthesis_state->direct_responses_q, add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ) ), 62 ); 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 ) ) ); - // q_diff_c = sub( q_diffuseness, 4 ); 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)*/ @@ -948,10 +945,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 - // q_diff_aab = add( add(h_dirac_output_synthesis_state->direct_responses_q , sub( sub( 15, b_exp ), 15 )), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - // q_diff_aab = add( sub( h_dirac_output_synthesis_state->direct_responses_q, b_exp ), ( sub( add( h_dirac_output_synthesis_state->direct_responses_q, q_diffuseness ), 62 ) ) ); 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 ); - // q_diff_c = sub( q_diffuseness, 4 ); 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)*/ @@ -3149,7 +3143,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( ELSE { push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" ); -#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +#ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order ); #else ivas_dirac_dec_get_response_fx( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_hoa ); @@ -3157,7 +3151,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( IF( hodirac_flag ) { -#ifdef FIX_1072_SPEEDUP_ivas_dirac_dec_get_response_fx +#ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx ivas_dirac_dec_get_response_fx_29( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order ); #else ivas_dirac_dec_get_response_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_dir2 ); -- GitLab From 67e59adf10ae3f19b1a1e4426bef5462236d91ee Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 26 Feb 2025 12:29:47 +0000 Subject: [PATCH 025/358] Del push/pop wmops --- lib_com/ivas_dirac_com.c | 2 - lib_com/ivas_spar_com.c | 9 ----- lib_com/options.h | 4 +- lib_dec/ivas_dirac_dec.c | 18 +-------- lib_rend/ivas_dirac_output_synthesis_dec.c | 45 +--------------------- 5 files changed, 5 insertions(+), 73 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 43cffea7c..2704c1f08 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -960,7 +960,6 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); - push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ @@ -1070,7 +1069,6 @@ void computeDiffuseness_fixed( q_intensity = s_min( q_intensity, q_tmp ); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" );/*/ min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 9ef094977..dc23ad8a0 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -7191,7 +7191,6 @@ void ivas_dirac_dec_get_response_fx_29( Word16 b, b1, b_2, b1_2; // Word16 Q_out = 29; - push_wmops( "ivas_dirac_dec_get_response_fx_29" ); index_azimuth = add( azimuth, 180 ) % 360; move16(); index_elevation = add( elevation, 90 ); @@ -7249,14 +7248,9 @@ void ivas_dirac_dec_get_response_fx_29( sin_az_fx[2] = L_shl( Mpy_32_32( sin_1_fx, L_sub( cos_2_fx, ONE_IN_Q28 /*1/4 q30*/ ) ), 3 ); /*q30*/ move32(); - // response_fx[0] = L_shl_sat( 1, Q_out ); // Q_out response_fx[0] = 0x20000000; move32(); - // q_diff = sub( Q_out, 29 ); - - push_wmops( "ivas_dirac_dec_get_response_fx_29_LOOPS" ); - FOR( l = 1; l <= ambisonics_order; l++ ) { Word16 a; @@ -7303,9 +7297,6 @@ void ivas_dirac_dec_get_response_fx_29( response_fx[b] = L_shl( c_fx_better, -1 ); // Q_out move32(); } - - pop_wmops(); /*push_wmops( "ivas_dirac_dec_get_response_fx_29_LOOPS" );*/ - pop_wmops(); /*push_wmops( "ivas_dirac_dec_get_response_fx_29" );*/ return; } #endif /*FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx*/ diff --git a/lib_com/options.h b/lib_com/options.h index 68914fa45..19b588da3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -//#define WMOPS /* Activate complexity and memory counters */ +/*#define WMOPS*/ /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -173,6 +173,4 @@ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ #define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ #define FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, nonbe*/ - - #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 77287dc76..95cca12a0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2231,7 +2231,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); Word16 tmp1; - push_wmops( "ivas_dirac_dec_render (IDR)" ); + push_wmops( "ivas_dirac_dec_render" ); /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2341,7 +2341,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE IF( !( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { - push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" ); Word16 outchannels; idx_lfe = 0; move16(); @@ -2410,7 +2409,6 @@ void ivas_dirac_dec_render_sf_fx( } } } - pop_wmops(); /*push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" );*/ } size = imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); @@ -2708,7 +2706,6 @@ void ivas_dirac_dec_render_sf_fx( } } - push_wmops( "(IDR) LOOP1" ); FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = add( slot_idx_start, slot_idx ); @@ -2926,8 +2923,6 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: - pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; @@ -2937,7 +2932,6 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * Compute DirAC parameters at decoder side *-----------------------------------------------------------------*/ - push_wmops( "(IDR) LOOP1 DirACparams |" ); IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); @@ -2986,11 +2980,8 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q; move16(); - push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" ); 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 ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" );/*/ } - pop_wmops(); /* push_wmops( "(IDR) LOOP1 DirACparams |" );*/ /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -3092,7 +3083,6 @@ void ivas_dirac_dec_render_sf_fx( } /*Compute PSDs*/ - push_wmops( "(IDR) LOOP1 PSDs |" ); h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); num_channels_dir = hDirACRend->num_outputs_dir; @@ -3175,7 +3165,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" ); ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, DirAC_mem.reference_power_q, p_onset_filter_fx, @@ -3193,7 +3182,6 @@ void ivas_dirac_dec_render_sf_fx( md_idx, hodirac_flag, hDirAC->hConfig->dec_param_estim ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" );/*/ } IF( hDirAC->hConfig->dec_param_estim ) @@ -3264,9 +3252,7 @@ void ivas_dirac_dec_render_sf_fx( 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 ); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs |" );*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1" );*/ minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -4092,7 +4078,7 @@ void ivas_dirac_dec_render_sf_fx( } } - pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 68ca49ad9..c0327f3af 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -710,13 +710,11 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" ); test(); IF( dec_param_estim == FALSE && hodirac_flag ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" ); v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], @@ -739,23 +737,19 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); h_dirac_output_synthesis_state->direct_power_factor_q = 30; move16(); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" );/*/ } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" ); ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_fx, &h_dirac_output_synthesis_state->direct_power_factor_q, &h_dirac_output_synthesis_state->diffuse_power_factor_q ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" );*/ } } ELSE IF( EQ_16( dec_param_estim, TRUE ) ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" ); /* compute direct responses */ ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, @@ -817,7 +811,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; move16(); } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" ); + FOR( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) { Word16 k; @@ -912,8 +906,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } 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*/ - - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" ); #ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot FOR( ; k < num_freq_bands; k++ ) { @@ -1064,9 +1056,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } #endif - - - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop B <<<<<-|" );*/ } ELSE { @@ -1142,8 +1131,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ - Word16 temp = MAX_16; /*q0*/ move16(); tmp16 = imult1616( num_freq_bands, num_channels_dir ); @@ -1160,8 +1147,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } free( Q_temp_cy_cross_dir_smooth_fx ); /*Directional gain (panning)*/ - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" ); - 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 ) ) { @@ -1243,7 +1228,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ } #endif - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" );*/ /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) @@ -1262,8 +1246,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], num_freq_bands_diff, 0 ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3 <<-|" );/*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ + return; } ELSE @@ -1282,9 +1265,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ diff_start_band = 0; move16(); @@ -3032,8 +3013,6 @@ void ivas_dirac_dec_compute_directional_responses_fx( Word16 dipole_freq_range[2]; MASA_TRANSPORT_SIGNAL_TYPE transport_signal_type; - push_wmops( "(IDR PATH3 B3.1)" ); - Q_direct_response_ls = Q31; move16(); exp_direct_response_ls = 0; @@ -3095,7 +3074,6 @@ void ivas_dirac_dec_compute_directional_responses_fx( LT_16( k, MASA_band_grouping_24[masa_band_mapping[add( codingBand, 1 )]] ) && NE_16( k, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ) ) { - push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " ); /* Panning gains have to be computed only for the first bin of the coding band in MASA, for other bins the previous values can be used */ IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { @@ -3107,15 +3085,12 @@ void ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) mvr2r_inc_fixed " );*/ } ELSE { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " ); /* HOA3 PANNING */ IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) ) { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF" ); set32_fx( direct_response_hoa_fx, ONE_IN_Q29, MAX_OUTPUT_CHANNELS ); /*q29*/ set32_fx( direct_response_dir2_fx, ONE_IN_Q29, MAX_OUTPUT_CHANNELS ); /*q29*/ @@ -3128,21 +3103,17 @@ void ivas_dirac_dec_compute_directional_responses_fx( exp_direct_response_dir2 = 0; move16(); - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse" ); IF( p_Rmat != 0 ) { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse_SPLIT_FX" ); ivas_dirac_dec_get_response_split_order_fx( azimuth[k], elevation[k], direct_response_hoa_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_hoa ); IF( hodirac_flag ) { ivas_dirac_dec_get_response_split_order_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_dir2 ); } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse_SPLIT_FX" );*/ } ELSE { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" ); #ifdef FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order ); #else @@ -3157,9 +3128,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( ivas_dirac_dec_get_response_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order, Q_direct_response_dir2 ); #endif } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse__FX" );*/ } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- getResponse" );*/ test(); test(); @@ -3167,19 +3136,16 @@ void ivas_dirac_dec_compute_directional_responses_fx( test(); IF( masa_band_mapping == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH1" ); mvr2r_inc_fixed( direct_response_hoa_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_hoa*/ IF( hodirac_flag ) { mvr2r_inc_fixed( direct_response_dir2_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*Q_direct_response_dir2*/ } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH1" );*/ } ELSE IF( ( ( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) && ( masa_band_mapping != NULL ) ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" ); /* Synthesize the first direction */ IF( GT_16( Q_direct_response_hoa, Q29 ) ) { @@ -3426,17 +3392,14 @@ void ivas_dirac_dec_compute_directional_responses_fx( } mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*q29*/ - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF -- PATH2" );*/ } ELSE { assert( 0 && "Not supported synthesis method!" ); } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING IF" );*/ } ELSE IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) /*VBAP*/ { - push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" ); /* Synthesize the first direction */ spreadCoherencePanningVbap_fx( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence_fx[md_idx][k], direct_response_ls_fx, &Q_direct_response_ls, num_channels_dir, hVBAPdata ); @@ -3688,13 +3651,11 @@ void ivas_dirac_dec_compute_directional_responses_fx( mvr2r_inc_fixed( direct_response_square_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_square_q*/ mvr2r_inc_fixed( direct_response_fx, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); /*direct_response_q*/ - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING ELSE" );*/ } ELSE { assert( 0 && "Not supported panning method!" ); } - pop_wmops(); /*push_wmops( "(IDR PATH3 B3.1) HOA3 PANNING " );*/ } } @@ -3703,8 +3664,6 @@ void ivas_dirac_dec_compute_directional_responses_fx( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = direct_response_square_q; move16(); - - pop_wmops(); return; } -- GitLab From dd7e49514ef58cc4a304e4bc29f125a5a9f1af16 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Feb 2025 16:30:18 +0100 Subject: [PATCH 026/358] Issue #867 : use 2 scale regions for reference_power vectors to improve precision. Work in progress. --- lib_com/cnst.h | 3 + lib_com/options.h | 3 + lib_dec/ivas_dirac_dec.c | 336 +++++++++++- lib_rend/ivas_dirac_output_synthesis_dec.c | 214 +++++++- lib_rend/ivas_dirac_rend.c | 581 ++++++++++++++++++++- lib_rend/ivas_prot_rend.h | 4 + lib_rend/ivas_stat_rend.h | 17 + lib_rend/lib_rend.c | 48 ++ 8 files changed, 1190 insertions(+), 16 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 26903f525..e6edc0cab 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -785,6 +785,9 @@ 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_SWITCH 6 /* CLDFB resampling - max number of CLDFB col. for switching */ diff --git a/lib_com/options.h b/lib_com/options.h index a37ccf387..b02e87542 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,4 +169,7 @@ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ #define FIX_1301_CORRECT_TD_CNST /* VA: Fix 1301, correct wrong constant in TD stereo */ +#define FIX_867_CLDFB_NRG_SCALE /* Issue 867: split cldfb energy scale into 2 regions for better precision */ +//#define FIX_867_CLDFB_NRG_SCALE_CLDFB /* Issue 867: use dynamic scale for CLDFB analysis. Almost zero improvement. */ +//#define FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK /* Issue 867: erase higher cldfb values to remove noise from MDCT */ #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7d2f7be4f..de248f3bb 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2224,7 +2224,12 @@ 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; @@ -2464,10 +2469,33 @@ 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 ) ) { + tmp1 = s_min(tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + } + FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF, 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[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], tmp1 ); + move16(); + tmp1 = 31; + move16(); + FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { + tmp1 = s_min(tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); + } + FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); 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, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), 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[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 ) ); @@ -2743,8 +2771,59 @@ void ivas_dirac_dec_render_sf_fx( { /* CLDFB Analysis*/ offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); +#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB + Word16 q_input; + Word32 sigTemp[MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + q_input = 4; + move16(); + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + q_input = s_min(q_input, L_norm_arr(&st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + hSpatParamRendCom->num_freq_bands)); + } + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + Copy_Scale_sig32(&st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + sigTemp[ch], + hSpatParamRendCom->num_freq_bands, + q_input ); + } + q_input = add(Q11, q_input); +#endif +#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK + Word16 cldfb_last_band=0; + move16(); + { + Word32 sr; + Word16 el; + FOR ( el=0; elnSCE; el++ ) { + test(); test(); + IF ( st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) { + cldfb_last_band = s_max( cldfb_last_band, st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); + sr = st_ivas->hSCE[el]->hCoreCoder[0]->output_Fs; + } + } + FOR ( el=0; elnCPE; el++ ) { + test(); test(); + IF ( st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) { + cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); + sr = st_ivas->hCPE[el]->hCoreCoder[0]->output_Fs; + } + test(); test(); + IF ( st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->isIGFActive ) { + cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->infoIGFStopFreq ); + } + } + IF ( EQ_16( cldfb_last_band, 0 ) ) { + cldfb_last_band = hSpatParamRendCom->num_freq_bands; + } ELSE { + cldfb_last_band = mult_r( div_s( shr( cldfb_last_band, 2 ), extract_l(L_shr ( sr, 3 ) ) ), hSpatParamRendCom->num_freq_bands ); + } + } +#endif FOR( ch = 0; ch < nchan_transport; ch++ ) { +#ifndef FIX_867_CLDFB_NRG_SCALE_CLDFB q_temp_cldfb = Q11; move16(); cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], @@ -2752,6 +2831,22 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); +#else + q_temp_cldfb = q_input; + move16(); + cldfbAnalysis_ts_fx_var_q( sigTemp[ch], + Cldfb_RealBuffer_fx[ch][0], + Cldfb_ImagBuffer_fx[ch][0], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); +#endif +#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK + FOR (i=cldfb_last_band; inum_freq_bands; i++) { + Cldfb_RealBuffer_fx[ch][0][i] = 0; + Cldfb_ImagBuffer_fx[ch][0][i] = 0; + move32(); move32(); + } +#endif } q_cldfb = q_temp_cldfb; move16(); @@ -2812,7 +2907,11 @@ 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, @@ -2825,7 +2924,11 @@ 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, @@ -2844,9 +2947,17 @@ 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 ); @@ -2870,9 +2981,17 @@ 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, @@ -2887,9 +3006,17 @@ 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, @@ -2912,9 +3039,17 @@ 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 ); @@ -2977,7 +3112,12 @@ 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)]), 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 ); @@ -3209,6 +3349,73 @@ void ivas_dirac_dec_render_sf_fx( IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { +#ifdef FIX_867_CLDFB_NRG_SCALE +#if 0 + IF( LT_16( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ) + { + Word32 temp; + FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + { + temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ); + reference_power_fx[i] = L_max(temp, L_min(reference_power_fx[i], 1)); + move32(); + } + DirAC_mem.reference_power_q[0] = q_reference_power_smooth[0]; + move16(); + } + ELSE + { + Word32 temp; + FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + { + temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q[0], q_reference_power_smooth[0] ) ); + reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + move32(); + } + q_reference_power_smooth[0] = DirAC_mem.reference_power_q[0]; + move16(); + } + + IF( LT_16( q_reference_power_smooth[1], DirAC_mem.reference_power_q[1] ) ) + { + Word32 temp; + FOR( i = CLDFB_NO_CHANNELS_HALF; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth[1], DirAC_mem.reference_power_q[1] ) ); + reference_power_fx[i] = L_max(temp, L_min(reference_power_fx[i], 1)); + move32(); + } + DirAC_mem.reference_power_q[1] = q_reference_power_smooth[1]; + move16(); + } + ELSE + { + Word32 temp; + FOR( i = CLDFB_NO_CHANNELS_HALF; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q[1], q_reference_power_smooth[1] ) ); + reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + move32(); + } + q_reference_power_smooth[1] = DirAC_mem.reference_power_q[1]; + move16(); + } + v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); + q_reference_power_smooth[0] = sub( q_reference_power_smooth[0], 1 ); + q_reference_power_smooth[1] = sub( q_reference_power_smooth[1], 1 ); +#else + 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, + CLDFB_NO_CHANNELS_HALF, 1 ); + q_reference_power_smooth[0] = sub(31, temp_q); + v_add_fixed_me(reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub(31, DirAC_mem.reference_power_q[1]), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(31, q_reference_power_smooth[1]), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, + sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), 1 ); + q_reference_power_smooth[1] = sub(31, temp_q); +#endif +#else IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) ) { Word32 temp; @@ -3251,6 +3458,7 @@ void ivas_dirac_dec_render_sf_fx( } 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 } } @@ -3442,6 +3650,51 @@ 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, CLDFB_NO_CHANNELS_HALF ); + scale_sig32( reference_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, exp ); // q_reference_power_smooth[0] + exp + q_reference_power_smooth[0] = add( q_reference_power_smooth[0], exp ); + IF( LT_16( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // q_reference_power_smooth[0] + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] = q_reference_power_smooth[0]; + move16(); + } + ELSE + { + Word32 temp; + FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + { + temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], q_reference_power_smooth[0] ) ); + reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + move32(); + } + q_reference_power_smooth[0] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0]; + move16(); + } + + exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ); + scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), exp ); // q_reference_power_smooth + exp + q_reference_power_smooth[1] = add( q_reference_power_smooth[1], exp ); + IF( LT_16( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // q_reference_power_smooth + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] = q_reference_power_smooth[1]; + move16(); + } + ELSE + { + Word32 temp; + FOR( i = CLDFB_NO_CHANNELS_HALF; 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[1], q_reference_power_smooth[1] ) ); + reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + move32(); + } + 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 ); @@ -3472,6 +3725,7 @@ void ivas_dirac_dec_render_sf_fx( q_reference_power_smooth = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q; move16(); } +#endif IF( hDirACRend->masa_stereo_type_detect != NULL ) { @@ -3491,6 +3745,60 @@ 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 ) ) { + exp = s_min(exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + } + FOR ( i=0; 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, CLDFB_NO_CHANNELS_HALF, exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); + move16(); + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) + { + FOR ( i=0; 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 + i, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // proto_power_smooth_q + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0]; + move16(); + } + ELSE + { + FOR ( i=0; 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, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ) ); // proto_power_smooth_prev_q + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; + move16(); + } + exp = 31; + move16(); + FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + exp = s_min(exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); + } + FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); + move16(); + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ) + { + FOR ( i=0; 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, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // proto_power_smooth_q + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1]; + move16(); + } + ELSE + { + FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // proto_power_smooth_prev_q + } + 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 ); @@ -3507,7 +3815,7 @@ void ivas_dirac_dec_render_sf_fx( 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) hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, exp ); @@ -3550,11 +3858,35 @@ 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++ ) + { + if ( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx[i] != 0 ) + { + allZero = 0; + move16(); + } + } + if (allZero) { + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = 31; + move16(); + } + if (allZero) { + 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; @@ -3567,7 +3899,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); } } - +#endif FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 0fe7cdef1..a0273292f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -307,9 +307,14 @@ 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 ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -489,8 +494,14 @@ 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; @@ -626,7 +637,11 @@ 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, @@ -1207,7 +1222,11 @@ 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, @@ -1220,9 +1239,15 @@ 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; @@ -1990,6 +2015,26 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( // Scale cy_auto_diff_smooth_fx if required IF( diff_start_band != 0 ) { +#ifdef FIX_867_CLDFB_NRG_SCALE + /* Is this necessary at all ? */ + q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**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[0] = q_com; + q_reference_power_smooth[1] = q_com; + move16(); move16(); + h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = q_com; + h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = q_com; + move16(); move16(); + + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; + move16(); +#else 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*/ @@ -2003,6 +2048,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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, @@ -2012,6 +2058,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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 ); + } /*-----------------------------------------------------------------* @@ -2138,6 +2185,12 @@ 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 @@ -2145,8 +2198,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = 0; move16(); +#if 0 tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 +#else + L_tmp = BASOP_Util_Divide3232_Scale_cadence( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ + smoothedDirectionSmoothness = L_shl_sat( L_tmp , exp ); // Q31 +#endif h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] = smoothedDirectionSmoothness; // Q31 move32(); @@ -2210,6 +2268,55 @@ 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 = MIN_16; + min_exp = MIN_16; + move16(); move16(); + Word16 q_tmp2 = Q31; + q_tmp = Q31; + move16(); move16(); + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + { + min_exp = s_max(min_exp, exp_arr[k * num_freq_bands + l]); + } + FOR( l=CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + { + min_exp2 = s_max(min_exp2, exp_arr[k * num_freq_bands + l]); + } + } + + p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; 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++; + } + FOR( l=CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + { + *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp2, 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[0] ) ); + q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); + + // Update the Q-factor + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = h_dirac_output_synthesis_state->proto_power_smooth_q[0]; + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = h_dirac_output_synthesis_state->proto_power_smooth_q[1]; + move16(); move16(); + h_dirac_output_synthesis_state->proto_power_smooth_q[0] = q_tmp; + h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; + move16(); move16(); +#else min_exp = MIN_16; move16(); q_tmp = Q31; @@ -2229,7 +2336,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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++ ) @@ -2246,6 +2352,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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; @@ -2293,6 +2400,9 @@ 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++ ) { @@ -2300,18 +2410,28 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( g1 = alpha[l]; // Q31 move32(); g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + assert(q_cy_auto_dir_smooth_local[k] == q_cy_auto_dir_smooth_prev_local[k]); *( p_cy_auto_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), Mpy_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); // (Q31, q_cy_auto_dir_smooth_prev_local) -> q_cy_auto_dir_smooth_prev_local move32(); + assert(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth == h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev); *( 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 move32(); 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) @@ -2395,10 +2515,16 @@ 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(); *( p_gains_dir ) = L_shl_sat( *( p_gains_dir ), sub( h_dirac_output_synthesis_state->gains_dir_prev_q, sub( Q31, exp ) ) ); // gains_dir_prev_q @@ -2446,9 +2572,15 @@ 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*/ @@ -3913,8 +4045,13 @@ 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[0] ) ); + 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 ) @@ -3922,12 +4059,22 @@ 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, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ + scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, 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, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ + scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, 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 */ } @@ -3991,17 +4138,34 @@ static void computeTargetPSDs_direct_subframe_fx( } } q_tmp = W_norm( W_max ); +#ifdef FIX_867_CLDFB_NRG_SCALE + FOR( i = 0; i < 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(); + } +#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 ); +#endif + q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp ); move16(); 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 } - *q_cy_cross_dir_smooth = *q_reference_power; + *q_cy_cross_dir_smooth = q_reference_power[0]; move16(); return; @@ -4028,7 +4192,11 @@ 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 ) @@ -4036,7 +4204,12 @@ 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 */ } @@ -4066,6 +4239,9 @@ static void computeTargetPSDs_diffuse_subframe_fx( /* 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 + Scale_sig32(diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max(0, sub(num_freq_bands, CLDFB_NO_CHANNELS_HALF)), sub(q_reference_power[0], q_reference_power[1])); +#endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { @@ -4099,14 +4275,23 @@ 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; @@ -4117,7 +4302,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( 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 ) { @@ -4133,6 +4318,22 @@ 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 + } + IF( NE_16( q_common, q_reference_power_min_one[1] ) ) + { + scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max(0, sub( num_decorr_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_common, q_reference_power_min_one[1] ) ); // 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) +#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 @@ -4143,6 +4344,7 @@ 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) +#endif } /* Q adjustment */ diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index b563d4399..19a67dd3d 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -787,10 +787,19 @@ 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(); move16(); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = Q31; + 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(); @@ -948,10 +957,19 @@ 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(); move16(); + hDirAC_mem->reference_power_smooth_q[0] = Q31; + 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 ) @@ -1478,8 +1496,14 @@ 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++ ) @@ -1514,8 +1538,14 @@ 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*/ @@ -1577,7 +1607,11 @@ 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; @@ -1600,17 +1634,48 @@ 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(); + + IF( LT_16( reference_power_q[qidx], proto_power_smooth_q[qidx] ) ) + { + proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( proto_power_smooth_q[qidx], reference_power_q[qidx] ) ), reference_power_fx[l] ); // reference_power_q + move32(); + proto_power_smooth_fx_q[qidx] = reference_power_q[qidx]; + move16(); + } + ELSE + { + proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( reference_power_fx[l], sub( reference_power_q[qidx], proto_power_smooth_q[qidx] ) ) ); // proto_power_smooth_q + move32(); + 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(); @@ -1628,7 +1693,7 @@ void protoSignalComputation1_fx( 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 move32(); @@ -1649,8 +1714,14 @@ 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; } @@ -1701,6 +1772,7 @@ void protoSignalComputation2_fx( Word64 W_tmp1, W_tmp2; Word64 reference_power_64fx[CLDFB_NO_CHANNELS_MAX]; Word16 q_reference_power_64fx; + /* Calculate maximum possible shift for the buffers RealBuffer_fx and ImagBuffer_fx */ min_q_shift = Q31; move16(); @@ -1733,6 +1805,44 @@ void protoSignalComputation2_fx( temp_q_shift = sub( temp_q_shift, 2 ); // guard bits /* Upscaling of the buffer proto_power_smooth_fx */ +#ifdef FIX_867_CLDFB_NRG_SCALE + IF( isloudspeaker ) + { + q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + } + ELSE + { + q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + } + q_proto_power_smooth[0] = add( q_proto_power_smooth[0], sub( q_shift, 1 ) ); + move16(); + IF( isloudspeaker ) + { + q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + } + ELSE + { + q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + } + 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 ) ); @@ -1745,7 +1855,7 @@ void protoSignalComputation2_fx( } *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 @@ -1775,14 +1885,27 @@ 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 + Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); + IF( LT_16( q_temp, 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 ) ), 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, 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(); } @@ -1793,14 +1916,26 @@ 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, 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 ) ), 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, 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(); } @@ -1810,14 +1945,26 @@ 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, 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 ) ), 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, 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(); } @@ -1995,6 +2142,9 @@ void protoSignalComputation2_fx( } /* Compute protos (and their power) for direct sound rendering */ +#ifdef FIX_867_CLDFB_NRG_SCALE + Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); +#endif /* W prototype */ IF( stereo_type_detect->interpolator > 0 ) @@ -2005,14 +2155,26 @@ 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, 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 ) ), 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, 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(); } @@ -2027,14 +2189,26 @@ 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, 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 ) ), 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, 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(); } @@ -2051,14 +2225,26 @@ 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, 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 ) ), 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, 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(); } @@ -2070,14 +2256,26 @@ 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, 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 ) ), 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, 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(); } @@ -2090,14 +2288,26 @@ 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, 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 ) ), 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, 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(); } @@ -2133,14 +2343,26 @@ 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, 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 ) ), 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, 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(); } } @@ -2163,14 +2385,26 @@ 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, 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 ) ), 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, 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(); } } @@ -2192,14 +2426,26 @@ 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, 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 ) ), 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, 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(); } } @@ -2382,14 +2628,27 @@ 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 + Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); + IF( LT_16( q_temp, 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 ) ), 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, 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(); } @@ -2404,14 +2663,26 @@ 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, 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 ) ), 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, 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(); } @@ -2431,6 +2702,40 @@ void protoSignalComputation2_fx( } } q_reference_power_64fx = shl( add( q_cldfb, min_q_shift ), 1 ); +#ifdef FIX_867_CLDFB_NRG_SCALE + Word16 norm_shift = 63; + move16(); + FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + { + IF( reference_power_64fx[l] ) + { + norm_shift = s_min( norm_shift, W_norm( reference_power_64fx[l] ) ); + } + } + FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; 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[0] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); + move16(); + norm_shift = 63; + move16(); + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + { + IF( reference_power_64fx[l] ) + { + norm_shift = s_min( norm_shift, W_norm( reference_power_64fx[l] ) ); + } + } + FOR( l = CLDFB_NO_CHANNELS_HALF; 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[1] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); + move16(); +#else Word16 norm_shift = 63; move16(); FOR( l = 0; l < num_freq_bands; l++ ) @@ -2447,13 +2752,19 @@ void protoSignalComputation2_fx( } *q_reference_power = sub( add( q_reference_power_64fx, norm_shift ), 32 ); move16(); - +#endif *q_proto_frame_f = add( q_cldfb, min_q_shift ); move16(); *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift ); move16(); +#ifdef FIX_867_CLDFB_NRG_SCALE + q_proto_power_smooth[0] = s_min( q_proto_power_smooth[0], q_temp ); + q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp ); + move16(); move16(); +#else *q_proto_power_smooth = s_min( *q_proto_power_smooth, q_temp ); move16(); +#endif return; } @@ -3681,7 +3992,11 @@ 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 ); @@ -3694,12 +4009,53 @@ 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] ) ) + { + Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + } + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; + move16(); + } + IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + } + DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 + 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 @@ -3712,6 +4068,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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 ); @@ -3727,9 +4084,15 @@ 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, @@ -3737,6 +4100,43 @@ 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] ) ) + { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + } + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; + move16(); + } + IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + } + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[1]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, 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 + 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 @@ -3749,6 +4149,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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 ); @@ -3761,16 +4162,57 @@ 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 ); 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] ) ) + { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + } + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; + move16(); + } + IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + } + DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, 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 + 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 @@ -3783,7 +4225,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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 ); @@ -3902,10 +4344,19 @@ 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(); move16(); + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; + 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( reference_power_fix, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 0 ); // DirAC_mem.reference_power_smooth_q } } @@ -4016,10 +4467,19 @@ 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 @@ -4049,14 +4509,52 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->masa_stereo_type_detect->q_subtract_power_y = s_min( hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); move16(); } +#ifdef FIX_867_CLDFB_NRG_SCALE + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + 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 ) + IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*4, 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 ) + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_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(); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) + IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*5, 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 ) + } + 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(); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*2, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*3, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*4, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // 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[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(); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) + IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*4, 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 ) + } + 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 hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, proto_power_diff_smooth_prev_temp_q ); @@ -4077,7 +4575,30 @@ static void ivas_masa_ext_dirac_render_sf_fx( Scale_sig32( diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, 1 ); /*Buffer rescaling*/ - +#ifdef FIX_867_CLDFB_NRG_SCALE + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, 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, 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 ) + Scale_sig32( DirAC_mem.reference_power_fx, 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_mult( hSpatParamRendCom->num_freq_bands, 1), 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 ) + IF ( GT_16( DirAC_mem.reference_power_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( DirAC_mem.reference_power_fx + i_mult( hSpatParamRendCom->num_freq_bands, 2), 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_mult( hSpatParamRendCom->num_freq_bands, 3), 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_mult( hSpatParamRendCom->num_freq_bands, 4), 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_mult( hSpatParamRendCom->num_freq_bands, 2), 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 ) + Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3), 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 ) + Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4), 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] ); + 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[1], DirAC_mem.reference_power_q[1] ); + move16(); + DirAC_mem.reference_power_q[0] = 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[1] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ); + move16(); + DirAC_mem.reference_power_smooth_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ); + 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 ) @@ -4087,7 +4608,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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, hSpatParamRendCom, @@ -4095,12 +4616,55 @@ 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(); + IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) + { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + } + DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; + move16(); + } + IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 + IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + } + DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; + move16(); + } + ELSE + { + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 + 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 ) ) @@ -4115,6 +4679,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; move16(); } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index b642e05d7..d329b8c85 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -632,7 +632,11 @@ void ivas_dirac_dec_output_synthesis_close( ); 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 44207c79a..b2f5ae3eb 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -228,8 +228,13 @@ 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 */ @@ -277,7 +282,11 @@ 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 */ @@ -295,10 +304,18 @@ 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.c b/lib_rend/lib_rend.c index a1c551405..a24330988 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8309,8 +8309,14 @@ 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++ ) { @@ -8439,14 +8445,56 @@ static void intermidiate_ext_dirac_render( IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx ) { +#ifdef FIX_867_CLDFB_NRG_SCALE +#if 0 + /* Possible improvement: normalize both scale regions individually. */ + 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[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); + 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(); move16(); +#else + /* Possible improvement: normalize both scale regions individually. */ + 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) ) { + tmp = s_min(tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF ) ); + } + 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) ) { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); + move16(); + 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) ) { + tmp = s_min(tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + } + 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) ) { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ + } + 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(); +#endif +#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 + /* Possible improvement: normalize both scale regions individually. */ + 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[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); + 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 } tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); -- GitLab From 34be0cabef44c7dc10caf656d8dbf8f48377cef4 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Feb 2025 16:32:49 +0100 Subject: [PATCH 027/358] Issue #867 : use 2 scale regions for reference_power vectors to improve precision. Work in progress. Format. --- lib_dec/ivas_dirac_dec.c | 143 +++++++++++-------- lib_rend/ivas_dirac_output_synthesis_dec.c | 89 ++++++------ lib_rend/ivas_dirac_rend.c | 151 ++++++++++++--------- lib_rend/lib_rend.c | 19 ++- 4 files changed, 232 insertions(+), 170 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index de248f3bb..c490c546a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2472,21 +2472,25 @@ void ivas_dirac_dec_render_sf_fx( #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 ) ) { - tmp1 = s_min(tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + tmp1 = s_min( tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF ) ); } - FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { + FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF, 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[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], tmp1 ); move16(); tmp1 = 31; move16(); - FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - tmp1 = s_min(tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); + FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + tmp1 = s_min( tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); } - FOR (i=0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); 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, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q tmp1) + FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); 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, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 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[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], tmp1 ); move16(); @@ -2778,46 +2782,57 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( ch = 0; ch < nchan_transport; ch++ ) { - q_input = s_min(q_input, L_norm_arr(&st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - hSpatParamRendCom->num_freq_bands)); + q_input = s_min( q_input, L_norm_arr( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + hSpatParamRendCom->num_freq_bands ) ); } FOR( ch = 0; ch < nchan_transport; ch++ ) { - Copy_Scale_sig32(&st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - sigTemp[ch], - hSpatParamRendCom->num_freq_bands, - q_input ); + Copy_Scale_sig32( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + sigTemp[ch], + hSpatParamRendCom->num_freq_bands, + q_input ); } - q_input = add(Q11, q_input); + q_input = add( Q11, q_input ); #endif #ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK - Word16 cldfb_last_band=0; + Word16 cldfb_last_band = 0; move16(); { Word32 sr; Word16 el; - FOR ( el=0; elnSCE; el++ ) { - test(); test(); - IF ( st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) { + FOR( el = 0; el < st_ivas->nSCE; el++ ) + { + test(); + test(); + IF( st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) + { cldfb_last_band = s_max( cldfb_last_band, st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); sr = st_ivas->hSCE[el]->hCoreCoder[0]->output_Fs; } } - FOR ( el=0; elnCPE; el++ ) { - test(); test(); - IF ( st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) { + FOR( el = 0; el < st_ivas->nCPE; el++ ) + { + test(); + test(); + IF( st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) + { cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); sr = st_ivas->hCPE[el]->hCoreCoder[0]->output_Fs; } - test(); test(); - IF ( st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->isIGFActive ) { + test(); + test(); + IF( st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->isIGFActive ) + { cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->infoIGFStopFreq ); } } - IF ( EQ_16( cldfb_last_band, 0 ) ) { + IF( EQ_16( cldfb_last_band, 0 ) ) + { cldfb_last_band = hSpatParamRendCom->num_freq_bands; - } ELSE { - cldfb_last_band = mult_r( div_s( shr( cldfb_last_band, 2 ), extract_l(L_shr ( sr, 3 ) ) ), hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + cldfb_last_band = mult_r( div_s( shr( cldfb_last_band, 2 ), extract_l( L_shr( sr, 3 ) ) ), hSpatParamRendCom->num_freq_bands ); } } #endif @@ -2841,10 +2856,12 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); #endif #ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK - FOR (i=cldfb_last_band; inum_freq_bands; i++) { + FOR( i = cldfb_last_band; i < hSpatParamRendCom->num_freq_bands; i++ ) + { Cldfb_RealBuffer_fx[ch][0][i] = 0; Cldfb_ImagBuffer_fx[ch][0][i] = 0; - move32(); move32(); + move32(); + move32(); } #endif } @@ -3113,7 +3130,7 @@ void ivas_dirac_dec_render_sf_fx( 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)]), sub(num_freq_bands, CLDFB_NO_CHANNELS_HALF), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_q[1])); + Scale_sig32( &( hDirACRend->buffer_energy_fx[add( i_mult( sub( index, 1 ), num_freq_bands ), CLDFB_NO_CHANNELS_HALF )] ), 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; @@ -3404,16 +3421,16 @@ void ivas_dirac_dec_render_sf_fx( q_reference_power_smooth[0] = sub( q_reference_power_smooth[0], 1 ); q_reference_power_smooth[1] = sub( q_reference_power_smooth[1], 1 ); #else - 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, - CLDFB_NO_CHANNELS_HALF, 1 ); - q_reference_power_smooth[0] = sub(31, temp_q); - v_add_fixed_me(reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub(31, DirAC_mem.reference_power_q[1]), - reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(31, q_reference_power_smooth[1]), - reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, - sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), 1 ); - q_reference_power_smooth[1] = sub(31, temp_q); + 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, + CLDFB_NO_CHANNELS_HALF, 1 ); + q_reference_power_smooth[0] = sub( 31, temp_q ); + v_add_fixed_me( reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, DirAC_mem.reference_power_q[1] ), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, q_reference_power_smooth[1] ), + reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, + sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 1 ); + q_reference_power_smooth[1] = sub( 31, temp_q ); #endif #else IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) ) @@ -3666,15 +3683,15 @@ void ivas_dirac_dec_render_sf_fx( FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) { temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], q_reference_power_smooth[0] ) ); - reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + reference_power_smooth_fx[i] = L_max( temp, L_min( reference_power_smooth_fx[i], 1 ) ); move32(); } q_reference_power_smooth[0] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0]; move16(); } - exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ); - scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), exp ); // q_reference_power_smooth + exp + exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // q_reference_power_smooth + exp q_reference_power_smooth[1] = add( q_reference_power_smooth[1], exp ); IF( LT_16( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ) { @@ -3688,7 +3705,7 @@ void ivas_dirac_dec_render_sf_fx( FOR( i = CLDFB_NO_CHANNELS_HALF; 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[1], q_reference_power_smooth[1] ) ); - reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); + reference_power_smooth_fx[i] = L_max( temp, L_min( reference_power_smooth_fx[i], 1 ) ); move32(); } q_reference_power_smooth[1] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1]; @@ -3748,17 +3765,20 @@ 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 ) ) { - exp = s_min(exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, CLDFB_NO_CHANNELS_HALF ) ); } - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + FOR( i = 0; 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, CLDFB_NO_CHANNELS_HALF, exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); move16(); IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) { - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + FOR( i = 0; 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 + i, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // proto_power_smooth_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0]; @@ -3766,7 +3786,8 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { + FOR( i = 0; 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, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ) ); // proto_power_smooth_prev_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; @@ -3774,26 +3795,30 @@ void ivas_dirac_dec_render_sf_fx( } exp = 31; move16(); - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { - exp = s_min(exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); } - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); move16(); IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ) { - FOR ( i=0; 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, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // proto_power_smooth_q + FOR( i = 0; 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, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // proto_power_smooth_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1]; move16(); } ELSE { - FOR ( i=0; proto_power_smooth_len > i; i = add(i, hSpatParamRendCom->num_freq_bands ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub(hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // proto_power_smooth_prev_q + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // proto_power_smooth_prev_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1]; move16(); @@ -3878,11 +3903,13 @@ void ivas_dirac_dec_render_sf_fx( move16(); } } - if (allZero) { + if ( allZero ) + { hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = 31; move16(); } - if (allZero) { + if ( allZero ) + { hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = 31; move16(); } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index a0273292f..8a2dd7bec 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -310,7 +310,8 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( #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(); + move16(); + move16(); #else dirac_output_synthesis_state->reference_power_smooth_prev_q = Q31; move16(); @@ -497,7 +498,8 @@ void ivas_dirac_dec_output_synthesis_init_fx( #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(); + move16(); + move16(); #else h_dirac_output_synthesis_state->proto_power_smooth_prev_q = Q31; move16(); @@ -636,13 +638,13 @@ 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)*/ #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 Word32 *onset, /* i : onset filter Q31*/ const Word16 *azimuth, const Word16 *elevation, const Word32 *diffuseness, /* Q(q_diffuseness)*/ @@ -2018,19 +2020,21 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**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[0] = q_com; q_reference_power_smooth[1] = q_com; - move16(); move16(); + move16(); + move16(); h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = q_com; h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = q_com; - move16(); move16(); + move16(); + move16(); h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); @@ -2058,7 +2062,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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 ); - } /*-----------------------------------------------------------------* @@ -2186,10 +2189,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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]); + 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); + assert( *q_reference_power_smooth == h_dirac_output_synthesis_state->reference_power_smooth_prev_q ); #endif weightedDirectionSmoothness = L_add( Mpy_32_32( currWeight, instDirectionSmoothness ), @@ -2203,7 +2206,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 #else L_tmp = BASOP_Util_Divide3232_Scale_cadence( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ - smoothedDirectionSmoothness = L_shl_sat( L_tmp , exp ); // Q31 + smoothedDirectionSmoothness = L_shl_sat( L_tmp, exp ); // Q31 #endif h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] = smoothedDirectionSmoothness; // Q31 @@ -2272,20 +2275,22 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE Word16 min_exp2 = MIN_16; min_exp = MIN_16; - move16(); move16(); + move16(); + move16(); Word16 q_tmp2 = Q31; q_tmp = Q31; - move16(); move16(); + move16(); + move16(); FOR( k = 0; k < num_protos_dir; k++ ) { FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) { - min_exp = s_max(min_exp, exp_arr[k * num_freq_bands + l]); + min_exp = s_max( min_exp, exp_arr[k * num_freq_bands + l] ); } - FOR( l=CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) { - min_exp2 = s_max(min_exp2, exp_arr[k * num_freq_bands + l]); + min_exp2 = s_max( min_exp2, exp_arr[k * num_freq_bands + l] ); } } @@ -2299,7 +2304,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move32(); p_power_smooth++; } - FOR( l=CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) { *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp2, exp_arr[k * num_freq_bands + l] ) ); /*(31-(exp-(31-q_proto_power_smooth)))->(31-(min_exp-(31-q_proto_power_smooth)))*/ move32(); @@ -2312,10 +2317,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( // Update the Q-factor h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = h_dirac_output_synthesis_state->proto_power_smooth_q[0]; h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = h_dirac_output_synthesis_state->proto_power_smooth_q[1]; - move16(); move16(); + move16(); + move16(); h_dirac_output_synthesis_state->proto_power_smooth_q[0] = q_tmp; h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; - move16(); move16(); + move16(); + move16(); #else min_exp = MIN_16; move16(); @@ -2410,11 +2417,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( g1 = alpha[l]; // Q31 move32(); g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 - assert(q_cy_auto_dir_smooth_local[k] == q_cy_auto_dir_smooth_prev_local[k]); + assert( q_cy_auto_dir_smooth_local[k] == q_cy_auto_dir_smooth_prev_local[k] ); *( p_cy_auto_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), Mpy_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); // (Q31, q_cy_auto_dir_smooth_prev_local) -> q_cy_auto_dir_smooth_prev_local move32(); - assert(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth == h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev); + assert( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth == h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev ); *( 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 move32(); @@ -2422,7 +2429,7 @@ 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))); + 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 ) ); @@ -2516,7 +2523,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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))); + 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 ) ); @@ -4058,22 +4065,22 @@ 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) */ #ifdef FIX_867_CLDFB_NRG_SCALE - scale_sig32( aux_buffer_res, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ + scale_sig32( aux_buffer_res, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, 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) */ + 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) */ + 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, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ + scale_sig32( aux_buffer_res, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, 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) */ + 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 */ @@ -4144,7 +4151,7 @@ static void computeTargetPSDs_direct_subframe_fx( 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])); + 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*/ @@ -4161,7 +4168,7 @@ static void computeTargetPSDs_direct_subframe_fx( move16(); 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])); + 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 } @@ -4203,12 +4210,12 @@ 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) */ #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) */ + 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) */ + 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 */ @@ -4240,7 +4247,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( 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 - Scale_sig32(diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max(0, sub(num_freq_bands, CLDFB_NO_CHANNELS_HALF)), sub(q_reference_power[0], q_reference_power[1])); + Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); #endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -4290,7 +4297,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( 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] ) ); + 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 ) ) { @@ -4321,11 +4328,11 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( #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 + 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 } IF( NE_16( q_common, q_reference_power_min_one[1] ) ) { - scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max(0, sub( num_decorr_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_common, q_reference_power_min_one[1] ) ); // q_common + scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_decorr_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_common, q_reference_power_min_one[1] ) ); // q_common } IF( NE_16( q_common, *q_cy_auto_diff_smooth ) ) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 19a67dd3d..c4c1a2330 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -790,10 +790,12 @@ ivas_error ivas_dirac_alloc_mem_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(); move16(); + move16(); + move16(); hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = Q31; - move16(); move16(); + move16(); + move16(); #else hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = Q31; move16(); @@ -960,10 +962,12 @@ ivas_error ivas_dirac_alloc_mem_fx( #ifdef FIX_867_CLDFB_NRG_SCALE hDirAC_mem->reference_power_q[0] = Q31; hDirAC_mem->reference_power_q[1] = Q31; - move16(); move16(); + move16(); + move16(); hDirAC_mem->reference_power_smooth_q[0] = Q31; hDirAC_mem->reference_power_smooth_q[1] = Q31; - move16(); move16(); + move16(); + move16(); #else hDirAC_mem->reference_power_q = Q31; move16(); @@ -1497,7 +1501,7 @@ 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))); + 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 @@ -1541,7 +1545,8 @@ void protoSignalComputation_shd_fx( #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(); + move16(); + move16(); #else *reference_power_q = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); move16(); @@ -1639,7 +1644,8 @@ void protoSignalComputation1_fx( 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(); + move16(); + move16(); #else *proto_power_smooth_q = add( *proto_power_smooth_q, q_shift ); proto_power_smooth_fx_q = *proto_power_smooth_q; @@ -1649,7 +1655,7 @@ void protoSignalComputation1_fx( 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))); + 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 @@ -1717,7 +1723,8 @@ void protoSignalComputation1_fx( #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(); + move16(); + move16(); #else *proto_power_smooth_q = proto_power_smooth_fx_q; move16(); @@ -1811,15 +1818,15 @@ void protoSignalComputation2_fx( q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } q_proto_power_smooth[0] = add( q_proto_power_smooth[0], sub( q_shift, 1 ) ); @@ -1829,16 +1836,16 @@ void protoSignalComputation2_fx( q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } q_proto_power_smooth[1] = add( q_proto_power_smooth[1], sub( q_shift, 1 ) ); move16(); @@ -1886,7 +1893,7 @@ 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 - Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); + Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) #else IF( LT_16( q_temp, *q_proto_power_smooth ) ) @@ -2143,7 +2150,7 @@ void protoSignalComputation2_fx( /* Compute protos (and their power) for direct sound rendering */ #ifdef FIX_867_CLDFB_NRG_SCALE - Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); + Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); #endif /* W prototype */ @@ -2629,7 +2636,7 @@ void protoSignalComputation2_fx( move64(); #ifdef FIX_867_CLDFB_NRG_SCALE - Word16 qidx = s_min(1, s_max(0, sub(l, CLDFB_NO_CHANNELS_HALF-1))); + Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) #else IF( LT_16( q_temp, *q_proto_power_smooth ) ) @@ -2760,7 +2767,8 @@ void protoSignalComputation2_fx( #ifdef FIX_867_CLDFB_NRG_SCALE q_proto_power_smooth[0] = s_min( q_proto_power_smooth[0], q_temp ); q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp ); - move16(); move16(); + move16(); + move16(); #else *q_proto_power_smooth = s_min( *q_proto_power_smooth, q_temp ); move16(); @@ -4024,7 +4032,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q @@ -4041,7 +4050,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 @@ -4051,7 +4061,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( } ELSE { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 + Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } @@ -4104,7 +4114,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q @@ -4121,7 +4132,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 @@ -4131,7 +4143,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( } ELSE { - Scale_sig32( reference_power_fix, 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 + Scale_sig32( reference_power_fix, 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } @@ -4181,7 +4193,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q @@ -4198,7 +4211,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 @@ -4347,10 +4361,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( #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(); move16(); + move16(); + move16(); DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; - move16(); move16(); + move16(); + move16(); #else DirAC_mem.reference_power_q = sub( DirAC_mem.reference_power_q, 1 ); move16(); @@ -4510,40 +4526,44 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); } #ifdef FIX_867_CLDFB_NRG_SCALE - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, 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 ) Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + 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 ) - IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands*4, 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 ) + IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands * 2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands * 3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands * 4, 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 ) } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, 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 ) Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) - IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*5, 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 ) + IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 5, 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 ) } 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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*2, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*3, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands*4, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands * 2, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands * 3, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands * 4, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // 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[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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) - IF ( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands*4, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) + IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 2, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 3, 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 ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 4, 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 ) } 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(); @@ -4576,18 +4596,19 @@ 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, 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, 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, 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 ) - Scale_sig32( DirAC_mem.reference_power_fx, 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_mult( hSpatParamRendCom->num_freq_bands, 1), 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 ) - IF ( GT_16( DirAC_mem.reference_power_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) { - Scale_sig32( DirAC_mem.reference_power_fx + i_mult( hSpatParamRendCom->num_freq_bands, 2), 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_mult( hSpatParamRendCom->num_freq_bands, 3), 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_mult( hSpatParamRendCom->num_freq_bands, 4), 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, 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_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 ) + IF( GT_16( DirAC_mem.reference_power_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { + Scale_sig32( DirAC_mem.reference_power_fx + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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_mult( hSpatParamRendCom->num_freq_bands, 2), 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 ) - Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3), 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 ) - Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4), 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 ) + Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 ) + Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 ) + Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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] ); 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[1], DirAC_mem.reference_power_q[1] ); @@ -4633,7 +4654,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q @@ -4650,7 +4672,8 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF ( GT_16( DirAC_mem.reference_power_len, shr(hSpatParamRendCom->num_freq_bands, 1 ) ) ) { + IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + { Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index a24330988..16739283b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8312,7 +8312,8 @@ static void intermidiate_ext_dirac_render( #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(); + move16(); + move16(); #else DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q = Q31; move16(); @@ -8457,20 +8458,24 @@ static void intermidiate_ext_dirac_render( /* Possible improvement: normalize both scale regions individually. */ 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) ) { - tmp = s_min(tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF ) ); + 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 ) ) + { + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF ) ); } - 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) ) { + 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 ) ) + { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); move16(); 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) ) { - tmp = s_min(tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + 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 ) ) + { + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); } - 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) ) { + 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 ) ) + { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], tmp ); -- GitLab From 959cf7ada88ceaaef4cfaf1c949c69449d007435 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Feb 2025 16:35:37 +0100 Subject: [PATCH 028/358] Issue #867 : use 2 scale regions for reference_power vectors to improve precision. Work in progress. Format. Fix warning. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 8a2dd7bec..a6d11fac4 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1952,7 +1952,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Word16 alphaMaxBinFast; Word32 L_tmp; Word16 exp_arr[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; +#if 0 Word16 exp = 0, exp1, tmp, q_com, q_tmp, min_exp; +#else + Word16 exp = 0, exp1, q_com, q_tmp, min_exp; +#endif Word32 tmp32; move16(); -- GitLab From 0ca0d09fc34508ec2abf1b6deb0992d2926480c2 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 3 Mar 2025 11:05:46 +0100 Subject: [PATCH 029/358] Use INV_LEVEL_SCALING instead --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbab6a130..842611691 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -343,7 +343,8 @@ stages: - fi - *build-and-create-reference-outputs - - comp_args="--mld --ssnr --odg --input_scaling $LEVEL_SCALING" + - INV_LEVEL_SCALING=$(awk "BEGIN {print 1.0 / $LEVEL_SCALING}") + - comp_args="--mld --ssnr --odg --scalefac $INV_LEVEL_SCALING" - if [ "$ENCODER_TEST" = "true" ]; then - comp_args="${comp_args} --enc_stats" - fi @@ -444,7 +445,8 @@ stages: - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - allow_regressions_flag=$(grep -c --ignore-case "\[allow[ -]*regression\]" tmp.txt) || true - - comp_args="--mld --ssnr --odg --input_scaling $LEVEL_SCALING" + - INV_LEVEL_SCALING=$(awk "BEGIN {print 1.0 / $LEVEL_SCALING}") + - comp_args="--mld --ssnr --odg --scalefac $INV_LEVEL_SCALING" ### run branch first # this per default builds the branch and the reference and creates the reference outputs -- GitLab From 281cfe4739a359ac07571cfebb9c9a830db58999 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 14:29:35 +0100 Subject: [PATCH 030/358] Fix cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF --- lib_dec/ivas_dirac_dec.c | 22 ++++++------- lib_rend/ivas_dirac_output_synthesis_dec.c | 16 ++++----- lib_rend/ivas_dirac_rend.c | 38 +++++++++++----------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index c490c546a..559edcca6 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3130,7 +3130,7 @@ void ivas_dirac_dec_render_sf_fx( 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 )] ), sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_q[1] ) ); + 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; @@ -3371,7 +3371,7 @@ void ivas_dirac_dec_render_sf_fx( IF( LT_16( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ) { Word32 temp; - FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + FOR( i = 0; i < s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) { temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ); reference_power_fx[i] = L_max(temp, L_min(reference_power_fx[i], 1)); @@ -3383,7 +3383,7 @@ void ivas_dirac_dec_render_sf_fx( ELSE { Word32 temp; - FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + FOR( i = 0; i < s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) { temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q[0], q_reference_power_smooth[0] ) ); reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); @@ -3680,7 +3680,7 @@ void ivas_dirac_dec_render_sf_fx( ELSE { Word32 temp; - FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + FOR( i = 0; i < s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) { temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], q_reference_power_smooth[0] ) ); reference_power_smooth_fx[i] = L_max( temp, L_min( reference_power_smooth_fx[i], 1 ) ); @@ -3767,11 +3767,11 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); } FOR( i = 0; 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, CLDFB_NO_CHANNELS_HALF, exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); move16(); @@ -3779,7 +3779,7 @@ void ivas_dirac_dec_render_sf_fx( { FOR( i = 0; 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 + i, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // proto_power_smooth_q + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // proto_power_smooth_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0]; move16(); @@ -3788,7 +3788,7 @@ void ivas_dirac_dec_render_sf_fx( { FOR( i = 0; 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, CLDFB_NO_CHANNELS_HALF, sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ) ); // proto_power_smooth_prev_q + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ) ); // proto_power_smooth_prev_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; move16(); @@ -3797,7 +3797,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + exp = s_min( exp, getScaleFactor32( 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 ) ) ) ); } FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { @@ -3809,7 +3809,7 @@ void ivas_dirac_dec_render_sf_fx( { FOR( i = 0; 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, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // proto_power_smooth_q + 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( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ); // proto_power_smooth_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1]; move16(); @@ -3818,7 +3818,7 @@ void ivas_dirac_dec_render_sf_fx( { FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // proto_power_smooth_prev_q + 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( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] ) ); // proto_power_smooth_prev_q } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1]; move16(); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index b1a24fdc3..74ec5f655 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2029,9 +2029,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**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*/ @@ -2281,7 +2281,7 @@ 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 = MIN_16; + Word16 min_exp2 = -64; min_exp = MIN_16; move16(); move16(); @@ -2292,7 +2292,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( FOR( k = 0; k < num_protos_dir; k++ ) { - FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) { min_exp = s_max( min_exp, exp_arr[k * num_freq_bands + l] ); } @@ -2306,7 +2306,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( FOR( k = 0; k < num_protos_dir; k++ ) { - FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); 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(); @@ -4076,7 +4076,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ - scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common1_q, q_reference_power[1] ) ); /* 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 @@ -4086,7 +4086,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ - scale_sig32( aux_buffer_res + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( common2_q, q_reference_power[1] ) ); /* 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 @@ -4154,7 +4154,7 @@ static void computeTargetPSDs_direct_subframe_fx( } q_tmp = W_norm( W_max ); #ifdef FIX_867_CLDFB_NRG_SCALE - FOR( i = 0; i < CLDFB_NO_CHANNELS_HALF; i++ ) + 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(); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index c4c1a2330..9ebcb3132 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1818,34 +1818,34 @@ void protoSignalComputation2_fx( q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { - q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - scale_sig32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + q_shift = getScaleFactor32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } q_proto_power_smooth[0] = add( q_proto_power_smooth[0], sub( q_shift, 1 ) ); move16(); IF( isloudspeaker ) { - q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { - q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 - scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 + scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } q_proto_power_smooth[1] = add( q_proto_power_smooth[1], sub( q_shift, 1 ) ); move16(); @@ -2712,14 +2712,14 @@ void protoSignalComputation2_fx( #ifdef FIX_867_CLDFB_NRG_SCALE Word16 norm_shift = 63; move16(); - FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) { IF( reference_power_64fx[l] ) { norm_shift = s_min( norm_shift, W_norm( reference_power_64fx[l] ) ); } } - FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) + FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) { reference_power_fx[l] = W_extract_h( W_shl( reference_power_64fx[l], norm_shift ) ); // q_reference_power_64fx+norm_shift-32 move32(); -- GitLab From e1b06ae2edc7bd01fba7d6dd852c40d62e34f502 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 14:32:22 +0100 Subject: [PATCH 031/358] Fix cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. format. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 74ec5f655..0a89b81ea 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2028,9 +2028,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**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 ), @@ -4075,7 +4075,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ + scale_sig32( aux_buffer_res, 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) */ @@ -4085,7 +4085,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ + scale_sig32( aux_buffer_res, 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) */ -- GitLab From c8d9f7b458d6916666d980eb32fe224f2e5daa31 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 3 Mar 2025 14:55:44 +0100 Subject: [PATCH 032/358] Restore basop-ci-branch --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 997429468..15c944725 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ variables: MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_target" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' - BASOP_CI_BRANCH_PC_REPO: "ci/basop-ci-branch-input-scaling" + BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" TESTCASE_TIMEOUT_STV: 900 TESTCASE_TIMEOUT_LTV: 2400 -- GitLab From de66837188c12936e978e84b4df7344ec71cdd36 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 15:14:58 +0100 Subject: [PATCH 033/358] Fix more cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. --- lib_dec/ivas_dirac_dec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 559edcca6..ed721f142 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2474,11 +2474,11 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - tmp1 = s_min( tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF ) ); + tmp1 = s_min( tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); } FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, CLDFB_NO_CHANNELS_HALF, tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q tmp1) + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 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[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], tmp1 ); move16(); @@ -2486,11 +2486,11 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - tmp1 = s_min( tmp1, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + tmp1 = s_min( tmp1, L_norm_arr( 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 ) ) ) ); } FOR( i = 0; i < i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ); 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, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp1 ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q tmp1) + 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 ) ), 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[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1], tmp1 ); move16(); -- GitLab From 18254c7c1ba3ef0fc2c1b228079243f24bd00bdb Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 15:47:36 +0100 Subject: [PATCH 034/358] Fix more cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. --- lib_dec/ivas_dirac_dec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ed721f142..e41832040 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3424,12 +3424,12 @@ void ivas_dirac_dec_render_sf_fx( 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, - CLDFB_NO_CHANNELS_HALF, 1 ); + s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 1 ); q_reference_power_smooth[0] = sub( 31, temp_q ); v_add_fixed_me( reference_power_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, DirAC_mem.reference_power_q[1] ), reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( 31, q_reference_power_smooth[1] ), reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, &temp_q, - sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 1 ); + s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ); q_reference_power_smooth[1] = sub( 31, temp_q ); #endif #else @@ -3668,12 +3668,12 @@ void ivas_dirac_dec_render_sf_fx( } #ifdef FIX_867_CLDFB_NRG_SCALE - exp = L_norm_arr( reference_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); - scale_sig32( reference_power_smooth_fx, CLDFB_NO_CHANNELS_HALF, exp ); // q_reference_power_smooth[0] + exp + 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 ); IF( LT_16( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // q_reference_power_smooth[0] + scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // q_reference_power_smooth[0] hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] = q_reference_power_smooth[0]; move16(); } @@ -3690,12 +3690,12 @@ void ivas_dirac_dec_render_sf_fx( move16(); } - exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // q_reference_power_smooth + exp + exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), exp ); // q_reference_power_smooth + exp q_reference_power_smooth[1] = add( q_reference_power_smooth[1], exp ); IF( LT_16( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // q_reference_power_smooth + 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( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // q_reference_power_smooth hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] = q_reference_power_smooth[1]; move16(); } -- GitLab From 9d8f6920ba39faa6d9d7b61a017892b37bea02bc Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 16:21:18 +0100 Subject: [PATCH 035/358] Fix more cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 0a89b81ea..064fae66b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2028,9 +2028,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**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 ), -- GitLab From bc99a0ed94b295c5dcd4134d055e9b4d76e94b21 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 16:23:00 +0100 Subject: [PATCH 036/358] Fix more cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 064fae66b..90fd493bc 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2028,9 +2028,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**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 ), -- GitLab From 6937f3d181ce236f5828667bd57c45ceb25b3ec3 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 16:27:12 +0100 Subject: [PATCH 037/358] Fix more cases where number of bands is lower than CLDFB_NO_CHANNELS_HALF. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 90fd493bc..b93bb05c1 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -4075,7 +4075,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common1_q, q_reference_power[0] ) ); /* Q(common1_q) */ + 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) */ @@ -4085,7 +4085,7 @@ static void computeTargetPSDs_direct_fx( 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, CLDFB_NO_CHANNELS_HALF, sub( common2_q, q_reference_power[0] ) ); /* Q(common2_q) */ + 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) */ -- GitLab From 1d5ecbb6edc98eb9ffa3e7cb8132fd97356676a3 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 3 Mar 2025 16:42:15 +0100 Subject: [PATCH 038/358] format --- lib_rend/ivas_dirac_output_synthesis_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index b93bb05c1..c733f12c0 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -4075,7 +4075,7 @@ static void computeTargetPSDs_direct_fx( 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, 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) */ @@ -4085,7 +4085,7 @@ static void computeTargetPSDs_direct_fx( 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, 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) */ -- GitLab From af3a0391da504aecba2648bf91eb6104199e5a9e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 14:54:26 +0100 Subject: [PATCH 039/358] fixed arithmetic symbol --- lib_rend/ivas_dirac_output_synthesis_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 1e79224f6..ddd568698 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -914,7 +914,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( IF( reference_power[k + num_freq_bands] == 0 ) { sqr_inp = Mpy_32_32( diffuseness[k], c ); - sqr_exp = sub( 31 - 4, q_diffuseness ); + sqr_exp = sub( 31 + 4, q_diffuseness ); } ELSE { -- GitLab From 1aa2c023baeaa1ee514e8d84709c04ed4dcf9315 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 14:34:08 +0000 Subject: [PATCH 040/358] Last cleanup --- lib_rend/ivas_dirac_output_synthesis_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index ddd568698..eabdf9389 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1055,7 +1055,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } -#endif } ELSE { -- GitLab From 12d2affe11c67abbdc3fbbc96f2f71be593c80bc Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 15:41:07 +0100 Subject: [PATCH 041/358] revert last commit --- lib_rend/ivas_dirac_output_synthesis_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index eabdf9389..ddd568698 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1055,6 +1055,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } +#endif } ELSE { -- GitLab From fd7c5da5ba8747239702eaff899b3559c43362e8 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 5 Mar 2025 14:16:04 +0100 Subject: [PATCH 042/358] Fix scaling errors. --- lib_rend/ivas_dirac_output_synthesis_dec.c | 2 +- lib_rend/ivas_dirac_rend.c | 65 +++++++++++++++++++++- lib_rend/lib_rend.c | 8 +-- 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index c733f12c0..28026b487 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -4061,7 +4061,7 @@ static void computeTargetPSDs_direct_fx( 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[0] ) ); + 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 ); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 9ebcb3132..7f4076266 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -2808,6 +2808,9 @@ 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; @@ -2815,6 +2818,12 @@ 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(); @@ -2823,16 +2832,52 @@ 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) ); + min_q_shift = s_min( q_shift, min_q_shift ); + q_shift2 = L_norm_arr( RealBuffer_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 ); + 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 + 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(); + } + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + { + re = L_shl( RealBuffer_fx[k][0][l], min_q_shift2 ); // q_cldfb+min_q_shift + im = L_shl( ImagBuffer_fx[k][0][l], min_q_shift2 ); // 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(); + } +#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 @@ -2843,12 +2888,24 @@ 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(); } +#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(); + sq_tmp_q = sub( add( add( q_cldfb, min_q_shift2 ), add( q_cldfb, min_q_shift2 ) ), 31 ); + reference_power_q[1] = sq_tmp_q; + 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++ ) @@ -2931,8 +2988,14 @@ 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; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 16739283b..4f430ff01 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8460,11 +8460,11 @@ static void intermidiate_ext_dirac_render( 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 ) ) { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF ) ); + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); } 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 ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, CLDFB_NO_CHANNELS_HALF, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) , tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); move16(); @@ -8472,11 +8472,11 @@ static void intermidiate_ext_dirac_render( 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 ) ) { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); } 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 ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ } 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(); -- GitLab From 3c9da4c86cffb43fc64077c1d6d646ce95422191 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 5 Mar 2025 14:25:39 +0100 Subject: [PATCH 043/358] clang format. --- lib_rend/ivas_dirac_rend_fx.c | 7 ++++--- lib_rend/lib_rend.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 7f4076266..f5e050db1 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2833,9 +2833,9 @@ void protoSignalComputation4_fx( 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) ); + 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) ); + q_shift = L_norm_arr( ImagBuffer_fx[k][0], s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ) ); min_q_shift = s_min( q_shift, min_q_shift ); q_shift2 = L_norm_arr( RealBuffer_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 ); @@ -2991,7 +2991,8 @@ void protoSignalComputation4_fx( #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(); + move16(); + move16(); #else *proto_power_smooth_q = proto_power_smooth_fx_q; move16(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4f430ff01..f33bc8997 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8460,11 +8460,11 @@ static void intermidiate_ext_dirac_render( 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 ) ) { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) ) ); + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); } 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 ) ) { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF) , tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); move16(); -- GitLab From fe2305639e2eccc5af553ffbb293fa26fa395422 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 5 Mar 2025 16:50:30 +0100 Subject: [PATCH 044/358] Change computeTargetPSDs_direct_subframe_fx to handle 2 scale regions directly. Extend 2 scale regions headroom calculation to proto_power_smooth_prev --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 48 +++++++++---------- lib_rend/lib_rend.c | 25 +++++++++- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 28026b487..fc88b5a9a 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2022,31 +2022,10 @@ 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 ) { -#ifdef FIX_867_CLDFB_NRG_SCALE - /* Is this necessary at all ? */ - q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); - scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ - scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**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[0] = q_com; - q_reference_power_smooth[1] = q_com; - move16(); - move16(); - h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = q_com; - h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = q_com; - move16(); - move16(); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; - move16(); -#else 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*/ @@ -2060,8 +2039,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); -#endif } +#endif computeTargetPSDs_diffuse_subframe_fx( nchan_target_psds, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, @@ -4250,24 +4229,45 @@ 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; +#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 Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); + q_cy_auto_diff_smooth_new = q_reference_power[0]; + move16(); + IF ( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) + { + Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); + 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_reference_power[0] ) ) + { + Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *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; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f33bc8997..19750a59a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8455,7 +8455,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(); move16(); #else - /* Possible improvement: normalize both scale regions individually. */ 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 ) ) @@ -8488,12 +8487,36 @@ static void intermidiate_ext_dirac_render( move16(); #endif #ifdef FIX_867_CLDFB_NRG_SCALE +#if 0 /* Possible improvement: normalize both scale regions individually. */ 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[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); 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 = 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 ) ) + { + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); + } + 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 ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), 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[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[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 ) ) + { + tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + } + 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 ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 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[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); + move16(); +#endif #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) */ -- GitLab From e6809f1864dff189057bd8a53db71bf2daa84a6b Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 5 Mar 2025 16:52:35 +0100 Subject: [PATCH 045/358] clang format --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index fc88b5a9a..0624d3910 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -4240,7 +4240,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); q_cy_auto_diff_smooth_new = q_reference_power[0]; move16(); - IF ( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) + IF( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; @@ -4253,7 +4253,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( cur_idx = imult1616( ch_idx, num_freq_bands ); #ifdef FIX_867_CLDFB_NRG_SCALE - IF ( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) + IF( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *q_cy_auto_diff_smooth ) ); } -- GitLab From 9975eec712315c691ba9a8d4edfdfe461af839f7 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 7 Mar 2025 15:04:57 +0100 Subject: [PATCH 046/358] first draft of the improvement. --- lib_enc/ivas_sns_enc_fx.c | 102 +++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index e6038186e..75c111483 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -171,6 +171,103 @@ static Word16 sns_1st_cod_fx( return index; } +static Word16 sns_1st_cod_fx_q15( + const Word32 *sns_fx, /* i : vector to quantize */ + const Word16 L_frame, + const Word16 core, + Word32 *snsq_fx /* o : quantized sns Q16 */ +) +{ + Word16 index; + const Word16 split_len = M / 2; + move16(); + const Word16 *means; + const Word16 means_fix = 2; // Q15 + push_wmops("sns_1st_cod_fx_q15"); + move16(); + /* remove means */ + means = NULL; + SWITCH( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + FOR( Word16 i = 0; i < M; ++i ) + { + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + snsq_fx[i] = L_add(sns_fx[i], L_negate( tmp ) ); + move32(); + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1; + Word16 dist_split; + Word64 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + move16(); + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = 0x7fffffffffffffffull; + dist_split = 0; + FOR( Word16 i = 0; i < 32; ++i ) + { + Word64 dist_fx = 0; + move64(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 dist; + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + move16(); + dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); + dist_fx = W_mac_32_32( dist_fx, dist, dist ); + } + + if ( LT_64( dist_fx, dist_min_fx ) ) + { + dist_min_fx= dist_fx; + dist_split =i ; + } + } + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + move32(); + } + + /* for second split shift by five bits to store both indices as one 10 bit value */ + IF( EQ_16( split, 1 ) ) + { + dist_split = shl( dist_split, 5 ); + } + + index = add( index, dist_split ); + } + pop_wmops(); + return index; +} + /*------------------------------------------------------------------- * sns_2st_cod() * @@ -276,7 +373,7 @@ void sns_avq_cod_fx( Word16 indxt[256], nbits, nbt, nit; Word32 snsmid_q0_fx[M]; - index[0] = sns_1st_cod_fx( sns_fx, exp_sns, L_frame, core, sns_q_fx ); + index[0] = sns_1st_cod_fx_q15( sns_fx, L_frame, core, sns_q_fx ); move16(); nit = 1 + 2; move16(); @@ -303,7 +400,8 @@ void sns_avq_cod_fx( { index++; - index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); +// index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From 09a6bfaf999b961e0d50083e7d8a1c556359b889 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 7 Mar 2025 15:34:59 +0100 Subject: [PATCH 047/358] addressed some code review comments in sns_1st_cod_fx_q15(). --- lib_enc/ivas_sns_enc_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 75c111483..2bb03a952 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -226,6 +226,8 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = cdbk; dist_min_fx = 0x7fffffffffffffffull; dist_split = 0; + move64(); + move16(); FOR( Word16 i = 0; i < 32; ++i ) { Word64 dist_fx = 0; @@ -234,12 +236,11 @@ static Word16 sns_1st_cod_fx_q15( { Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - move16(); dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); dist_fx = W_mac_32_32( dist_fx, dist, dist ); } - if ( LT_64( dist_fx, dist_min_fx ) ) + IF ( LT_64( dist_fx, dist_min_fx ) ) { dist_min_fx= dist_fx; dist_split =i ; @@ -257,7 +258,7 @@ static Word16 sns_1st_cod_fx_q15( } /* for second split shift by five bits to store both indices as one 10 bit value */ - IF( EQ_16( split, 1 ) ) + if( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } -- GitLab From d8dcbe89e4e4c1ccc8443c600ad384770391e699 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Mar 2025 18:42:08 +0100 Subject: [PATCH 048/358] formatting --- lib_enc/ivas_sns_enc_fx.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 2bb03a952..9395fc6d4 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -183,7 +183,7 @@ static Word16 sns_1st_cod_fx_q15( move16(); const Word16 *means; const Word16 means_fix = 2; // Q15 - push_wmops("sns_1st_cod_fx_q15"); + push_wmops( "sns_1st_cod_fx_q15" ); move16(); /* remove means */ means = NULL; @@ -204,7 +204,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_add(sns_fx[i], L_negate( tmp ) ); + snsq_fx[i] = L_add( sns_fx[i], L_negate( tmp ) ); move32(); } @@ -214,8 +214,8 @@ static Word16 sns_1st_cod_fx_q15( { const Word16 *cdbk_ptr; Word16 j0, j1; - Word16 dist_split; - Word64 dist_min_fx; + Word16 dist_split; + Word64 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; @@ -226,26 +226,26 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = cdbk; dist_min_fx = 0x7fffffffffffffffull; dist_split = 0; - move64(); - move16(); - FOR( Word16 i = 0; i < 32; ++i ) - { - Word64 dist_fx = 0; - move64(); - FOR( Word16 j = j0; j < j1; ++j ) - { - Word32 dist; - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); - dist_fx = W_mac_32_32( dist_fx, dist, dist ); - } - - IF ( LT_64( dist_fx, dist_min_fx ) ) - { - dist_min_fx= dist_fx; - dist_split =i ; - } - } + move64(); + move16(); + FOR( Word16 i = 0; i < 32; ++i ) + { + Word64 dist_fx = 0; + move64(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 dist; + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); + dist_fx = W_mac_32_32( dist_fx, dist, dist ); + } + + IF( LT_64( dist_fx, dist_min_fx ) ) + { + dist_min_fx = dist_fx; + dist_split = i; + } + } /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; @@ -258,14 +258,14 @@ static Word16 sns_1st_cod_fx_q15( } /* for second split shift by five bits to store both indices as one 10 bit value */ - if( EQ_16( split, 1 ) ) + if ( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } index = add( index, dist_split ); } - pop_wmops(); + pop_wmops(); return index; } @@ -402,7 +402,7 @@ void sns_avq_cod_fx( index++; index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); -// index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + // index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From 18bf870b5406fd0ab15d1557dc93bc10e8df1ccb Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 10 Mar 2025 13:59:00 +0100 Subject: [PATCH 049/358] sns_1st_cod_fx_q15() implemented with a 32 bit multiplication. --- lib_enc/ivas_sns_enc_fx.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 9395fc6d4..c52efe14f 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -215,7 +215,7 @@ static Word16 sns_1st_cod_fx_q15( const Word16 *cdbk_ptr; Word16 j0, j1; Word16 dist_split; - Word64 dist_min_fx; + Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; @@ -224,23 +224,26 @@ static Word16 sns_1st_cod_fx_q15( j1 = add( j0, split_len ); cdbk_ptr = cdbk; - dist_min_fx = 0x7fffffffffffffffull; + dist_min_fx = MAXVAL_WORD32; dist_split = 0; - move64(); + move32(); move16(); FOR( Word16 i = 0; i < 32; ++i ) { - Word64 dist_fx = 0; - move64(); + Word32 dist_fx = 0; + move32(); FOR( Word16 j = j0; j < j1; ++j ) { Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); - dist_fx = W_mac_32_32( dist_fx, dist, dist ); + dist = L_shr( dist, 4 ); // TODO: Magic shift. + dist = L_mult( extract_l( dist ), extract_l( dist ) ); + dist = L_shr( dist, 4 ); // TODO: Magic shift + dist_fx = L_add( dist_fx, dist ); } - IF( LT_64( dist_fx, dist_min_fx ) ) + IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; dist_split = i; -- GitLab From 5eea1e167939ee65d40b0d1d9628b5fffcba3809 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 10 Mar 2025 14:30:29 +0100 Subject: [PATCH 050/358] appl --- lib_enc/ivas_sns_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index c52efe14f..98c8f56c4 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -237,9 +237,9 @@ static Word16 sns_1st_cod_fx_q15( Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift. + dist = L_shr( dist, 4 ); // TODO: Magic shift. dist = L_mult( extract_l( dist ), extract_l( dist ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift + dist = L_shr( dist, 4 ); // TODO: Magic shift dist_fx = L_add( dist_fx, dist ); } -- GitLab From 78da1419bd4a7830326af0f61a20c884dbb2eb47 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 10 Mar 2025 15:11:47 +0100 Subject: [PATCH 051/358] apply the scalefac in some more places --- .gitlab-ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15c944725..b53943d9e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -518,7 +518,7 @@ stages: - exit_code=0 - rm -rf .pytest_cache || true - - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE @@ -661,7 +661,7 @@ stages: - make -j # need to restore cache again - *overwrite-pytest-cache-with-artifact - - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN $comp_args --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true - python3 scripts/parse_xml_report.py $XML_REPORT_MAIN $CSV_MAIN ### compare the two csv files for regressions @@ -799,10 +799,13 @@ stages: - fi - *build-float-ref-and-dut-binaries + - INV_LEVEL_SCALING=$(awk "BEGIN {print 1.0 / $LEVEL_SCALING}") + - comp_args="--mld --ssnr --odg --scalefac $INV_LEVEL_SCALING" + ### run pytest - exit_code=0 - - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report-ref.html --self-contained-html --junit-xml=report-junit-ref.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --dut_encoder_path $REF_ENCODER_PATH --dut_decoder_path $REF_DECODER_PATH --compare_to_input || exit_code=$? - - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report-dut.html --self-contained-html --junit-xml=report-junit-dut.xml --mld --ssnr --odg -n auto --testcase_timeout $testcase_timeout --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH --compare_to_input || exit_code=$? + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report-ref.html --self-contained-html --junit-xml=report-junit-ref.xml $comp_args -n auto --testcase_timeout $testcase_timeout --dut_encoder_path $REF_ENCODER_PATH --dut_decoder_path $REF_DECODER_PATH --compare_to_input || exit_code=$? + - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report-dut.html --self-contained-html --junit-xml=report-junit-dut.xml $comp_args -n auto --testcase_timeout $testcase_timeout --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH --compare_to_input || exit_code=$? - zero_errors_ref=$(cat report-junit-ref.xml | grep -c 'errors="0"') || true - zero_errors_dut=$(cat report-junit-dut.xml | grep -c 'errors="0"') || true - python3 scripts/parse_xml_report.py report-junit-ref.xml report-ref.csv -- GitLab From 17cc7bd3bf313372b8009f59c1ee3cead1cc96b6 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Tue, 11 Mar 2025 13:18:07 +0100 Subject: [PATCH 052/358] minor wmops improvement in sns_1st_cod_fx_q15. --- lib_enc/ivas_sns_enc_fx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index b615e5abe..3ae1ea424 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -204,7 +204,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_add( sns_fx[i], L_negate( tmp ) ); + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -234,9 +234,10 @@ static Word16 sns_1st_cod_fx_q15( move32(); FOR( Word16 j = j0; j < j1; ++j ) { + Word32 tmp; Word32 dist; - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + dist = L_sub( snsq_fx[j], tmp ); dist = L_shr( dist, 4 ); // TODO: Magic shift. dist = L_mult( extract_l( dist ), extract_l( dist ) ); dist = L_shr( dist, 4 ); // TODO: Magic shift @@ -254,8 +255,8 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++ , cdbk_fix ); // Q16 snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } -- GitLab From faf14982b95e2bcf4ed8ff33aadb9cfeee9c857c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Mar 2025 16:00:04 +0100 Subject: [PATCH 053/358] update .gitlab-ci.yaml - remove -p BASOP from instrumentation job and getWmops.sh --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac52a99a7..58547f2ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -977,7 +977,7 @@ build-codec-linux-instrumented-make: script: - *print-common-info - *update-scripts-repo - - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP + - bash scripts/prepare_instrumentation.sh -m MEM_ONLY - make -j -C $INSTR_DIR build-codec-linux-debugging-make: @@ -1730,7 +1730,7 @@ voip-be-on-merge-request: stage: test variables: ret_val: 0 - GET_WMOPS_ARGS: "mem_only basop" + GET_WMOPS_ARGS: "mem_only" timeout: 3 hours 30 minutes before_script: - *print-common-info -- GitLab From 68843a329d7d298a5aeef1d8e39170fb1b615e15 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 6 Mar 2025 18:40:51 +0530 Subject: [PATCH 054/358] Fix for 3GPP issue 1344: Decoder segfault for Stereo at 24.4kbps in ivas_fec_noise_filling_fx() Link #1344 --- lib_dec/FEC_HQ_phase_ecu_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index dd63b6508..34d01d7fe 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -4595,11 +4595,11 @@ static void ivas_fec_noise_filling_fx( { L_tmp = L_mult( *sinq_tab, *sinq_tab ); /*Q30 */ sinq_tab++; - q2 = round_fx( L_sub( 2147483647, L_tmp ) ); /*Q15 */ - q1 = round_fx( L_tmp ); /*Q15 */ - L_tmp = L_mult( ( *pt1 ), q1 ); /*Qsynth+16 */ - L_tmp = L_mac( L_tmp, shr( *pt6++, Q_old_out ), q2 ); /*Qsynth+16 */ - ( *pt1++ ) = round_fx( L_tmp ); /*Qsynth */ + q2 = round_fx( L_sub( 2147483647, L_tmp ) ); /*Q15 */ + q1 = round_fx( L_tmp ); /*Q15 */ + L_tmp = L_mult( ( *pt1 ), q1 ); /*Qsynth+16 */ + L_tmp = L_add( L_tmp, L_shr( Mpy_32_16_1( L_deposit_h( *pt6++ ), q2 ), Q_old_out ) ); /*Qsynth+16 */ + ( *pt1++ ) = round_fx( L_tmp ); /*Qsynth */ move16(); } -- GitLab From 723e7ccd6e5bff12d5486ca4a22b4dd38cbd5096 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 6 Mar 2025 18:36:41 +0530 Subject: [PATCH 055/358] Fix for 3GPP issue 1346: Decoder crash for Stereo at 24.4kbps JBM decoding in ivas_hq_core_dec_fx() Link #1346 --- lib_com/lerp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/lerp.c b/lib_com/lerp.c index bb33d9922..28719205a 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -430,7 +430,7 @@ static void lerp_proc32( Word32 *f /*Qx*/, Word32 *f_out /*Qx*/, Word16 bufferNe { diff = sub( 16384 /*0.5f Q15*/, diff ); /*Q15*/ } - *ptr++ = L_add_sat( f[idx], Mpy_32_16_1( L_sub( f[idx + 1], f[idx] ), diff ) ); /*Qx*/ + *ptr++ = L_add_sat( f[idx], L_sub( Mpy_32_16_1( f[idx + 1], diff ), Mpy_32_16_1( f[idx], diff ) ) ); /*Qx*/ move32(); pos = L_add( pos, shift ); /*Q16*/ idx = extract_h( pos ); -- GitLab From 89e55c686bea6575c8cf32d17c8b18f4a4366c39 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 6 Mar 2025 18:44:47 +0530 Subject: [PATCH 056/358] Fix for 3GPP issue 1307: Missing signal in BASOP enc-dec path compared to float enc-dec path using selection test MASA at 24.4 kbps with DTX enabled Link #1307 --- lib_enc/nois_est_fx.c | 37 ++++++++++++++++++++----------------- lib_enc/stat_enc.h | 3 +++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 68eed3d65..0851e4c17 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -326,6 +326,10 @@ void noise_est_init_ivas_fx( hNoiseEst->Etot_sq_st_est_fx = 1600; /* 400 in Q2 */ move16(); move16(); + hNoiseEst->L_Etot_st_est_fx = 167772160; /* 20.0f in Q23 */ + hNoiseEst->L_Etot_sq_st_est_fx = 26214400; /* 400 in Q16 */ + move32(); + move32(); hNoiseEst->epsP_0_2_lp_fx = 4096; /*1.0 Q12*/ move16(); hNoiseEst->epsP_0_2_ad_lp_fx = 0; @@ -2195,9 +2199,9 @@ void noise_est_ivas_fx( Word16 vad_bwidth_fx; /* vad ns control variabel for input bwidth from teh BWD */ /* for DTX operation */ - Word16 lim_Etot_fx; /* Q8 */ - Word16 lim_Etot_sq_fx; /* Q2 */ - Word16 st_E_var_est_fx; /* Q2 */ + Word16 lim_Etot_fx; /* Q8 */ + Word32 lim_Etot_sq_fx; /* Q16 */ + Word32 st_E_var_est_fx; NOISE_EST_HANDLE hNoiseEst; SP_MUS_CLAS_HANDLE hSpMusClas; Word32 Le_min_scaled; @@ -2720,32 +2724,31 @@ void noise_est_ivas_fx( Lnon_sta2 = L_deposit_l( 1024 ); /* 1.0 in Q10 */ } - lim_Etot_fx = s_max( 5120, Etot ); /* 20.0f Q8 */ - lim_Etot_sq_fx = extract_h( L_shl_r( L_mult( lim_Etot_fx, lim_Etot_fx ), 1 ) ); /* Q2 */ + lim_Etot_fx = s_max( 5120, Etot ); /* 20.0f Q8 */ + lim_Etot_sq_fx = L_mult0( lim_Etot_fx, lim_Etot_fx ); /* Q16 */ IF( LT_16( ini_frame, 150 ) ) { /* Allow use of quicker filter during init - if needed */ /* st->Etot_st_est = 0.25f * lim_Etot + (1.0f-0.25F) * st->Etot_st_est; */ - hNoiseEst->Etot_st_est_fx = mac_r( L_mult( 8192, lim_Etot_fx ), 24576, hNoiseEst->Etot_st_est_fx ); // Q8 - move16(); + hNoiseEst->L_Etot_st_est_fx = Madd_32_16_r( L_mult0( 8192, lim_Etot_fx ), hNoiseEst->L_Etot_st_est_fx, 24576 ); // Q23 + move32(); /* st->Etot_sq_st_est = 0.25f * lim_Etot * lim_Etot + (1.0f-0.25f) * st->Etot_sq_st_est; */ - hNoiseEst->Etot_sq_st_est_fx = mac_r( L_mult( 8192, lim_Etot_sq_fx ), 24576, hNoiseEst->Etot_sq_st_est_fx ); // Q2 - move16(); + hNoiseEst->L_Etot_sq_st_est_fx = Madd_32_16_r( Mult_32_16( lim_Etot_sq_fx, 8192 ), hNoiseEst->L_Etot_sq_st_est_fx, 24576 ); // Q16 + move32(); } ELSE { /* st->Etot_st_est = 0.25f * lim_Etot + (1.0f-0.25F) * st->Etot_st_est; */ - hNoiseEst->Etot_st_est_fx = mac_r( L_mult( 8192, lim_Etot_fx ), 24576, hNoiseEst->Etot_st_est_fx ); // Q8 - move16(); + hNoiseEst->L_Etot_st_est_fx = Madd_32_16_r( L_mult0( 8192, lim_Etot_fx ), hNoiseEst->L_Etot_st_est_fx, 24576 ); // Q23 + move32(); /* st->Etot_sq_st_est = 0.25f * lim_Etot * lim_Etot + (1.0f-0.25f) * st->Etot_sq_st_est; */ - hNoiseEst->Etot_sq_st_est_fx = mac_r( L_mult( 8192, lim_Etot_sq_fx ), 24576, hNoiseEst->Etot_sq_st_est_fx ); // Q2 - move16(); + hNoiseEst->L_Etot_sq_st_est_fx = Madd_32_16_r( Mult_32_16( lim_Etot_sq_fx, 8192 ), hNoiseEst->L_Etot_sq_st_est_fx, 24576 ); // Q16 + move32(); } - st_E_var_est_fx = sub( hNoiseEst->Etot_sq_st_est_fx, extract_h( L_shl_r( L_mult( hNoiseEst->Etot_st_est_fx, hNoiseEst->Etot_st_est_fx ), 1 ) ) ); // Q2 - - + Word16 exp_tmp; + st_E_var_est_fx = BASOP_Util_Add_Mant32Exp( hNoiseEst->L_Etot_sq_st_est_fx, Q15, L_negate( Mpy_32_32( hNoiseEst->L_Etot_st_est_fx, hNoiseEst->L_Etot_st_est_fx ) ), Q16, &exp_tmp ); // exp(exp_tmp) /*-----------------------------------------------------------------* * Count frames since last correlation or harmonic event *-----------------------------------------------------------------*/ @@ -2775,7 +2778,7 @@ void noise_est_ivas_fx( } test(); test(); - IF( GT_16( *st_harm_cor_cnt, 1 ) && GT_16( Etot, 7680 /* 30.0f in Q8 */ ) && GT_16( st_E_var_est_fx, 32 /* 8.0f in Q2 */ ) ) + IF( GT_16( *st_harm_cor_cnt, 1 ) && GT_16( Etot, 7680 /* 30.0f in Q8 */ ) && EQ_16( BASOP_Util_Cmp_Mant32Exp( st_E_var_est_fx, exp_tmp, 524288 /* 8.0f in Q16 */, Q15 ), 1 ) ) { /* st->harm_cor_cnt = max(1, (short) round_f( (float) st->harm_cor_cnt / 4.0f )) ; */ *st_harm_cor_cnt = s_max( 1, shr( add( *st_harm_cor_cnt, 2 ), 2 ) ); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 6fd9ce6f3..ad572d2ba 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -566,6 +566,9 @@ typedef struct noise_estimation_structure Word16 Etot_st_est_fx; /* Q8 Noise estimation - short term estimate of E{ Etot } */ Word16 Etot_sq_st_est_fx; /* Q2 Noise estimation - short term estimate of E{ Etot^2 } */ + Word32 L_Etot_st_est_fx; /* Q23 Noise estimation - short term estimate of E{ Etot } */ + Word32 L_Etot_sq_st_est_fx; /* Q16 Noise estimation - short term estimate of E{ Etot^2 } */ + Word16 aEn_inac_cnt; } NOISE_EST_DATA, *NOISE_EST_HANDLE; -- GitLab From e0b75f08f9eeed3a08ce3d092079cba9034e7f06 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 07:28:01 +0530 Subject: [PATCH 057/358] Clean up of prot.h file --- Workspace_msvc/lib_com.vcxproj | 3 - Workspace_msvc/lib_com.vcxproj.filters | 9 - lib_com/ari_hm_fx.c | 1 - lib_com/arith_coder_fx.c | 1 - lib_com/basop_tcx_utils.c | 2 +- lib_com/bitalloc_fx.c | 1 - lib_com/bitstream.c | 3 +- lib_com/cldfb.c | 1 - lib_com/cng_exc.c | 57 - lib_com/codec_tcx_common.c | 1 - lib_com/core_com_config.c | 60 +- lib_com/deemph.c | 3 +- lib_com/delay_comp.c | 3 +- lib_com/disclaimer.c | 2 +- lib_com/enr_1_az.c | 3 +- lib_com/env_adj.c | 3 +- lib_com/env_stab.c | 3 +- lib_com/env_stab_trans.c | 3 +- lib_com/fd_cng_com_fx.c | 1 - lib_com/fft.c | 2 +- lib_com/fft_fx.c | 2 +- lib_com/fft_rel.c | 3 +- lib_com/fill_spectrum.c | 3 +- lib_com/findpulse.c | 3 +- lib_com/float_to_fix_ops.c | 1 - lib_com/frame_ener_fx.c | 3 +- lib_com/get_gain_fx.c | 3 +- lib_com/gs_bitallocation_ivas_fx.c | 1 - lib_com/gs_gains.c | 1 - lib_com/gs_preech_fx.c | 3 +- lib_com/hp50_fx.c | 3 +- lib_com/hq2_core_com.c | 2 +- lib_com/hq_conf.c | 3 +- lib_com/hq_tools_fx.c | 1 - lib_com/ifft_rel.c | 3 +- lib_com/int_lsp.c | 3 +- lib_com/interleave_spectrum.c | 3 +- lib_com/interpol.c | 3 +- lib_com/ivas_agc_com_fx.c | 2 +- lib_com/ivas_arith_fx.c | 3 +- lib_com/ivas_avq_pos_reorder_com_fx.c | 2 +- lib_com/ivas_cov_smooth_fx.c | 1 - lib_com/ivas_dirac_com_fx.c | 3 +- lib_com/ivas_entropy_coder_common_fx.c | 2 +- lib_com/ivas_fb_mixer_fx.c | 3 +- lib_com/ivas_ism_com_fx.c | 3 +- lib_com/ivas_lfe_com_fx.c | 2 +- lib_com/ivas_masa_com_fx.c | 3 +- lib_com/ivas_mc_com_fx.c | 2 +- lib_com/ivas_mc_param_com_fx.c | 1 - lib_com/ivas_mct_com_fx.c | 2 +- lib_com/ivas_mdct_core_com_fx.c | 3 +- lib_com/ivas_mdft_imdft_fx.c | 3 +- lib_com/ivas_omasa_com_fx.c | 3 +- lib_com/ivas_pca_tools_fx.c | 1 - lib_com/ivas_qmetadata_com_fx.c | 3 +- lib_com/ivas_qspherical_com_fx.c | 4 +- lib_com/ivas_sba_config_fx.c | 2 +- lib_com/ivas_sns_com_fx.c | 1 - lib_com/ivas_spar_com_fx.c | 1 - lib_com/ivas_spar_com_quant_util_fx.c | 1 - lib_com/ivas_stereo_dft_com_fx.c | 2 +- lib_com/ivas_stereo_eclvq_com_fx.c | 2 +- lib_com/ivas_stereo_ica_com_fx.c | 1 - lib_com/ivas_stereo_mdct_bands_com_fx.c | 3 +- lib_com/ivas_stereo_psychlpc_com_fx.c | 2 +- lib_com/ivas_stereo_td_bit_alloc_fx.c | 3 +- lib_com/ivas_tools_fx.c | 3 +- lib_com/ivas_transient_det_fx.c | 3 +- lib_com/lag_wind.c | 1 - lib_com/lerp.c | 129 - lib_com/limit_t0.c | 231 - lib_com/longarith.c | 3 +- lib_com/lsp_conv_poly_fx.c | 3 +- lib_com/modif_fs.c | 3 +- lib_com/mslvq_com.c | 3 +- lib_com/mslvq_com_fx.c | 1 - lib_com/preemph.c | 2 +- lib_com/prot.h | 8340 ----------------- lib_com/prot_fx.h | 793 +- lib_com/pvq_com_fx.c | 1 - lib_com/residu_fx.c | 1 - lib_com/rom_com.c | 3 +- lib_com/rom_com_fx.c | 2 +- lib_com/swb_tbe_com.c | 1 - lib_com/swb_tbe_com_fx.c | 1 - lib_com/tcx_mdct_window.c | 1 - lib_com/tcx_utils_fx.c | 1 - lib_com/tns_base.c | 1 - lib_com/tools.c | 1199 +-- lib_com/tools_fx.c | 1 - lib_com/wtda.c | 3 +- lib_dec/acelp_core_dec_ivas_fx.c | 1 - lib_dec/acelp_core_switch_dec_fx.c | 1 - lib_dec/ari_hm_dec.c | 3 +- lib_dec/arith_coder_dec_fx.c | 1 - lib_dec/avq_dec_fx.c | 1 - lib_dec/cng_dec_fx.c | 1 - lib_dec/core_dec_init_fx.c | 1 - lib_dec/core_dec_switch_fx.c | 1 - lib_dec/dec_tcx_fx.c | 1 - lib_dec/gs_dec_fx.c | 1 - lib_dec/hf_synth_fx.c | 1 - lib_dec/hq_core_dec_fx.c | 1 - lib_dec/igf_dec_fx.c | 3 +- lib_dec/init_dec_fx.c | 1 - lib_dec/ivas_agc_dec_fx.c | 1 - lib_dec/ivas_binRenderer_internal_fx.c | 3 +- lib_dec/ivas_core_dec_fx.c | 3 +- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 1 - lib_dec/ivas_cpe_dec_fx.c | 3 +- lib_dec/ivas_decision_matrix_dec_fx.c | 3 +- lib_dec/ivas_dirac_dec_fx.c | 3 +- lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 3 +- lib_dec/ivas_entropy_decoder_fx.c | 3 +- lib_dec/ivas_init_dec.c | 3 +- lib_dec/ivas_ism_dec_fx.c | 3 +- lib_dec/ivas_ism_dtx_dec_fx.c | 3 +- lib_dec/ivas_ism_metadata_dec_fx.c | 1 - lib_dec/ivas_ism_param_dec_fx.c | 3 +- lib_dec/ivas_ism_renderer_fx.c | 1 - lib_dec/ivas_jbm_dec_fx.c | 3 +- lib_dec/ivas_lfe_dec_fx.c | 1 - lib_dec/ivas_lfe_plc_fx.c | 1 - lib_dec/ivas_ls_custom_dec_fx.c | 3 +- lib_dec/ivas_masa_dec_fx.c | 1 - lib_dec/ivas_mc_param_dec_fx.c | 3 +- lib_dec/ivas_mc_paramupmix_dec_fx.c | 1 - lib_dec/ivas_mcmasa_dec_fx.c | 2 +- lib_dec/ivas_mct_core_dec_fx.c | 3 +- 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 | 3 +- lib_dec/ivas_mono_dmx_renderer_fx.c | 1 - lib_dec/ivas_objectRenderer_internal_fx.c | 3 +- lib_dec/ivas_omasa_dec_fx.c | 3 +- lib_dec/ivas_osba_dec_fx.c | 3 +- lib_dec/ivas_out_setup_conversion_fx.c | 3 +- lib_dec/ivas_pca_dec_fx.c | 3 +- lib_dec/ivas_post_proc_fx.c | 1 - lib_dec/ivas_qmetadata_dec_fx.c | 3 +- lib_dec/ivas_qspherical_dec_fx.c | 2 +- lib_dec/ivas_range_uni_dec_fx.c | 3 +- lib_dec/ivas_sba_dec_fx.c | 3 +- lib_dec/ivas_sba_rendering_internal_fx.c | 3 +- lib_dec/ivas_sce_dec_fx.c | 1 - lib_dec/ivas_sns_dec_fx.c | 3 +- lib_dec/ivas_spar_decoder_fx.c | 3 +- lib_dec/ivas_spar_md_dec_fx.c | 3 +- lib_dec/ivas_stereo_adapt_GR_dec_fx.c | 3 +- lib_dec/ivas_stereo_cng_dec.c | 3 +- lib_dec/ivas_stereo_dft_dec.c | 1 - lib_dec/ivas_stereo_dft_dec_dmx_fx.c | 3 +- lib_dec/ivas_stereo_dft_dec_fx.c | 1 - lib_dec/ivas_stereo_dft_plc_fx.c | 1 - lib_dec/ivas_stereo_eclvq_dec_fx.c | 2 +- lib_dec/ivas_stereo_ica_dec_fx.c | 3 +- lib_dec/ivas_stereo_icbwe_dec_fx.c | 1 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 3 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 3 +- lib_dec/ivas_stereo_switching_dec_fx.c | 3 +- lib_dec/ivas_stereo_td_dec_fx.c | 1 - lib_dec/ivas_svd_dec_fx.c | 3 +- lib_dec/ivas_tcx_core_dec_fx.c | 3 +- lib_dec/ivas_td_low_rate_dec_fx.c | 1 - lib_dec/jbm_jb4_circularbuffer.c | 2 +- lib_dec/jbm_jb4_circularbuffer.h | 2 +- lib_dec/jbm_jb4_inputbuffer.c | 2 +- lib_dec/jbm_jb4_jmf.c | 2 +- lib_dec/jbm_jb4sb.c | 1 - lib_dec/jbm_pcmdsp_apa.c | 3 +- lib_dec/lib_dec_fx.c | 5 +- lib_dec/swb_tbe_dec_fx.c | 1 - lib_dec/tonalMDCTconcealment_fx.c | 1 - lib_enc/ACcontextMapping_enc_fx.c | 1 - lib_enc/FEC_enc_fx.c | 1 - lib_enc/SNR_calc_fx.c | 1 - lib_enc/acelp_core_enc_fx.c | 1 - lib_enc/acelp_core_switch_enc_fx.c | 1 - lib_enc/ari_hm_enc_fx.c | 4 +- lib_enc/avq_cod_fx.c | 4 +- lib_enc/cng_enc_fx.c | 10 +- lib_enc/cod2t32_fx.c | 1 - lib_enc/cod4t64_fast.c | 1 - lib_enc/cod4t64_fx.c | 3 +- lib_enc/cod_tcx_fx.c | 2 - lib_enc/core_enc_init_fx.c | 1 - lib_enc/core_enc_switch_fx.c | 5 +- lib_enc/dtx_fx.c | 1 - lib_enc/enc_gen_voic_fx.c | 3 +- lib_enc/enc_higher_acelp_fx.c | 3 +- lib_enc/enc_pit_exc_fx.c | 1 - lib_enc/enc_prm_fx.c | 3 +- lib_enc/enc_tran_fx.c | 1 - lib_enc/enc_uv_fx.c | 3 +- lib_enc/eval_pit_contr_fx.c | 1 - lib_enc/evs_enc_fx.c | 3 +- lib_enc/fd_cng_enc_fx.c | 1 - lib_enc/find_wsp_fx.c | 3 +- lib_enc/gain_enc_fx.c | 1 - lib_enc/gaus_enc_fx.c | 1 - lib_enc/gs_enc_fx.c | 2 - lib_enc/hq_classifier_enc_fx.c | 1 - lib_enc/hq_core_enc_fx.c | 10 +- lib_enc/hq_env_enc_fx.c | 1 - lib_enc/hq_hr_enc_fx.c | 1 - lib_enc/hq_lr_enc_fx.c | 1 - lib_enc/hvq_enc_fx.c | 1 - lib_enc/igf_enc.c | 38 +- lib_enc/igf_enc_fx.c | 3 +- lib_enc/igf_scf_enc.c | 3 +- lib_enc/init_enc_fx.c | 1 - lib_enc/inov_enc_fx.c | 1 - lib_enc/ivas_agc_enc_fx.c | 3 +- lib_enc/ivas_core_enc_fx.c | 3 +- lib_enc/ivas_core_pre_proc_front_fx.c | 2 - lib_enc/ivas_core_pre_proc_fx.c | 3 +- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 1 - lib_enc/ivas_cpe_enc_fx.c | 3 +- lib_enc/ivas_decision_matrix_enc_fx.c | 3 +- lib_enc/ivas_dirac_enc_fx.c | 1 - lib_enc/ivas_enc_cov_handler_fx.c | 3 +- lib_enc/ivas_enc_fx.c | 3 +- lib_enc/ivas_entropy_coder_fx.c | 1 - lib_enc/ivas_front_vad_fx.c | 3 +- lib_enc/ivas_init_enc_fx.c | 3 +- lib_enc/ivas_ism_dtx_enc_fx.c | 3 +- lib_enc/ivas_ism_enc_fx.c | 3 +- lib_enc/ivas_ism_metadata_enc_fx.c | 3 +- lib_enc/ivas_ism_param_enc_fx.c | 1 - lib_enc/ivas_lfe_enc_fx.c | 3 +- lib_enc/ivas_masa_enc_fx.c | 1 - lib_enc/ivas_mc_param_enc_fx.c | 2 - lib_enc/ivas_mc_paramupmix_enc_fx.c | 3 +- lib_enc/ivas_mcmasa_enc_fx.c | 1 - lib_enc/ivas_mct_core_enc_fx.c | 4 +- lib_enc/ivas_mct_enc_fx.c | 3 +- lib_enc/ivas_mct_enc_mct_fx.c | 1 - lib_enc/ivas_mdct_core_enc_fx.c | 3 +- lib_enc/ivas_omasa_enc_fx.c | 1 - lib_enc/ivas_osba_enc_fx.c | 3 +- lib_enc/ivas_pca_enc_fx.c | 3 +- lib_enc/ivas_qmetadata_enc_fx.c | 4 +- lib_enc/ivas_qspherical_enc_fx.c | 1 - lib_enc/ivas_range_uni_enc_fx.c | 2 +- lib_enc/ivas_sba_enc_fx.c | 3 +- lib_enc/ivas_sce_enc_fx.c | 1 - lib_enc/ivas_sns_enc_fx.c | 3 +- lib_enc/ivas_spar_encoder_fx.c | 1 - lib_enc/ivas_spar_md_enc_fx.c | 2 - lib_enc/ivas_stereo_adapt_GR_enc_fx.c | 2 +- lib_enc/ivas_stereo_classifier_fx.c | 3 +- lib_enc/ivas_stereo_cng_enc_fx.c | 3 +- lib_enc/ivas_stereo_dft_enc_fx.c | 3 +- lib_enc/ivas_stereo_dft_enc_itd_fx.c | 1 - lib_enc/ivas_stereo_dft_td_itd_fx.c | 3 +- lib_enc/ivas_stereo_dmx_evs_fx.c | 2 - lib_enc/ivas_stereo_eclvq_enc_fx.c | 1 - lib_enc/ivas_stereo_ica_enc_fx.c | 3 +- lib_enc/ivas_stereo_icbwe_enc_fx.c | 3 +- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 1 - lib_enc/ivas_stereo_mdct_igf_enc_fx.c | 1 - lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 1 - lib_enc/ivas_stereo_switching_enc_fx.c | 3 +- lib_enc/ivas_stereo_td_analysis_fx.c | 3 +- lib_enc/ivas_stereo_td_enc_fx.c | 3 +- lib_enc/ivas_tcx_core_enc_fx.c | 3 +- lib_enc/ivas_td_low_rate_enc_fx.c | 1 - lib_enc/lib_enc.c | 1 - lib_enc/lsf_enc_fx.c | 1 - lib_enc/lsf_msvq_ma_enc.c | 1 - lib_enc/mdct_classifier_fx.c | 1 - lib_enc/mslvq_enc_fx.c | 3 +- lib_enc/nelp_enc_fx.c | 1 - lib_enc/peak_vq_enc_fx.c | 1 - lib_enc/pit_enc_fx.c | 1 - lib_enc/range_enc_fx.c | 1 - lib_enc/speech_music_classif_fx.c | 1 - lib_enc/stat_noise_uv_enc_fx.c | 1 - lib_enc/swb_bwe_enc_fx.c | 3 +- lib_enc/swb_bwe_enc_lr_fx.c | 1 - lib_enc/swb_tbe_enc.c | 46 - lib_enc/swb_tbe_enc_fx.c | 1 - lib_enc/tcq_core_enc_fx.c | 1 - lib_enc/tns_base_enc_fx.c | 1 - lib_enc/transition_enc_fx.c | 1 - lib_rend/ivas_allrad_dec_fx.c | 2 +- lib_rend/ivas_crend_fx.c | 3 +- lib_rend/ivas_dirac_ana_fx.c | 3 +- .../ivas_dirac_dec_binaural_functions_fx.c | 1 - lib_rend/ivas_dirac_decorr_dec_fx.c | 3 +- lib_rend/ivas_dirac_onsets_dec_fx.c | 3 +- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 3 +- lib_rend/ivas_dirac_rend_fx.c | 3 +- lib_rend/ivas_efap_fx.c | 1 - lib_rend/ivas_hrtf_fx.c | 2 +- lib_rend/ivas_limiter_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 3 +- lib_rend/ivas_mcmasa_ana_fx.c | 3 +- lib_rend/ivas_objectRenderer_fx.c | 3 +- lib_rend/ivas_objectRenderer_hrFilt_fx.c | 3 +- lib_rend/ivas_objectRenderer_mix_fx.c | 3 +- lib_rend/ivas_objectRenderer_sfx_fx.c | 3 +- lib_rend/ivas_objectRenderer_sources_fx.c | 3 +- lib_rend/ivas_objectRenderer_vec_fx.c | 3 +- lib_rend/ivas_omasa_ana_fx.c | 3 +- lib_rend/ivas_output_init.c | 2 +- lib_rend/ivas_reflections_fx.c | 3 +- lib_rend/ivas_render_config_fx.c | 3 +- lib_rend/ivas_reverb_delay_line_fx.c | 3 +- lib_rend/ivas_reverb_fft_filter_fx.c | 3 +- lib_rend/ivas_reverb_filter_design_fx.c | 1 - lib_rend/ivas_reverb_fx.c | 3 +- lib_rend/ivas_reverb_iir_filter_fx.c | 3 +- lib_rend/ivas_reverb_utils_fx.c | 3 +- lib_rend/ivas_rotation_fx.c | 3 +- lib_rend/ivas_sba_rendering_fx.c | 1 - lib_rend/ivas_shoebox_fx.c | 1 - lib_rend/ivas_td_decorr_fx.c | 1 - lib_rend/ivas_vbap_fx.c | 3 +- lib_rend/lib_rend.c | 1 - lib_util/hrtf_file_reader.c | 3 +- lib_util/ls_custom_file_reader.c | 2 +- lib_util/mime_io.c | 2 +- lib_util/render_config_reader.c | 2 +- lib_util/rotation_file_reader.c | 1 - lib_util/vector3_pair_file_reader.c | 1 - 327 files changed, 990 insertions(+), 10601 deletions(-) delete mode 100644 lib_com/cng_exc.c delete mode 100644 lib_com/limit_t0.c delete mode 100644 lib_com/prot.h delete mode 100644 lib_enc/swb_tbe_enc.c diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 8c42f19ca..5b26a2911 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -138,7 +138,6 @@ - @@ -238,7 +237,6 @@ - @@ -324,7 +322,6 @@ - diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 8f2be8853..b9769e3ec 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -304,9 +304,6 @@ common_all_c - - common_all_c - common_all_c @@ -412,9 +409,6 @@ common_all_c - - common_all_c - common_all_c @@ -588,9 +582,6 @@ common_h - - common_h - common_h diff --git a/lib_com/ari_hm_fx.c b/lib_com/ari_hm_fx.c index 076bc8d92..46f8ecea1 100644 --- a/lib_com/ari_hm_fx.c +++ b/lib_com/ari_hm_fx.c @@ -10,7 +10,6 @@ #include "basop_util.h" #include "rom_com.h" #include "prot_fx.h" -#include "prot.h" #define GET_ADJ2( T, L, F ) ( ( ( L ) << ( F ) ) - ( T ) ) void UnmapIndex( diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index de22a7cf3..846b4dcea 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -6,7 +6,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "prot.h" #include "basop_util.h" #include "basop_proto_func.h" #include "cnst.h" diff --git a/lib_com/basop_tcx_utils.c b/lib_com/basop_tcx_utils.c index 378faae0f..8038c4f91 100644 --- a/lib_com/basop_tcx_utils.c +++ b/lib_com/basop_tcx_utils.c @@ -40,7 +40,7 @@ #include "cnst.h" #include "basop_proto_func.h" #include "stl.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #define WMC_TOOL_SKIP diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c index 92a8e3928..30ae2d47b 100644 --- a/lib_com/bitalloc_fx.c +++ b/lib_com/bitalloc_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ void bitalloc_fx( Word16 *y, /* i : reordered norm of sub-vectors Q0 */ diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index e5754fa35..9c0a53f8f 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -38,7 +38,6 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "stat_enc.h" #include "stat_dec.h" @@ -1884,7 +1883,7 @@ static void decision_matrix_core_dec( * Set up MDCT core switching if indicated in the bitstream *-------------------------------------------------------------------*/ -void mdct_switching_dec( +void mdct_switching_dec_ivas_fx( Decoder_State *st /* i/o: decoder state structure */ ) { diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 1907ef327..38195b65d 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -39,7 +39,6 @@ #include "options.h" #include #include "stat_dec.h" -#include "prot.h" #include "prot_fx.h" #include "rom_com.h" #include "rom_com_fx.h" diff --git a/lib_com/cng_exc.c b/lib_com/cng_exc.c deleted file mode 100644 index 494305e6f..000000000 --- a/lib_com/cng_exc.c +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -/*==================================================================================== - EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 - ====================================================================================*/ - -#include -#include "options.h" -#include -#include "cnst.h" -#include "prot.h" -#include "rom_com.h" -#include "wmc_auto.h" - -/*---------------------------------------------------------------------* - * Local constants - *---------------------------------------------------------------------*/ - -#define A2 0.2f -#define GAIN_VAR 0.000011f - - -/*-------------------------------------------------------* - * cng_params_upd() - * - * update CNG parameters - *-------------------------------------------------------*/ diff --git a/lib_com/codec_tcx_common.c b/lib_com/codec_tcx_common.c index f6da34b55..1ebc2829c 100644 --- a/lib_com/codec_tcx_common.c +++ b/lib_com/codec_tcx_common.c @@ -6,7 +6,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "basop_util.h" #include "rom_basop_util.h" diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index fdf935461..ed72605de 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -38,10 +38,9 @@ #include #include "options.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #define FSCALE_DENOM_BY_12800_Q15 1311 @@ -551,63 +550,6 @@ int16_t sr2fscale( return (int16_t) ( ( FSCALE_DENOM * sr_core ) / 12800 ); } -/*-------------------------------------------------------------------* - * getCoreSamplerateMode2_flt() - * - * - *-------------------------------------------------------------------*/ - -int32_t getCoreSamplerateMode2_flt( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ -) -{ - int32_t sr_core = 0; - - if ( bwidth == NB ) - { - sr_core = INT_FS_12k8; - } - else if ( element_mode == EVS_MONO && ( ( bwidth == WB && total_brate < ACELP_13k20 ) || ( bwidth == SWB && total_brate <= ACELP_13k20 ) || ( rf_mode == 1 ) ) ) - { - sr_core = INT_FS_12k8; - } - else if ( element_mode > EVS_MONO && flag_ACELP16k == 0 ) - { - sr_core = INT_FS_12k8; - } - else if ( bwidth == WB || ( bwidth == SWB && total_brate <= ACELP_32k ) || ( bwidth == FB && total_brate <= ACELP_32k ) ) - { - sr_core = INT_FS_16k; - } - else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format ) - { - sr_core = INT_FS_16k; - } - else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format ) - { - sr_core = INT_FS_16k; - } - else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format ) - { - sr_core = 25600; - } - else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) ) - { - sr_core = 25600; - } - else if ( bwidth == SWB || bwidth == FB ) - { - sr_core = 32000; - } - - return sr_core; -} - Word32 getCoreSamplerateMode2( const Word16 element_mode, /* i : IVAS element mode Q0*/ const Word32 total_brate, /* i : total bitrate Q0*/ diff --git a/lib_com/deemph.c b/lib_com/deemph.c index b2b43cf72..c03a050bc 100644 --- a/lib_com/deemph.c +++ b/lib_com/deemph.c @@ -36,9 +36,8 @@ #include #include "options.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" void deemph_fx_32( diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 9e6c450cd..edccca074 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -36,10 +36,9 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" /*-------------------------------------------------------------------------- * get_delay() diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index ba0973f97..1a01c2c32 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -36,7 +36,7 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #define WMC_TOOL_SKIP diff --git a/lib_com/enr_1_az.c b/lib_com/enr_1_az.c index 81fb78262..5c99cdfa5 100644 --- a/lib_com/enr_1_az.c +++ b/lib_com/enr_1_az.c @@ -37,9 +37,8 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" Word16 Enr_1_Az_fx_o( /* o : impulse response energy Q3 */ diff --git a/lib_com/env_adj.c b/lib_com/env_adj.c index 18520e188..5a83dbe5f 100644 --- a/lib_com/env_adj.c +++ b/lib_com/env_adj.c @@ -38,9 +38,8 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" /*--------------------------------------------------------------------------* * env_adj() diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index b80fd0a8b..a3140b4e4 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -39,11 +39,10 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" #include "stl.h" -#include "prot_fx.h" /*--------------------------------------------------------------------------* * Local constants *--------------------------------------------------------------------------*/ diff --git a/lib_com/env_stab_trans.c b/lib_com/env_stab_trans.c index 8c6ec265f..829bef5f4 100644 --- a/lib_com/env_stab_trans.c +++ b/lib_com/env_stab_trans.c @@ -38,10 +38,9 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" /*--------------------------------------------------------------------------* * env_stab_transient_detect() * diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index e04a13fdf..78809ed2c 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -12,7 +12,6 @@ #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#include "prot.h" #define FFT_SCALING_512 1073741824 // Q22 #define FFT_SCALING_640 1342177280 // Q22 diff --git a/lib_com/fft.c b/lib_com/fft.c index 352a24be9..e262f3909 100644 --- a/lib_com/fft.c +++ b/lib_com/fft.c @@ -39,7 +39,7 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index acadbb06b..73ff582df 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -44,7 +44,7 @@ #include "options.h" #include #include "cnst.h" -// #include "prot.h" +// #include "prot_fx.h" #include "prot_fx.h" //#include "cnst_fx.h" #include "rom_com.h" diff --git a/lib_com/fft_rel.c b/lib_com/fft_rel.c index 839b2faaf..1d020cabd 100644 --- a/lib_com/fft_rel.c +++ b/lib_com/fft_rel.c @@ -36,10 +36,9 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" /*---------------------------------------------------------------------* * Local constants diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index 12ed75f0a..bd9080a7b 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -38,9 +38,8 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/findpulse.c b/lib_com/findpulse.c index f2347d5b3..68853e061 100644 --- a/lib_com/findpulse.c +++ b/lib_com/findpulse.c @@ -37,10 +37,9 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" /*----------------------------------------------------------------------------------* * findpulse() diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 41d90359f..1f7c28fd8 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -3,7 +3,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #define WMC_TOOL_SKIP diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c index 4428c0796..68fdf33c3 100644 --- a/lib_com/frame_ener_fx.c +++ b/lib_com/frame_ener_fx.c @@ -38,9 +38,8 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" /*----------------------------------------------------------------------------------* * fer_energy() * diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c index d4c2413c3..8ec4f5a40 100644 --- a/lib_com/get_gain_fx.c +++ b/lib_com/get_gain_fx.c @@ -36,9 +36,8 @@ #include #include "options.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" /*----------------------------------------------------------------------------------* * get_gain() diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index eef3d50c6..0921dc88c 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -5,7 +5,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "ivas_prot.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ diff --git a/lib_com/gs_gains.c b/lib_com/gs_gains.c index 9adb448a4..8fa769475 100644 --- a/lib_com/gs_gains.c +++ b/lib_com/gs_gains.c @@ -39,7 +39,6 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_com/gs_preech_fx.c b/lib_com/gs_preech_fx.c index 2e9e5eb96..3b3eaa777 100644 --- a/lib_com/gs_preech_fx.c +++ b/lib_com/gs_preech_fx.c @@ -39,9 +39,8 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" /*-------------------------------------------------------------------* * Local constants diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 9820eb3c8..f5e7105cf 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -37,9 +37,8 @@ #include #include #include "options.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #define HP20_COEFF_SCALE ( 2 ) diff --git a/lib_com/hq2_core_com.c b/lib_com/hq2_core_com.c index bc4edb869..121dae06a 100644 --- a/lib_com/hq2_core_com.c +++ b/lib_com/hq2_core_com.c @@ -39,7 +39,7 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "basop_util.h" #include "basop_proto_func.h" #include "wmc_auto.h" diff --git a/lib_com/hq_conf.c b/lib_com/hq_conf.c index c139a493c..90a256cea 100644 --- a/lib_com/hq_conf.c +++ b/lib_com/hq_conf.c @@ -38,9 +38,8 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" void hq_configure_fx( diff --git a/lib_com/hq_tools_fx.c b/lib_com/hq_tools_fx.c index 4426f85d9..cf3ce202e 100644 --- a/lib_com/hq_tools_fx.c +++ b/lib_com/hq_tools_fx.c @@ -39,7 +39,6 @@ #include "rom_com.h" /* Static table prototypes FIP version */ #include "stl.h" /* required for wmc_tool */ #include "prot_fx.h" -#include "prot.h" #include "ivas_prot_fx.h" /*--------------------------------------------------------------------------* diff --git a/lib_com/ifft_rel.c b/lib_com/ifft_rel.c index 423eea46d..9e64a4e25 100644 --- a/lib_com/ifft_rel.c +++ b/lib_com/ifft_rel.c @@ -36,10 +36,9 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ diff --git a/lib_com/int_lsp.c b/lib_com/int_lsp.c index 0f673b8fd..570e9ebd9 100644 --- a/lib_com/int_lsp.c +++ b/lib_com/int_lsp.c @@ -37,10 +37,9 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" void int_lsp_fx( diff --git a/lib_com/interleave_spectrum.c b/lib_com/interleave_spectrum.c index 745ee6ac3..5c4c98e29 100644 --- a/lib_com/interleave_spectrum.c +++ b/lib_com/interleave_spectrum.c @@ -37,10 +37,9 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/interpol.c b/lib_com/interpol.c index 45021f1c2..a490a7552 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -36,10 +36,9 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "rom_com.h" -#include "prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_com/ivas_agc_com_fx.c b/lib_com/ivas_agc_com_fx.c index b2c09fa07..94e6b222f 100644 --- a/lib_com/ivas_agc_com_fx.c +++ b/lib_com/ivas_agc_com_fx.c @@ -38,7 +38,7 @@ #include "ivas_prot_fx.h" #include #include "wmc_auto.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" /*------------------------------------------------------------------------------------------* * Local constants diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 2f729bbd4..006a31177 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -33,9 +33,8 @@ #include #include "options.h" #include "wmc_auto.h" -#include "prot.h" -#include "ivas_prot.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "stat_dec.h" diff --git a/lib_com/ivas_avq_pos_reorder_com_fx.c b/lib_com/ivas_avq_pos_reorder_com_fx.c index ac539b787..25f8be3ad 100644 --- a/lib_com/ivas_avq_pos_reorder_com_fx.c +++ b/lib_com/ivas_avq_pos_reorder_com_fx.c @@ -32,7 +32,7 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /*-----------------------------------------------------------------* diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index 445ea8c78..acc0df821 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "ivas_prot.h" #include "wmc_auto.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 557db9696..9b60b2c5c 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -37,10 +37,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_com/ivas_entropy_coder_common_fx.c b/lib_com/ivas_entropy_coder_common_fx.c index d28828d6f..99381d19a 100644 --- a/lib_com/ivas_entropy_coder_common_fx.c +++ b/lib_com/ivas_entropy_coder_common_fx.c @@ -35,7 +35,7 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "math.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index 43f468fb0..883861024 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -34,13 +34,12 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_com/ivas_ism_com_fx.c b/lib_com/ivas_ism_com_fx.c index d3f18a795..f1201b06c 100644 --- a/lib_com/ivas_ism_com_fx.c +++ b/lib_com/ivas_ism_com_fx.c @@ -35,13 +35,12 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index 4d993d64f..7464c41c2 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -34,7 +34,7 @@ #include "math.h" #include "options.h" #include "ivas_stat_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_masa_com_fx.c b/lib_com/ivas_masa_com_fx.c index 35db926d0..fbe752aad 100644 --- a/lib_com/ivas_masa_com_fx.c +++ b/lib_com/ivas_masa_com_fx.c @@ -34,14 +34,13 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_rom_com_fx.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mc_com_fx.c b/lib_com/ivas_mc_com_fx.c index 88d6c1b5e..62d623b83 100644 --- a/lib_com/ivas_mc_com_fx.c +++ b/lib_com/ivas_mc_com_fx.c @@ -34,7 +34,7 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mc_param_com_fx.c b/lib_com/ivas_mc_param_com_fx.c index d69da849a..a54abe7ab 100644 --- a/lib_com/ivas_mc_param_com_fx.c +++ b/lib_com/ivas_mc_param_com_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_com.h" diff --git a/lib_com/ivas_mct_com_fx.c b/lib_com/ivas_mct_com_fx.c index b220d69a7..1f3c58153 100644 --- a/lib_com/ivas_mct_com_fx.c +++ b/lib_com/ivas_mct_com_fx.c @@ -34,7 +34,7 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_mdct_core_com_fx.c b/lib_com/ivas_mdct_core_com_fx.c index a5cfb8673..000f3992f 100644 --- a/lib_com/ivas_mdct_core_com_fx.c +++ b/lib_com/ivas_mdct_core_com_fx.c @@ -34,9 +34,8 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" /*--------------------------------------------------------------------------* diff --git a/lib_com/ivas_mdft_imdft_fx.c b/lib_com/ivas_mdft_imdft_fx.c index 0f24fba81..b10444307 100644 --- a/lib_com/ivas_mdft_imdft_fx.c +++ b/lib_com/ivas_mdft_imdft_fx.c @@ -33,14 +33,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" #include #include -#include "prot_fx.h" #include "debug.h" #include "ivas_rom_com_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_omasa_com_fx.c b/lib_com/ivas_omasa_com_fx.c index eb230b224..ef6350285 100644 --- a/lib_com/ivas_omasa_com_fx.c +++ b/lib_com/ivas_omasa_com_fx.c @@ -35,11 +35,10 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_rom_com.h" #include "rom_com.h" #include -#include "prot_fx.h" /*--------------------------------------------------------------- * Local constants diff --git a/lib_com/ivas_pca_tools_fx.c b/lib_com/ivas_pca_tools_fx.c index 5689e81c0..1e36c5e8e 100644 --- a/lib_com/ivas_pca_tools_fx.c +++ b/lib_com/ivas_pca_tools_fx.c @@ -38,7 +38,6 @@ #include #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index cbc67de00..79a585e8b 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -37,10 +37,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_com/ivas_qspherical_com_fx.c b/lib_com/ivas_qspherical_com_fx.c index 8ef48be2e..5caa850cb 100644 --- a/lib_com/ivas_qspherical_com_fx.c +++ b/lib_com/ivas_qspherical_com_fx.c @@ -37,12 +37,10 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index 94ceb8e3c..38785956c 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -37,7 +37,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index 788fb3c56..f35de8eb0 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 0ebae0de6..fc6e60310 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "basop_util.h" #include "ivas_stat_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" diff --git a/lib_com/ivas_spar_com_quant_util_fx.c b/lib_com/ivas_spar_com_quant_util_fx.c index 0f0e003dd..8292de5c1 100644 --- a/lib_com/ivas_spar_com_quant_util_fx.c +++ b/lib_com/ivas_spar_com_quant_util_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "math.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_stereo_dft_com_fx.c b/lib_com/ivas_stereo_dft_com_fx.c index 1157fffcf..80e64c0cc 100644 --- a/lib_com/ivas_stereo_dft_com_fx.c +++ b/lib_com/ivas_stereo_dft_com_fx.c @@ -36,7 +36,7 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_stereo_eclvq_com_fx.c b/lib_com/ivas_stereo_eclvq_com_fx.c index b4fb66429..d0ffff39c 100644 --- a/lib_com/ivas_stereo_eclvq_com_fx.c +++ b/lib_com/ivas_stereo_eclvq_com_fx.c @@ -37,7 +37,7 @@ #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /*--------------------------------------------------------------- diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c index 78a3c90ca..9aa880842 100644 --- a/lib_com/ivas_stereo_ica_com_fx.c +++ b/lib_com/ivas_stereo_ica_com_fx.c @@ -36,7 +36,6 @@ #include "options.h" #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_mdct_bands_com_fx.c b/lib_com/ivas_stereo_mdct_bands_com_fx.c index b1750fd16..c21abcf8c 100644 --- a/lib_com/ivas_stereo_mdct_bands_com_fx.c +++ b/lib_com/ivas_stereo_mdct_bands_com_fx.c @@ -37,9 +37,8 @@ #include "ivas_rom_com.h" #include "ivas_prot.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_com/ivas_stereo_psychlpc_com_fx.c b/lib_com/ivas_stereo_psychlpc_com_fx.c index 996b262db..cb3c39df2 100644 --- a/lib_com/ivas_stereo_psychlpc_com_fx.c +++ b/lib_com/ivas_stereo_psychlpc_com_fx.c @@ -34,7 +34,7 @@ #include "options.h" #include "ivas_rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_stereo_td_bit_alloc_fx.c b/lib_com/ivas_stereo_td_bit_alloc_fx.c index 14ab8131e..9074473d7 100644 --- a/lib_com/ivas_stereo_td_bit_alloc_fx.c +++ b/lib_com/ivas_stereo_td_bit_alloc_fx.c @@ -38,9 +38,8 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 9cd1a063e..e460637f7 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -34,11 +34,10 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #define ANGLE_90_DEG_Q22 377487360 diff --git a/lib_com/ivas_transient_det_fx.c b/lib_com/ivas_transient_det_fx.c index b5ea507eb..97025b46f 100644 --- a/lib_com/ivas_transient_det_fx.c +++ b/lib_com/ivas_transient_det_fx.c @@ -34,11 +34,10 @@ #include "options.h" #include "math.h" #include "wmc_auto.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_stat_com.h" /*------------------------------------------------------------------------------------------* diff --git a/lib_com/lag_wind.c b/lib_com/lag_wind.c index e0871fa70..9fb287271 100644 --- a/lib_com/lag_wind.c +++ b/lib_com/lag_wind.c @@ -37,7 +37,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 28719205a..4e306b936 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -36,154 +36,25 @@ #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" - /*-------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------*/ -static void lerp_proc_flt( const float *f, float *f_out, const int16_t bufferNewSize, const int16_t bufferOldSize ); - - /*-------------------------------------------------------------* * procedure lerp_flt() * * * * * *-------------------------------------------------------------*/ -void lerp_flt( - const float *f, - float *f_out, - const int16_t bufferNewSize, - const int16_t bufferOldSize_inp ) -{ - float maxFac; - int16_t bufferOldSize, tmpNewSize; - - maxFac = 507.0 / 128.0; - bufferOldSize = bufferOldSize_inp; - - if ( (float) bufferNewSize / bufferOldSize > maxFac ) - { - tmpNewSize = bufferOldSize * 2; - while ( bufferNewSize > bufferOldSize ) - { - if ( (float) bufferNewSize / bufferOldSize <= maxFac ) - { - tmpNewSize = bufferNewSize; - } - - lerp_proc_flt( f, f_out, tmpNewSize, bufferOldSize ); - - f = f_out; - bufferOldSize = tmpNewSize; - tmpNewSize *= 2; - } - } - else if ( (float) bufferOldSize / bufferNewSize > maxFac ) - { - tmpNewSize = bufferOldSize / 2; - while ( bufferNewSize < bufferOldSize ) - { - if ( (float) bufferOldSize / bufferNewSize <= maxFac ) - { - tmpNewSize = bufferNewSize; - } - - lerp_proc_flt( f, f_out, tmpNewSize, bufferOldSize ); - - f = f_out; - bufferOldSize = tmpNewSize; - tmpNewSize /= 2; - } - } - else - { - lerp_proc_flt( f, f_out, bufferNewSize, bufferOldSize ); - } - - return; -} - /*-------------------------------------------------------------* * procedure lerp_proc_flt() * * * * * *-------------------------------------------------------------*/ -static void lerp_proc_flt( - const float *f, - float *f_out, - const int16_t bufferNewSize, - const int16_t bufferOldSize ) -{ - int16_t i, idx; - float pos, shift, diff; - float buf[2 * L_FRAME_MAX]; - Word16 tmp; - - if ( bufferNewSize == bufferOldSize ) - { - mvr2r( f, buf, bufferNewSize ); - mvr2r( buf, f_out, bufferNewSize ); - return; - } - - /* Using the basop code to avoid reading beyond end of input for bufferOldSize=320, bufferNewSize=640 */ - tmp = div_s( bufferOldSize, shl( bufferNewSize, 4 ) ); - shift = (float) ( L_shl( L_deposit_l( tmp ), 4 - 15 + 16 ) ) / 65536.0f; - pos = 0.5f * shift - 0.5f; - - if ( shift < 0.3f ) - { - pos = pos - 0.13f; - } - - /* first point of interpolation */ - if ( pos < 0 ) - { - buf[0] = f[0] + pos * ( f[1] - f[0] ); - } - else - { - idx = (int16_t) pos; - diff = pos - idx; - buf[0] = f[idx] + diff * ( f[idx + 1] - f[idx] ); - } - - pos += shift; - - for ( i = 1; i < bufferNewSize - 1; i++ ) - { - idx = (int16_t) pos; - diff = pos - idx; - - buf[i] = f[idx] + diff * ( f[idx + 1] - f[idx] ); - pos += shift; - } - - - /* last point */ - idx = (int16_t) pos; - - if ( pos > bufferOldSize - 1 ) - { - idx = bufferOldSize - 2; - } - - diff = pos - idx; - - buf[bufferNewSize - 1] = f[idx] + diff * ( f[idx + 1] - f[idx] ); - - mvr2r( buf, f_out, bufferNewSize ); - - return; -} - - /*-------------------------------------------------------------* * Local constants *-------------------------------------------------------------*/ diff --git a/lib_com/limit_t0.c b/lib_com/limit_t0.c deleted file mode 100644 index d49cad283..000000000 --- a/lib_com/limit_t0.c +++ /dev/null @@ -1,231 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -/*==================================================================================== - EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 - ====================================================================================*/ - -#include -#include "options.h" -#include "cnst.h" -#include "prot.h" -#include "wmc_auto.h" - -/*-------------------------------------------------* - * Local constants - *-------------------------------------------------*/ - -#define LIMIT_PIT_REL_LOWER 2 /* delta interval to extend pitch coding in relative Q */ -#define LIMIT_PIT_REL_UPPER 0 - -/*-------------------------------------------------* - * limit_T0() - * - * Close-loop pitch lag search limitation - *-------------------------------------------------*/ - -void limit_T0( - const int16_t L_frame, /* i : length of the frame */ - const int16_t delta, /* i : Half the close-loop searched interval */ - const int16_t pit_flag, /* i : selecting absolute(0) or delta(1) pitch quantization */ - const int16_t limit_flag, /* i : flag for Q limits (0=restrained, 1=extended) */ - const int16_t T0, /* i : rough pitch estimate around which the search is done */ - const int16_t T0_frac, /* i : pitch estimate fractional part */ - int16_t *T0_min, /* o : lower pitch limit */ - int16_t *T0_max /* o : higher pitch limit */ -) -{ - int16_t delta2, T1; - int16_t pit_min, pit_max; - - if ( limit_flag == 0 ) /* restrained Q limits */ - { - /* set limits */ - if ( L_frame == L_FRAME ) - { - pit_max = PIT_MAX; - pit_min = PIT_MIN; - } - else /* L_frame == L_FRAME16k */ - { - pit_max = PIT16k_MAX; - pit_min = PIT16k_MIN; - } - - delta2 = 2 * delta - 1; - - T1 = T0; - if ( T0_frac >= 2 ) - { - T1++; - } - *T0_min = T1 - delta; - - if ( *T0_min < pit_min ) - { - *T0_min = pit_min; - } - *T0_max = *T0_min + delta2; - - if ( *T0_max > pit_max ) - { - *T0_max = pit_max; - *T0_min = *T0_max - delta2; - } - } - else /* extended Q limits */ - { - - /* set limits */ - if ( L_frame == L_FRAME ) - { - pit_max = PIT_MAX; - pit_min = PIT_MIN_EXTEND; - - if ( limit_flag == 2 ) - { - pit_min = PIT_MIN_DOUBLEEXTEND; - } - } - else /* L_frame == L_FRAME16k */ - { - pit_max = PIT16k_MAX; - pit_min = PIT16k_MIN_EXTEND; - } - - delta2 = 2 * delta - 1; - - T1 = T0; - if ( T0_frac >= 2 ) - { - T1++; - } - *T0_min = T1 - delta; - - if ( pit_flag == 0 ) - { - /* subframes with absolute search: keep Q range */ - if ( *T0_min < pit_min ) - { - *T0_min = pit_min; - } - *T0_max = *T0_min + delta2; - - if ( *T0_max > pit_max ) - { - *T0_max = pit_max; - *T0_min = *T0_max - delta2; - } - } - else - { - /* subframes with relative search: extend Q range */ - if ( *T0_min < pit_min - LIMIT_PIT_REL_LOWER ) - { - *T0_min = pit_min - LIMIT_PIT_REL_LOWER; - } - - if ( *T0_min < L_INTERPOL ) - { - *T0_min = L_INTERPOL; - } - *T0_max = *T0_min + delta2; - - if ( *T0_max > pit_max + LIMIT_PIT_REL_UPPER ) - { - *T0_max = pit_max + LIMIT_PIT_REL_UPPER; - *T0_min = *T0_max - delta2; - } - } - } - - return; -} - - -/*-------------------------------------------------* - * Routine limit_T0_voiced_ivas() - * - * Close-loop pitch lag search limitation - *-------------------------------------------------*/ - -void limit_T0_voiced_ivas( - const int16_t nbits, - const int16_t res, - const int16_t T0, /* i : rough pitch estimate around which the search is done */ - const int16_t T0_frac, /* i : pitch estimate fractional part */ - const int16_t T0_res, /* i : pitch resolution */ - int16_t *T0_min, /* o : lower pitch limit */ - int16_t *T0_min_frac, /* o : lower pitch limit */ - int16_t *T0_max, /* o : higher pitch limit */ - int16_t *T0_max_frac, /* o : higher pitch limit */ - const int16_t pit_min, /* i : Minimum pitch lag */ - const int16_t pit_max /* i : Maximum pitch lag */ -) -{ - int16_t T1, temp1, temp2; - - /* Mid-point */ - T1 = T0; - if ( ( T0_res > 1 ) && ( T0_frac >= ( T0_res >> 1 ) ) ) - { - T1++; - } - - /* Lower-bound */ - temp1 = ( T1 * res ) - ( 1 << ( nbits - 1 ) ); - temp2 = temp1 / res; - *T0_min = temp2; - *T0_min_frac = temp1 - temp2 * res; - if ( *T0_min < pit_min ) - { - *T0_min = pit_min; - *T0_min_frac = 0; - } - - /* Higher-bound */ - temp1 = ( *T0_min * res ) + *T0_min_frac + ( 1 << nbits ) - 1; - temp2 = temp1 / res; - *T0_max = temp2; - *T0_max_frac = temp1 - temp2 * res; - if ( *T0_max > pit_max ) - { - *T0_max = pit_max; - *T0_max_frac = res - 1; - temp1 = ( *T0_max * res ) + *T0_max_frac - ( 1 << nbits ) + 1; - temp2 = temp1 / res; - *T0_min = temp2; - *T0_min_frac = temp1 - temp2 * res; - } - - return; -} diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 66c5dd15e..8946e41aa 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -37,10 +37,9 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 61ead2bf2..4f493cacd 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -6,10 +6,9 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* * Local constants diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index 1b2836252..7ed3cb59b 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -38,10 +38,9 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" void Interpolate_allpass_steep_32( diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 34e2083b9..a15b11611 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -38,10 +38,9 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index d97830a5f..10e560433 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "stl.h" diff --git a/lib_com/preemph.c b/lib_com/preemph.c index 490a18aef..9ebc0f72a 100644 --- a/lib_com/preemph.c +++ b/lib_com/preemph.c @@ -36,7 +36,7 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /*-------------------------------------------------------------* diff --git a/lib_com/prot.h b/lib_com/prot.h deleted file mode 100644 index f5d69075e..000000000 --- a/lib_com/prot.h +++ /dev/null @@ -1,8340 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -/*==================================================================================== - EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 - ====================================================================================*/ - -#ifndef PROT_H -#define PROT_H - -#include -#include -#include -#include "options.h" -#include "typedef.h" -#include "stat_enc.h" -#include "stat_dec.h" -#include "stat_com.h" -#include "ivas_stat_com.h" -#include "ivas_stat_enc.h" -#include "ivas_stat_dec.h" -#include "cnst.h" -#include "stl.h" -#include "ivas_error_utils.h" - - -/*----------------------------------------------------------------------------------* - * Prototypes of global macros - *----------------------------------------------------------------------------------*/ - -#ifndef min -#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) -#endif - -#ifndef max -#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) -#endif - -#ifndef TRUNC -#define TRUNC( x ) ( (int16_t) ( ( ( x ) >= 32767. ? 32767 : ( ( x ) <= -32768. ? -32768 : ( x ) ) ) + 0.5 ) ) -#endif - -#define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) -#define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) - -#ifndef ABSVAL -#define ABSVAL( a ) ( ( a ) >= 0 ? ( a ) : ( -( a ) ) ) -#endif - -#ifndef SQR -#define SQR( a ) ( ( a ) * ( a ) ) -#endif - -#ifndef SWAP -#define SWAP( a, b ) \ - { \ - tempr = ( a ); \ - ( a ) = ( b ); \ - ( b ) = tempr; \ - } -#endif - -#ifndef swap -#define swap( x, y, type ) \ - { \ - type u__p; \ - u__p = x; \ - x = y; \ - y = u__p; \ - } -#endif - -#define set_max( a, b ) \ - { \ - if ( ( b ) > *a ) \ - { \ - *a = ( b ); \ - } \ - } /* If the first argument is already the highes or lowest, nothing is done. */ -#define set_min( a, b ) \ - { \ - if ( ( b ) < *a ) \ - { \ - *a = ( b ); \ - } \ - } /* Otherwise, the 2nd arg is stored at the address of the first arg. */ - - -/*----------------------------------------------------------------------------------* - * MODE1 prototypes - *----------------------------------------------------------------------------------*/ - -/*! r: inverse square root of input value */ -float inv_sqrt( - const float x /* i : input value */ -); - -/*! r: output random value */ -int16_t own_random( - int16_t *seed /* i/o: random seed */ -); - -/*! r: sign of x (+1/-1) */ -float sign( - const float x /* i : input value of x */ -); - -/*! r: logarithm2 of x */ -float log2_f( - const float x /* i : input value of x */ -); - -int16_t norm_ul_float( - uint32_t UL_var1 ); - -/*! r: sum of all vector elements */ -int16_t sum_s( - const int16_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: sum of all vector elements */ -int32_t sum_l( - const int32_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: sum of all vector elements */ -float sum_f( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: sum of all squared vector elements */ -float sum2_f( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -void set_c( - int8_t y[], /* i/o: Vector to set */ - const int8_t a, /* i : Value to set the vector to */ - const int32_t N /* i : Length of the vector */ -); - -void set_s( - int16_t y[], /* i/o: Vector to set */ - const int16_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ -); - -void set_l( - int32_t y[], /* i/o: Vector to set */ - const int32_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Length of the vector */ -); - -void set_f( - float y[], /* i/o: Vector to set */ - const float a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ -); - -void set_zero_fx( - Word32 *vec, /* o : input vector */ - const Word16 lvec /* i : length of the vector */ -); -void set_zero2_fx( - Word32 *vec, /* o : input vector */ - const Word32 lvec /* i : length of the vector */ -); -void set16_zero_fx( - Word16 *vec, /* o : input vector */ - const Word16 lvec /* i : length of the vector */ -); - -void set_zero( - float *vec, /* o : input vector */ - const int16_t lvec /* i : length of the vector */ -); - -void mvr2r( - const float x[], /* i : input vector */ - float y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -void mvs2s( - const int16_t x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -uint32_t mvr2s( - const float x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -void mvs2r( - const int16_t x[], /* i : input vector */ - float y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -void mvl2l( - const int32_t x[], /* i : input vector */ - int32_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - - -/*! r: index of the maximum value in the input vector */ -int16_t maximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ -); -/*! r: index of the maximum value in the input vector */ -int16_t maximumAbs( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ -); - -Word16 maximumAbs_l( - const Word32 *vec, /* i : input vector */ - const Word16 lvec, /* i : length of input vector */ - Word32 *max_val /* o : maximum value in the input vector */ -); - -/*! r: index of the minimum value in the input vector */ -int16_t minimum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *min_val /* o : minimum value in the input vector */ -); - -/*! r: index of the minimum value in the input vector */ -int16_t minimum_s( - const int16_t *vec, /* i : Input vector */ - const int16_t lvec, /* i : Vector length */ - int16_t *min_val /* o : minimum value in the input vector */ -); - -/*! r: return index with max energy value in vector */ -int16_t emaximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *ener_max /* o : maximum energy value */ -); - -/*! r: vector mean */ -float mean( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: dot product of x[] and y[] */ -float dotp( - const float x[], /* i : vector x[] */ - const float y[], /* i : vector y[] */ - const int16_t n /* i : vector length */ -); - -void conv( - const float x[], /* i : input vector */ - const float h[], /* i : impulse response (or second input vector) */ - float y[], /* o : output vetor (result of convolution) */ - const int16_t L /* i : vector size */ -); - -void fir( - const float x[], /* i : input vector */ - const float h[], /* i : impulse response of the FIR filter */ - float y[], /* o : output vector (result of filtering) */ - float mem[], /* i/o: memory of the input signal (M samples) */ - const int16_t L, /* i : input vector size */ - const int16_t K, /* i : order of the FIR filter (M+1 coefs.) */ - const int16_t upd /* i : 1 = update the memory, 0 = not */ -); - -void v_add( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 + vector 2 */ - const int16_t N /* i : Vector length */ -); - -void v_sub( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 - vector 2 */ - const int16_t N /* i : Vector length */ -); - -void v_mult( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 .* vector 2*/ - const int16_t N /* i : Vector length */ -); - -void v_multc( - const float x[], /* i : Input vector */ - const float c, /* i : Constant */ - float y[], /* o : Output vector that contains c*x */ - const int16_t N /* i : Vector length */ -); - -/*! r: index of the winning codeword */ -int16_t squant( - const float x, /* i : scalar value to quantize */ - float *xq, /* o : quantized value */ - const float cb[], /* i : codebook */ - const int16_t cbsize /* i : codebook size */ -); - -int16_t squant_int( - uint8_t x, /* i : scalar value to quantize */ - uint8_t *xq, /* o : quantized value */ - const uint8_t *cb, /* i : codebook */ - const int16_t cbsize /* i : codebook size */ -); - -/*! r: index of the winning codevector */ -int16_t vquant( - float x[], /* i : vector to quantize */ - const float x_mean[], /* i : vector mean to subtract (0 if none) */ - float xq[], /* o : quantized vector */ - const float cb[], /* i : codebook */ - const int16_t dim, /* i : dimension of codebook vectors */ - const int16_t cbsize /* i : codebook size */ -); - -/*! r: index of the winning codevector */ -int16_t w_vquant( - float x[], /* i : vector to quantize */ - const float x_mean[], /* i : vector mean to subtract (0 if none) */ - const int16_t weights[], /* i : error weights */ - float xq[], /* o : quantized vector */ - const float cb[], /* i : codebook */ - const int16_t dim, /* i : dimension of codebook vectors */ - const int16_t cbsize, /* i : codebook size */ - const int16_t reverse /* i : reverse codebook vectors */ -); - -/*! r: index of the winning codeword */ -int16_t usquant( - const float x, /* i : scalar value to quantize */ - float *xq, /* o : quantized value */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta, /* i : quantization step */ - const int16_t cbsize /* i : codebook size */ -); - -/*! r: dequanzited gain */ -float usdequant( - const int16_t idx, /* i : quantizer index */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta /* i : quantization step */ -); - -void v_sort_float( - float *r, /* i/o: Vector to be sorted in place */ - const int16_t lo, /* i : Low limit of sorting range */ - const int16_t up /* i : High limit of sorting range */ -); - -void sort( - uint16_t *x, /* i/o: Vector to be sorted */ - uint16_t len /* i/o: vector length */ -); - -void sort_l( - Word32 *x, /* i/o: Vector to be sorted */ - Word16 len /* i/o: vector length */ -); - -/*! r: variance of vector */ -float var( - const float *x, /* i : input vector */ - const int16_t len /* i : length of inputvector */ -); - -/*! r: standard deviation */ -float std_dev( - const float *x, /* i : input vector */ - const int16_t len /* i : length of the input vector */ -); - -/*! r: the dot product x'*A*x */ -float dot_product_mat( - const float *x, /* i : vector x */ - const float *A, /* i : matrix A */ - const int16_t m /* i : vector length */ -); - -float root_a( - float a ); - -float root_a_over_b( - float a, - float b ); - -void polezero_filter( - const float *in, /* i : input vector */ - float *out, /* o : output vector */ - const int16_t N, /* i : input vector size */ - const float *b, /* i : numerator coefficients */ - const float *a, /* i : denominator coefficients */ - const int16_t order, /* i : filter order */ - float *mem /* i/o: filter memory */ -); - -double rint_new( - double x /* i/o: Round to the nearest integer with mid point exception */ -); - -double anint( - double x /* i/o: Round to the nearest integer */ -); - -/*! r: Output either 1 if Numeric, 0 if NaN or Inf */ -int16_t is_numeric_float( - float x /* i : Input value which is checked if numeric or not */ -); - -void delay_signal_float( - float x[], /* i/o: signal to be delayed */ - const int16_t len, /* i : length of the input signal */ - float mem[], /* i/o: synchronization memory */ - const int16_t delay /* i : delay in samples */ -); - -ivas_error push_indice( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t id, /* i : ID of the indice */ - uint16_t value, /* i : value of the quantized indice */ - int16_t nb_bits /* i : number of bits used to quantize the indice */ -); - -ivas_error push_next_indice( - BSTR_ENC_HANDLE hBstr, - UWord16 value, /* i : value of the quantized indice */ - Word16 nb_bits /* i : number of bits used to quantize the indice */ -); - -ivas_error push_next_bits( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */ - const Word16 nb_bits /* i : number of bits to pack */ -); - -/*! r: maximum number of indices */ -Word16 get_ivas_max_num_indices_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); - -/*! r: maximum number of indices */ -int16_t get_BWE_max_num_indices( - const int32_t extl_brate /* i : extensiona layer bitrate */ -); - -/*! r: maximum number of indices */ -Word16 get_ivas_max_num_indices_metadata_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); -ivas_error ind_list_realloc( - INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ - const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ - Encoder_Struct *st_ivas /* i : IVAS encoder structure */ -); - -ivas_error check_ind_list_limits( - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -); - -void move_indices( - INDICE_HANDLE old_ind_list, /* i/o: old location of indices */ - INDICE_HANDLE new_ind_list, /* i/o: new location of indices */ - const int16_t nb_indices /* i : number of moved indices */ -); - -/*! r: index of the indice in the list, -1 if not found */ -int16_t find_indice( - BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - const int16_t id, /* i : ID of the indice */ - uint16_t *value, /* o : value of the quantized indice */ - int16_t *nb_bits /* o : number of bits used to quantize the indice */ -); - -/*! r: number of deleted indices */ -uint16_t delete_indice( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t id /* i : ID of the indice */ -); - -/*! r: value of the indice */ -uint16_t get_next_indice( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ -); - -/*! r: value of the indice */ -uint16_t get_next_indice_1( - Decoder_State *st /* i/o: decoder state structure */ -); - -void get_next_indice_tmp( - Decoder_State *st, /* o : decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ -); - -/*! r: value of the indice */ -uint16_t get_indice( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t pos, /* i : absolute position in the bitstream */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ -); - -/*! r: value of the indice */ -uint16_t get_indice_1( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t pos /* i : absolute position in the bitstream */ -); - -void reset_indices_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t max_num_indices /* i : max number of indices */ -); - -void reset_indices_dec( - Decoder_State *st /* i/o: decoder state structure */ -); - -ivas_error write_indices_ivas( - Encoder_Struct *st_ivas, /* i/o: encoder state structure */ - uint16_t *bit_stream, /* i/o: output bitstream */ - uint16_t *num_bits /* i/o: number of bits written to output */ -); - -Word16 rate2EVSmode_float( - const Word32 brate, /* i : bitrate */ - int16_t *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ -); - - -/*! r: 1 = OK, 0 = something wrong */ -ivas_error read_indices( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t bit_stream[], /* i : bitstream buffer */ - UWord16 num_bits, /* i : number of bits in bitstream */ - int16_t *prev_ft_speech, - int16_t *CNG, - int16_t bfi /* i : bad frame indicator */ -); - - -void ivas_set_bitstream_pointers( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -Decoder_State **reset_elements( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - - -void convertSerialToBytestream( - const uint16_t *const serial, /* i : input serial bitstream with values 0 and 1 */ - const uint16_t num_bits, /* i : number of bits in the input bitstream */ - uint8_t *const bytestream /* o : output compact bitstream (bytestream) */ -); - -void convertBytestreamToSerial( - const uint8_t *const bytestream, /* i : input compact bitstream (bytestream) */ - const uint16_t num_bits, /* i : number of bits in the input bitstream */ - uint16_t *const serial /* o : output serial bitstream with values 0 and 1 */ -); - -void mdct_switching_dec( - Decoder_State *st /* i/o: decoder state structure */ -); - -void evs_dec_previewFrame_float( - uint8_t *bitstream, /* i : bitstream pointer */ - int16_t bitstreamSize, /* i : bitstream size */ - int16_t *partialCopyFrameType, /* o : frame type of the partial copy */ - int16_t *partialCopyOffset /* o : offset of the partial copy relative to the primary copy */ -); - - -void getPartialCopyInfo_float( - Decoder_State *st, /* i : decoder state structure */ - int16_t *sharpFlag ); - -void get_NextCoderType( - uint8_t *bitstream, /* i : bitstream */ - int16_t *next_coder_type /* o : next coder type */ -); - -int16_t print_disclaimer( - FILE *fPtr ); - - -/*! r: delay value in ns */ -int32_t get_delay( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t io_fs, /* i : input/output sampling frequency */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ -); - -void decision_matrix_enc( - Encoder_State *st, /* i/o: encoder state structure */ - int16_t *hq_core_type /* o : HQ core type */ -); - -void signaling_enc( - Encoder_State *st /* i : encoder state structure */ -); - -int16_t signaling_mode1_tcx20_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t push /* i : flag to push indice */ -); - -void decision_matrix_dec( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t *sharpFlag, /* o : formant sharpening flag */ - int16_t *hq_core_type, /* o : HQ core type */ - int16_t *core_switching_flag /* o : ACELP->HQ switching frame flag */ -); - - -void amr_wb_dec_init( - AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ -); - -void hf_synth_amr_wb_init( - AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ -); - -void hf_synth_amr_wb_reset( - AMRWB_IO_DEC_HANDLE hAmrwb_IO, /* i/o: AMR-WB IO data handle */ - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ -); - -void hf_synth_amr_wb( - AMRWB_IO_DEC_HANDLE hAmrwb_IO, /* i/o: AMR-WB IO data handle */ - ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t output_frame, /* i : output frame length */ - const float *Aq, /* i : quantized Az */ - const float *exc, /* i : excitation at 12.8 kHz */ - float *synth, /* i/o: synthesis signal at 12.8 kHz */ - int16_t *amr_io_class, /* i : signal class (determined by FEC algorithm) */ - float *synth_out, /* i/o: synthesis signal at output Fs */ - float fmerit, /* i : classify parameter from FEC */ - const int16_t *hf_gain, /* i : decoded HF gain */ - const float *voice_factors, /* i : voicing factors */ - const float pitch_buf[], /* i : pitch buffer */ - const float ng_ener_ST, /* i : Noise gate - short-term energy */ - const float *lsf_new /* i : ISF vector */ -); - -void hf_cod_init( - float *mem_hp400_enc, /* o : memory of hp 400 Hz filter */ - float *mem_hf1_enc, /* o : HF band-pass filter memory */ - float *mem_syn_hf_enc, /* o : HF synthesis memory */ - float *mem_hf2_enc, /* o : HF band-pass filter memory */ - float *gain_alpha /* o : smoothing gain for transitions between active and inactive frames */ -); - -void hf_cod( - const int32_t core_brate, /* i : core bitrate */ - const float *speech16k, /* i : original speech at 16 kHz */ - const float Aq[], /* i : quantized Aq */ - const float exc[], /* i : excitation at 12.8 kHz */ - float synth[], /* i : 12.8kHz synthesis signal */ - int16_t *seed2_enc, /* i/o: random seed for HF noise gen */ - float *mem_hp400_enc, /* i/o: memory of hp 400 Hz filter */ - float *mem_syn_hf_enc, /* i/o: HF synthesis memory */ - float *mem_hf1_enc, /* i/o: HF band-pass filter memory */ - float *mem_hf2_enc, /* i/o: HF band-pass filter memory */ - const int16_t *dtxHangoverCount, - float *gain_alpha, /* i/o: smoothing gain for transitions between active and inactive frames */ - int16_t *hf_gain /* o : HF gain to be transmitted to decoder */ -); - -void hf_synth_init( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ -); - -void hf_synth_reset( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ -); - -void hf_synth( - ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t output_frame, /* i : output frame length */ - const float *Aq, /* i : quantized Az */ - const float *exc, /* i : excitation at 12.8 kHz */ - float *synth, /* i/o: 12.8kHz synthesis signal */ - float *synth16k /* i/o: 16kHz synthesis signal */ -); - -void fft_rel( - float x[], /* i/o: input/output vector */ - const int16_t n, /* i : vector length */ - const int16_t m /* i : log2 of vector length */ -); - -void ifft_rel( - float io[], /* i/o: input/output vector */ - const int16_t n, /* i : vector length */ - const int16_t m /* i : log2 of vector length */ -); - -void preemph( - float *signal, /* i/o: signal */ - const float mu, /* i : preemphasis factor */ - const int16_t L, /* i : vector size */ - float *mem /* i/o: memory (x[-1]) */ -); -void preemph_ivas_fx( - Word32 *signal, /* i/o: signal Qx*/ - const Word16 mu, /* i : preemphasis factor Q15*/ - const Word16 L, /* i : vector size Q0*/ - Word32 *mem /* i/o: memory (x[-1]) Qx*/ -); - -void cb_shape( - const int16_t preemphFlag, /* i : flag for pre-emphasis */ - const int16_t pitchFlag, /* i : flag for pitch sharpening */ - const int16_t scramblingFlag, /* i : flag for phase scrambling */ - const int16_t formantFlag, /* i : flag for formant sharpening */ - const int16_t formantTiltFlag, /* i : flag for formant tilt */ - const float g1, /* i : formant sharpening numerator weighting */ - const float g2, /* i : formant sharpening denominator weighting */ - const float *p_Aq, /* i : LP filter coefficients */ - float *code, /* i/o: signal to shape */ - const float tilt_code, /* i : tilt of code */ - const float pt_pitch, /* i : pointer to current subframe fractional pitch*/ - const int16_t L_subfr /* i : subfframe length */ -); - -void CNG_exc( - const int32_t core_brate, /* i : core bitrate */ - const int16_t L_frame, /* i : length of the frame */ - float *Enew, /* i/o: decoded SID energy */ - int16_t *seed, /* i/o: random generator seed */ - float exc[], /* o : current non-enhanced excitation */ - float exc2[], /* o : current enhanced excitation */ - float *lp_ener, /* i/o: LP filtered E */ - const int32_t last_core_brate, /* i : previous frame core bitrate */ - int16_t *first_CNG, /* i/o: first CNG frame flag for energy init. */ - int16_t *cng_ener_seed, /* i/o: random generator seed for CNG energy */ - float bwe_exc[], /* o : excitation for SWB TBE */ - const int16_t allow_cn_step, /* i : allow CN step */ - int16_t *last_allow_cn_step, /* i/o: last CN_step */ - const int16_t num_ho, /* i : number of selected hangover frames */ - float q_env[], - float *lp_env, - float *old_env, - float *exc_mem, - float *exc_mem1, - int16_t *sid_bw, - int16_t *cng_ener_seed1, - float exc3[], - const int16_t Opt_AMR_WB, /* i : AMR-WB interop flag */ - const int16_t element_mode /* i : IVAS Element mode */ -); - - -void cng_params_postupd( - const int16_t ho_circ_ptr, /* i : pointer for CNG averaging buffers */ - int16_t *cng_buf_cnt, /* i/o: counter for CNG store buffers */ - const float *cng_exc2_buf, /* i : Excitation buffer */ - const int32_t *cng_brate_buf, /* i : bitrate buffer */ - float ho_env_circ[], /* i/o: Envelope buffer */ - const int16_t element_mode, /* i : Element mode */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void calculate_hangover_attenuation_gain( - Encoder_State *st, /* i : encoder state structure */ - float *att, /* o : attenuation factor */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -int16_t get_cng_mode_ivas( - const int32_t last_active_brate /* i : last active bitrate */ -); - -void disf_ns_28b( - int16_t *indice, /* i : quantized indices, use indice[0] = -1 in the decoder*/ - float *isf_q /* o : ISF in the frequency domain (0..6400) */ -); - -void limit_T0( - const int16_t L_frame, /* i : length of the frame */ - const int16_t delta, /* i : Half the close-loop searched interval */ - const int16_t pit_flag, /* i : selecting absolute(0) or delta(1) pitch quantization */ - const int16_t limit_flag, /* i : flag for limits (0=restrained, 1=extended) */ - const int16_t T0, /* i : rough pitch estimate around which the search is done */ - const int16_t T0_frac, /* i : pitch estimate fractional part */ - int16_t *T0_min, /* o : lower pitch limit */ - int16_t *T0_max /* o : higher pitch limit */ -); - -/*! r: interpolated value */ -float interpolation( - const float *x, /* i : input vector */ - const float *win, /* i : interpolation window */ - const int16_t frac, /* i : fraction */ - const int16_t up_samp, /* i : upsampling factor */ - const int16_t nb_coef /* i : nb of filter coef */ -); - -void deemph( - float *signal, /* i/o: signal */ - const float mu, /* i : deemphasis factor */ - const int16_t L, /* i : vector size */ - float *mem /* i/o: memory (y[-1]) */ -); - -void weight_a( - const float *a, /* i : LP filter coefficients */ - float *ap, /* o : weighted LP filter coefficients */ - const float gamma, /* i : weighting factor */ - const int16_t m /* i : order of LP filter */ -); - -void weight_a_subfr( - const int16_t nb_subfr, /* i : number of subframes */ - const float *a, /* i : LP filter coefficients */ - float *ap, /* o : weighted LP filter coefficients */ - const float gamma, /* i : weighting factor */ - const int16_t m /* i : order of LP filter */ -); - -void syn_12k8( - const int16_t L_frame, /* i : length of the frame */ - const float *Aq, /* i : LP filter coefficients */ - const float *exc, /* i : input signal */ - float *synth, /* o : output signal */ - float *mem, /* i/o: initial filter states */ - const int16_t update_m /* i : update memory flag: 0 --> no memory update */ -); /* 1 --> update of memory */ - -void syn_filt( - const float a[], /* i : LP filter coefficients */ - const int16_t m, /* i : order of LP filter */ - const float x[], /* i : input signal */ - float y[], /* o : output signal */ - const int16_t l, /* i : size of filtering */ - float mem[], /* i/o: initial filter states */ - const int16_t update_m /* i : update memory flag: 0 --> no memory update */ -); /* 1 --> update of memory */ - -void synth_mem_updt2_flt( - const int16_t L_frame, /* i : frame length */ - const int16_t last_L_frame, /* i : frame length */ - float old_exc[], /* i/o: excitation buffer */ - float mem_syn_r[], /* i/o: synthesis filter memory */ - float mem_syn2[], /* o : synthesis filter memory for find_target */ - float mem_syn[], /* o : synthesis filter memory for find_target */ - const int16_t dec /* i : flag for decoder indication */ -); - -void int_lsp( - const int16_t L_frame, /* i : length of the frame */ - const float lsp_old[], /* i : LSPs from past frame */ - const float lsp_new[], /* i : LSPs from present frame */ - float *Aq, /* o : LP coefficients in both subframes */ - const int16_t m, /* i : order of LP filter */ - const float *int_coeffs, /* i : interpolation coefficients */ - const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ -); - -void int_lsp4( - const int16_t L_frame, /* i : length of the frame */ - const float lsp_old[], /* i : previous end-frame LSPs */ - const float lsp_mid[], /* i : current mid-frame LSPs */ - const float lsp_new[], /* i : current end-frame LSPs */ - float *Aq, /* o : LP coefficients in both subframes */ - const int16_t m, /* i : order of LP filter */ - int16_t relax_prev_lsf_interp /* i : relax prev frame lsf interp after erasure */ -); - -/*! r: length of output */ -int16_t modify_Fs( - const float sigIn[], /* i : signal to decimate */ - const int16_t lg, /* i : length of input */ - const int32_t fin, /* i : frequency of input */ - float sigOut[], /* o : decimated signal */ - const int32_t fout, /* i : frequency of output */ - float mem[], /* i/o: filter memory */ - const int16_t nblp /* i : flag indicating if NB low-pass is applied */ -); - -void pred_lt4_flt( - const float excI[], /* i : input excitation buffer */ - float excO[], /* o : output excitation buffer */ - const int16_t T0, /* i : integer pitch lag */ - int16_t frac, /* i : fraction of lag */ - const int16_t L_subfr, /* i : subframe size */ - const float *win, /* i : interpolation window */ - const int16_t nb_coef, /* i : nb of filter coef */ - const int16_t up_sample /* i : up_sample */ -); - -void pred_lt4_tc_flt( - float exc[], /* i : excitation buffer */ - const int16_t T0, /* i : integer pitch lag */ - int16_t frac, /* i : fraction of lag */ - const float *win, /* i : interpolation window */ - const int16_t imp_pos, /* i : glottal impulse position */ - const int16_t i_subfr /* i : subframe index */ -); - -void residu( - const float *a, /* i : LP filter coefficients */ - const int16_t m, /* i : order of LP filter */ - const float *x, /* i : input signal (usually speech) */ - float *y, /* o : output signal (usually residual) */ - const int16_t l /* i : size of filtering */ -); - -void calc_residu( - const float *speech, /* i : weighted speech signal */ - float *res, /* o : residual signal */ - const float *p_Aq, /* i : quantized LP filter coefficients */ - const int16_t L_frame /* i : size of frame */ -); - -/*! r: impulse response energy */ -float enr_1_Az( - const float Aq[], /* i : LP filter coefs */ - const int16_t len /* i : impulse response length */ -); - -void Es_pred_enc( - float *Es_pred, /* o : predicited scaled innovation energy */ - int16_t *Es_pred_indice, /* o : indice corresponding to above parameter */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t L_subfr, /* i : length of the subframe */ - const float *res, /* i : residual signal */ - const float *voicing, /* i : normal. correlattion in three 1/2frames */ - const int16_t nb_bits, /* i : allocated number of bits */ - const int16_t no_ltp /* i : no_ltp flag */ -); - -void create_offset( - UWord32 *offset_scale1, - UWord32 *offset_scale2, - const int16_t mode, - const int16_t prediction_flag ); - -float mslvq( - float *pTmp, /* i : M-dimensional input vector */ - float *quant, /* o : quantized vector */ - float *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) */ - int16_t *idx_lead, /* o : leader index for each 8-dim subvector */ - int16_t *idx_scale, /* o : scale index for each subvector */ - const float *w, /* i : weights for LSF quantization */ - const int16_t mode, /* i : number indicating the coding mode */ - const int16_t mode_glb, /* i : LVQ coding mode */ - const int16_t pred_flag /* i : prediction flag (0: safety net, 1 - predictive )*/ -); - -void permute( - float *pTmp1, /* i/o: vector whose components are to be permuted */ - const int16_t *perm /* i : permutation info (indexes that should be interchanged), max two perms */ -); - -void sort_desc_ind( - float *s, - const int16_t len, - int16_t *ind ); - -float mslvq_cng( - int16_t idx_cv, /* i : index of cv from previous stage */ - float *pTmp, /* i : 16 dimensional input vector */ - float *quant, /* o : quantized vector */ - float *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) */ - int16_t *idx_lead, /* o : leader index for each 8-dim subvector */ - int16_t *idx_scale, /* o : scale index for each subvector */ - const float *w /* i : weights for LSF quantization */ -); - -int16_t deindex_lvq_cng( - int16_t *index, /* i : index to be decoded, as an array of 3 short */ - float *x_lvq, /* o : decoded codevector */ - const int16_t idx_cv, /* i : relative mode_lvq, wrt START_CNG */ - const int16_t no_bits /* i : number of bits for lattice */ -); - -void multiply32_32_64( - UWord32 x, /* i : operand 1 */ - UWord32 y, /* i : operand 2 */ - UWord32 *res /* o : result as array of two uint32 */ -); - -int16_t deindex_lvq( - int16_t *index, /* i : index to be decoded, as an array of 3 short */ - float *x_lvq, /* o : decoded codevector */ - const int16_t mode, /* i : LVQ coding mode (select scales & no_lead ), or idx_cv */ - const int16_t sf_flag, /* i : safety net flag */ - const int16_t no_bits /* i : number of bits for lattice */ -); - -void index_lvq( - float *quant, /* i : codevector to be indexed (2 8-dim subvectors) */ - int16_t *idx_lead, /* i : leader class index for each subvector */ - int16_t *idx_scale, /* i : scale index for each subvector */ - const int16_t mode, /* i : integer signaling the quantizer structure for the current bitrate */ - int16_t *index, /* o : encoded index (represented on 3 short each with 15 bits ) */ - const int16_t prediction_flag /* i : predictive mode or not */ -); - -int16_t qlsf_ARSN_tcvq_Dec_16k( - float *y, /* o : Quantized LSF vector */ - int16_t *indice, /* i : Indices */ - const int16_t nBits /* i : number of bits */ -); - - -int16_t lsf_bctcvq_decprm_ivas( - Decoder_State *st, - int16_t *param_lpc ); - - -void disf_2s_36b( - int16_t *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */ - float *isf_q, /* o : quantized ISFs in the cosine domain */ - float *mem_AR, /* i/o: quantizer memory for AR model */ - float *mem_MA /* i/o: quantizer memory for MA model */ -); - -void disf_2s_46b( - int16_t *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */ - float *isf_q, /* o : quantized ISFs in the cosine domain */ - float *mem_AR, /* o : quantizer memory for AR model */ - float *mem_MA /* i/o: quantizer memory for MA model */ -); - -void re8_k2y( - const int16_t *k, /* i : Voronoi index k[0..7] */ - const int16_t m, /* i : Voronoi modulo (m = 2^r = 1<=2) */ - int16_t *y /* o : 8-dimensional point y[0..7] in RE8 */ -); - -void re8_PPV( - const float x[], /* i : point in R^8 */ - int16_t y[] /* o : point in RE8 (8-dimensional integer vector) */ -); - -void enhancer( - const int16_t codec_mode, /* i : flag indicating Codec Mode */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t cbk_index, /* i : */ - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t coder_type, /* i : coding type */ - const int16_t L_frame, /* i : frame size */ - const float voice_fac, /* i : subframe voicing estimation */ - const float stab_fac, /* i : LP filter stablility measure */ - const float norm_gain_code, /* i : normalized innovative cb. gain */ - const float gain_inov, /* i : gain of the unscaled innovation */ - float *gc_threshold, /* i/o: code threshold */ - float *code, /* i/o: innovation */ - float *exc2, /* i/o: adapt. excitation/total exc. */ - const float gain_pit, /* i : Quantized pitch gain */ - float *dispMem /* i/o: Phase dispersion algorithm memory */ -); - -void phase_dispersion_flt( - const float gain_code, /* i : gain of code */ - const float gain_pit, /* i : gain of pitch */ - float code[], /* i/o: code vector */ - const int16_t mode, /* i : level, 0=hi, 1=lo, 2=off */ - float disp_mem[] /* i/o: static memory (size = 8) */ -); - -void re8_vor( - int16_t y[], /* i : point in RE8 (8-dimensional integer vector) */ - int16_t *n, /* o : codebook number n=0,2,3,4,... (scalar integer) */ - int16_t k[], /* o : Voronoi index (integer vector of dimension 8) used only if n>4 */ - int16_t c[], /* o : codevector in Q0, Q2, Q3, or Q4 if n<=4, y=c */ - int16_t *ka /* o : identifier of absolute leader (needed to index c)*/ -); - -void DoRTFT480( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT320( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT160( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT128( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT120( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT80( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT20( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT40( - float *x, /* i/o: real part of input and output data */ - float *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFTn( - float *x, /* i/o: real part of input and output data */ - float *y, /* i/o: imaginary part of input and output data */ - const int16_t n /* i : size of the FFT n=(2^k) up to 1024 */ -); - -void BASOP_cfft_ivas( - Word32 *re, /* i/o: real part */ - Word32 *im, /* i/o: imag part */ - Word16 s, /* i : stride real and imag part */ - Word16 *scale /* i : scalefactor */ -); - -void fft( - float *re, /* i/o: real part */ - float *im, /* i/o: imag part */ - const int16_t length, /* i : length of fft */ - const int16_t s /* i : sign */ -); - -void rfft( - float *x, /* i/o: values */ - const float *w, /* i : window */ - const int16_t length, /* i : length of fft */ - const int16_t isign /* i : sign */ -); - -void sinq( - const float tmp, /* i : sinus factor cos(tmp*i+phi) */ - const float phi, /* i : sinus phase cos(tmp*i+phi) */ - const int16_t N, /* i : size of output */ - float x[] /* o : output vector */ -); - -void edct2( - const int16_t n, - const int16_t isgn, - float *in, - float *a, - const int16_t *ip, - const float *w ); - -void stat_noise_uv_mod( - const int16_t coder_type, /* i : coder type */ - float noisiness, /* i : noisiness parameter */ - const float *const lsp_old, /* i : old LSP vector at 4th sfr */ - const float *const lsp_new, /* i : LSP vector at 4th sfr */ - const float *const lsp_mid, /* i : LSP vector at 2nd sfr */ - float *Aq, /* o : A(z) quantized for the 4 subframes */ - float *exc2, /* o : excitation buffer */ - const int16_t bfi, /* i : bad frame indicator */ - float *ge_sm, /* i/o: smoothed excitation gain */ - int16_t *uv_count, /* i/o: unvoiced counter */ - int16_t *act_count, /* i/o: activation counter */ - float lspold_s[], /* i/o: old LSP */ - int16_t *noimix_seed, /* i/o: mixture seed */ - float *st_min_alpha, /* i/o: minimum alpha */ - float *exc_pe, /* i/o: memory of the preemphasis filter */ - const int32_t bitrate, /* i : core bitrate */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void limit_band_noise_level_calc( - const int16_t *wnorm, /* i : reordered norm of sub-vectors */ - int16_t *limit, /* o : highest band of bit allocation */ - const int32_t core_brate, /* i : core bitrate */ - float *noise_level /* o : noise level */ -); - -/*! r: hqswb_clas */ -int16_t peak_avrg_ratio( - const int32_t total_brate, /* i : total bitrate */ - const float *input_hi, /* i : input signal */ - const int16_t N, /* i : number of coefficients */ - int16_t *mode_count, /* i/o: HQ_HARMONIC mode count */ - int16_t *mode_count1 /* i/o: HQ_NORMAL mode count */ -); - -/*! r: Number of coefficients in nf codebook */ -int16_t build_nf_codebook( - const int16_t flag_32K_env_ho, /* i : Envelope attenuation hangover flag */ - const float *coeff, /* i : Coded spectral coefficients */ - const int16_t *sfm_start, /* i : Subband start indices */ - const int16_t *sfmsize, /* i : Subband widths */ - const int16_t *sfm_end, /* i : Subband end indices */ - const int16_t nb_sfm, /* i : Last coded band */ - const int16_t *R, /* i : Per-band bit allocation */ - float *CodeBook, /* o : Noise-fill codebook */ - float *CodeBook_mod /* o : Densified noise-fill codebook */ -); - -void apply_noisefill_HQ( - const int16_t *R, /* i : bit allocation */ - const int16_t length, /* i : input frame length */ - const int16_t flag_32K_env_ho, /* i : envelope stability hangover flag */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t last_sfm, /* i : last coded subband */ - const float *CodeBook, /* i : Noise-fill codebook */ - const float *CodeBook_mod, /* i : Densified noise-fill codebook */ - const int16_t cb_size, /* i : Codebook length */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t *sfmsize, /* i : Subband band width */ - float *coeff /* i/o: coded/noisefilled spectrum */ -); - -void harm_bwe_fine( - const int16_t *R, /* i : bit allocation */ - const int16_t last_sfm, /* i : last coded subband */ - const int16_t high_sfm, /* i : higher transition band to BWE */ - const int16_t num_sfm, /* i : total number of bands */ - const int16_t *norm, /* i : quantization indices for norms */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - int16_t *prev_L_swb_norm, /* i/o: last normalize length */ - float *coeff, /* i/o: coded/noisefilled normalized spectrum */ - float *coeff_out, /* o : coded/noisefilled spectrum */ - float *coeff_fine /* o : BWE fine structure */ -); - -void hvq_bwe_fine( - const int16_t last_sfm, /* i : last coded subband */ - const int16_t num_sfm, /* i : total number of bands */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t *peak_idx, /* i : Peak index */ - const int16_t Npeaks, /* i : Number of peaks */ - int16_t *peak_pos, /* i/o: Peak positions */ - int16_t *prev_L_swb_norm, /* i/o: last normalize length */ - float *coeff, /* i/o: coded/noisefilled normalized spectrum */ - int16_t *bwe_peaks, /* o : Positions of peaks in BWE */ - float *coeff_fine /* o : HVQ BWE fine structure */ -); - -void hq_fold_bwe( - const int16_t last_sfm, /* i : last coded subband */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t num_sfm, /* i : Number of subbands */ - float *coeff /* i/o: coded/noisefilled normalized spectrum */ -); - -void apply_nf_gain( - const int16_t nf_idx, /* i : noise fill gain index */ - const int16_t last_sfm, /* i : last coded subband */ - const int16_t *R, /* i : bit allocation */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - float *coeff /* i/o: coded/noisefilled normalized spectrum */ - -); - -void hq_generic_fine( - float *coeff, /* i : coded/noisefilled normalized spectrum */ - const int16_t last_sfm, /* i : Last coded band */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - int16_t *bwe_seed, /* i/o: random seed for generating BWE input */ - float *coeff_out1 /* o : HQ GENERIC input */ -); - -void harm_bwe( - const float *coeff_fine, /* i : fine structure for BWE */ - const float *coeff, /* i : coded/noisefilled normalized spectrum */ - const int16_t num_sfm, /* i : Number of subbands */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t last_sfm, /* i : last coded subband */ - const int16_t high_sfm, /* i : higher transition band to BWE */ - const int16_t *R, /* i : bit allocation */ - const int16_t prev_hq_mode, /* i : previous hq mode */ - int16_t *norm, /* i/o: quantization indices for norms */ - float *noise_level, /* i/o: noise levels for harmonic modes */ - float *prev_noise_level, /* i/o: noise factor in previous frame */ - int16_t *bwe_seed, /* i/o: random seed for generating BWE input */ - float *coeff_out, /* o : coded/noisefilled spectrum */ - const int16_t element_mode /* i : element mode */ -); - -void hvq_bwe( - const float *coeff, /* i : coded/noisefilled spectrum */ - const float *coeff_fine, /* i : BWE fine structure */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t *sfm_len, /* i : Subband length */ - const int16_t last_sfm, /* i : last coded subband */ - const int16_t prev_hq_mode, /* i : previous hq mode */ - const int16_t *bwe_peaks, /* i : HVQ bwe peaks */ - const int16_t bin_th, /* i : HVQ transition bin */ - const int16_t num_sfm, /* i : Number of bands */ - const int32_t core_brate, /* i : Core bitrate */ - const int16_t *R, /* i : Bit allocation */ - int16_t *norm, /* i/o: quantization indices for norms */ - float *noise_level, /* i/o: noise levels for harmonic modes */ - float *prev_noise_level, /* i/o: noise factor in previous frame */ - int16_t *bwe_seed, /* i/o: random seed for generating BWE input */ - float *coeff_out /* o : coded/noisefilled spectrum */ -); - -void hvq_concat_bands( - const int16_t pvq_bands, /* i : Number of bands in concatenated PVQ target */ - const int16_t *sel_bnds, /* i : Array of selected high bands */ - const int16_t n_sel_bnds, /* i : Number of selected high bands */ - int16_t *hvq_band_start, /* o : Band start indices */ - int16_t *hvq_band_width, /* o : Band widths */ - int16_t *hvq_band_end /* o : Band end indices */ -); - -void hq_generic_bwe( - const int16_t HQ_mode, /* i : HQ mode */ - float *coeff_out1, /* i/o: BWE input & temporary buffer */ - const float *hq_generic_fenv, /* i : SWB frequency envelopes */ - float *coeff_out, /* o : SWB signal in MDCT domain */ - const int16_t hq_generic_offset, /* i : frequency offset for representing hq generic*/ - int16_t *prev_L_swb_norm, /* i/o: last normalize length */ - const int16_t hq_generic_exc_clas, /* i : hq generic hf excitation class */ - const int16_t *sfm_end, /* i : End of bands */ - const int16_t num_sfm, /* i : Number of bands */ - const int16_t num_env_bands, /* i : Number of coded envelope bands */ - const int16_t *R /* i : Bit allocation */ -); - -void map_hq_generic_fenv_norm( - const int16_t hqswb_clas, /* i : signal classification flag */ - const float *hq_generic_fenv, /* i : HQ GENERIC envelope */ - int16_t *ynrm, /* o : high band norm indices */ - int16_t *normqlg2, /* o : high band norm values */ - const int16_t num_env_bands, /* i : Number coded envelope bands */ - const int16_t nb_sfm, /* i : Number of envelope bands */ - const int16_t hq_generic_offset /* i : Freq offset for HQ GENERIC */ -); - -/*! r: Number of bits consumed for the delta coding */ -int16_t calc_nor_delta_hf( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const float *t_audio, /* i : transform-domain coefficients */ - int16_t *ynrm, /* i/o: norm indices */ - int16_t *Rsubband, /* i/o: sub-band bit allocation */ - const int16_t num_env_bands, /* i : Number coded envelope bands */ - const int16_t nb_sfm, /* i : Number of envelope bands */ - const int16_t *sfmsize, /* i : band length */ - const int16_t *sfm_start, /* i : Start index of bands */ - const int16_t core_sfm /* i : index of the end band for core */ -); - -/*! r: Number of bits consumed for the delta coding */ -int16_t get_nor_delta_hf( - Decoder_State *st, /* i/o: Decoder state */ - int16_t *ynrm, /* i/o: norm indices */ - int16_t *Rsubband, /* i/o: sub-band bit allocation */ - const int16_t num_env_bands, /* i : Number coded envelope bands */ - const int16_t nb_sfm, /* i : Number of envelope bands */ - const int16_t core_sfm ); /* i : index of the end band for core */ - -void hq_wb_nf_bwe( - const float *coeff, /* i : coded/noisefilled normal. spectrum */ - const int16_t is_transient, /* i : is transient flag */ - const int16_t prev_bfi, /* i : previous bad frame indicator */ - const float *normq_v, /* i : norms */ - const int16_t num_sfm, /* i : Number of subbands */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t *sfmsize, /* i : Subband band width */ - const int16_t last_sfm, /* i : last coded subband */ - const int16_t *R, /* i : bit allocation */ - const int16_t prev_is_transient, /* i : previous transient flag */ - float *prev_normq, /* i/o: previous norms */ - float *prev_env, /* i/o: previous noise envelopes */ - int16_t *bwe_seed, /* i/o: random seed for generating BWE input */ - float *prev_coeff_out, /* i/o: decoded spectrum in previous frame */ - int16_t *prev_R, /* i/o: previous frame bit allocation info. */ - float *coeff_out /* o : coded/noisefilled spectrum */ -); - -/*! r: Number of bits */ -int16_t encode_envelope_indices( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t num_sfm, /* i : Number of subbands */ - const int16_t numnrmibits, /* i : Bitrate of fall-back coding mode */ - int16_t *difidx, /* i/o: Diff indices/encoded diff indices */ - int16_t *LCmode, /* o : Coding mode */ - const int16_t flag_pack, /* i : indicator of packing or estimating bits */ - const int16_t flag_HQ2, /* i : indicator of HQ2 core */ - const int16_t is_transient /* i : transient flag */ -); - -void diff_envelope_coding( - const int16_t is_transient, /* i : transient indicator */ - const int16_t num_env_bands, /* i : number of envelope bands to code */ - const int16_t start_norm, /* i : start of envelope coding */ - int16_t *ynrm, /* i/o: quantization indices for norms */ - int16_t *normqlg2, /* i/o: quantized norms */ - int16_t *difidx /* o : differential code */ -); - -/*! r: Number of bits */ -int16_t decode_envelope_indices( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t start_norm, /* i : First SDE encoded norm */ - const int16_t num_sfm, /* i : Number of norms */ - const int16_t numnrmibits, /* i : Bitrate of fall-back coding mode */ - int16_t *ynrm, /* o : Decoded norm indices */ - const int16_t flag_HQ2, /* i : indicator of HQ2 core */ - const int16_t is_transient /* i : transient flag */ -); - -/*! r: Number of bits */ -void dequantize_norms( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t start_norm, /* i : First SDE encoded norm */ - const int16_t num_sfm, /* i : Number of norms */ - const int16_t is_transient, /* i : Transient flag */ - int16_t *ynrm, /* o : Decoded norm indices */ - int16_t *normqlg2 /* o : Log2 of decoded norms */ -); - -void hq_configure( - const int16_t length, /* i : Frame length */ - const int16_t hqswb_clas, /* i : HQ SWB class */ - const int32_t core_brate, /* i : core bitrate */ - int16_t *num_sfm, /* o : Total number of subbands */ - int16_t *nb_sfm, /* o : Total number of coded bands */ - int16_t *start_norm, /* o : First norm to be SDE encoded */ - int16_t *num_sde_norm, /* o : Number of norms for SDE encoding */ - int16_t *numnrmibits, /* o : Number of bits in fall-back norm encoding */ - int16_t *hq_generic_offset, /* o : Freq offset for HQ GENERIC */ - int16_t *sfmsize, /* o : Subband bandwidths */ - int16_t *sfm_start, /* o : Subband start coefficients */ - int16_t *sfm_end /* o : Subband end coefficients */ -); - -/*! r: Consumed bits */ -int16_t hvq_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t hvq_bits, /* i : HVQ bit budget */ - const int16_t Npeaks, /* i : Number of peaks */ - const int16_t *ynrm, /* i : Envelope coefficients */ - int16_t *R, /* i/o: Bit allocation/updated bit allocation */ - int16_t *peaks, /* i/o: Peak pos. / Encoded peak pos. */ - float *nf_gains, /* i/o: Noise fill gains / Quant. nf gains */ - float *noise_level, /* o : Quantized noise level */ - const float *pe_gains, /* i : Peak gains */ - const float *coefs, /* i : spectrum coefficients */ - float *coefs_out /* o : encoded spectrum coefficients */ -); -/*! r: Consumed bits */ -int16_t hq_classifier_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t core_brate, /* i : Core bitrate */ - const int16_t length, /* i : Frame length */ - int16_t *is_transient, /* o : Transient flag */ - int16_t *hqswb_clas /* o : HQ class */ -); - -void hq_bit_allocation( - const int32_t core_brate, /* i : Core bitrate */ - const int16_t length, /* i : Frame length */ - const int16_t hqswb_clas, /* i : HQ class */ - int16_t *num_bits, /* i/o: Remaining bit budget */ - const int16_t *normqlg2, /* i : Quantized norms */ - const int16_t nb_sfm, /* i : Number sub bands to be encoded */ - const int16_t *sfmsize, /* i : Sub band bandwidths */ - float *noise_level, /* o : HVQ noise level */ - int16_t *R, /* o : Bit allocation per sub band */ - int16_t *Rsubband, /* o : Fractional bit allocation (Q3) */ - int16_t *sum, /* o : Sum of allocated shape bits */ - int16_t *core_sfm, /* o : Last coded band in core */ - const int16_t num_env_bands /* i : Number sub bands to be encoded for HQ_SWB_BWE */ -); - -void enforce_zero_for_min_envelope( - const int16_t hqswb_clas, /* i : HQ coding class */ - const int16_t *ynrm, /* i : Envelope indices */ - float *coefsq, /* i/o: Quantized spectrum/zeroed spectrum */ - int16_t nb_sfm, /* i : Number of coded sub bands */ - const int16_t *sfm_start, /* i : Sub band start indices */ - const int16_t *sfm_end /* i : Sub band end indices */ -); - -void apply_envelope( - const float *coeff, /* i/o: Coded/noisefilled normalized spectrum */ - const int16_t *norm, /* i : Envelope */ - const float *norm_adj, /* i : Envelope adjustment */ - const int16_t num_sfm, /* i : Total number of bands */ - const int16_t last_sfm, /* i : Last coded band */ - const int16_t HQ_mode, /* i : HQ mode */ - const int16_t length, /* i : Frame length */ - const int16_t *sfm_start, /* i : Sub band start indices */ - const int16_t *sfm_end, /* i : Sub band end indices */ - float *normq_v, /* o : Envelope with adjustment */ - float *coeff_out, /* o : coded/noisefilled spectrum */ - float *coeff_out1 /* o : noisefilled spectrum for HQ SWB BWE */ -); - -void apply_envelope_enc( - float *coeff, /* i/o: Normalized/scaled normalized spectrum */ - const int16_t *norm, /* i : Envelope */ - const int16_t num_sfm, /* i : Total number of bands */ - const int16_t *sfm_start, /* i : Sub band start indices */ - const int16_t *sfm_end /* i : Sub band end indices */ -); - -/*! r: Leading_sign_index, index, size, k_val */ -PvqEntry mpvq_encode_vec( - const int16_t *vec_in, /* i : Signed pulse train */ - const int16_t dim_in, /* i : Dimension */ - int16_t k_val_local /* i/o: Num unit pulses */ -); - -/*! r: Size, dim, k_val */ -PvqEntry get_size_mpvq_calc_offset( - const int16_t dim_in, /* i : Dimension */ - const int16_t k_val_in, /* i : Num unit pulses */ - uint32_t *h_mem /* o : Offsets */ -); - -void mpvq_decode_vec( - const PvqEntry *entry, /* i : Sign_ind, index, dim, k_val */ - uint32_t *h_mem, /* i : A/U offsets */ - int16_t *vec_out /* o : Pulse train */ -); - -/*! r: Multiplication result */ -uint32_t UMult_32_32( - const uint32_t UL_var1, /* i : factor 1 */ - const uint32_t UL_var2 /* i : factor 2 */ -); - -/*! r: inverse */ -uint32_t UL_inverse_float( - const uint32_t UL_val, /* i : input value Q_exp */ - int16_t *exp /* i/o: input exp / result exp */ -); - -/*! r: ratio */ -Word16 ratio_float( - const Word32 numer, /* i : numerator */ - const Word32 denom, /* i : denominator */ - Word16 *expo /* i/o: input exp / result exp */ -); - -/*! r: Angle between 0 and EVS_PI/2 radian (Q14) */ -Word16 atan2_fx_flt( - const Word32 y, /* i : near side (Argument must be positive) (Q15) */ - const Word32 x /* i : opposite side (Q15) */ -); - -void pvq_encode_frame( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const float *coefs_norm, /* i : normalized coefficients to encode */ - float *coefs_quant, /* o : quantized coefficients */ - float *gopt, /* o : optimal shape gains */ - int16_t *npulses, /* o : number of pulses per band */ - int16_t *pulse_vector, /* o : non-normalized pulse shapes */ - const int16_t *sfm_start, /* i : indices of first coefficients in the bands */ - const int16_t *sfm_end, /* i : indices of last coefficients in the bands */ - const int16_t *sfmsize, /* i : band sizes */ - const int16_t nb_sfm, /* i : total number of bands */ - const int16_t *R, /* i : bitallocation per band (Q3) */ - const int16_t pvq_bits, /* i : number of bits avaiable */ - const int16_t core /* i : core */ -); - -void pvq_decode_frame( - Decoder_State *st, /* i/o: Decoder state */ - float *coefs_quant, /* o : quantized coefficients */ - int16_t *npulses, /* o : number of pulses per band */ - int16_t *pulse_vector, /* o : non-normalized pulse shapes */ - const int16_t *sfm_start, /* i : indices of first coeffs in the bands */ - const int16_t *sfm_end, /* i : indices of last coeffs in the bands */ - const int16_t *sfmsize, /* i : band sizes */ - const int16_t nb_sfm, /* i : total number of bands */ - const int16_t *R, /* i : bitallocation per band (Q3) */ - const int16_t pvq_bits, /* i : number of bits avaiable */ - const int16_t core /* i : core */ -); - -void srt_vec_ind( - const int16_t *linear, /* linear input */ - int16_t *srt, /* sorted output */ - int16_t *I, /* index for sorted output */ - const int16_t length ); - -void srt_vec_ind_f( - const float *linear, /* linear input */ - float *srt, /* sorted output */ - int16_t *I, /* index for sorted output */ - const int16_t length /* length of vector */ -); - -/*! r: floor(sqrt(input)) */ -uint32_t floor_sqrt_exact( - const uint32_t input /* i : unsigned input [0.. UINT_MAX/4] */ -); - -void fine_gain_quant( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t *ord, /* i : Indices for energy order */ - const int16_t num_sfm, /* i : Number of bands */ - const int16_t *gain_bits, /* i : Gain adjustment bits per sub band */ - float *fg_pred, /* i/o: Predicted gains / Corrected gains */ - const float *gopt /* i : Optimal gains */ -); - -void apply_gain( - const int16_t *ord, /* i : Indices for energy order */ - const int16_t *band_start, /* i : Sub band start indices */ - const int16_t *band_end, /* i : Sub band end indices */ - const int16_t num_sfm, /* i : Number of bands */ - const float *gains, /* i : Band gain vector */ - float *xq /* i/o: float synthesis / gain adjusted synth */ -); - -void fine_gain_pred( - const int16_t *sfm_start, /* i : Sub band start indices */ - const int16_t *sfm_end, /* i : Sub band end indices */ - const int16_t *sfm_size, /* i : Sub band bandwidths */ - const int16_t *i_sort, /* i : Energy sorting indices */ - const int16_t *K, /* i : Number of pulses per band */ - const int16_t *maxpulse, /* i : Maximum pulse per band */ - const int16_t *R, /* i : Bits per sub band (Q3) */ - const int16_t num_sfm, /* i : Number of sub bands */ - float *xq, /* i/o: Quantized vector /quantized vector with finegain adj */ - int16_t *y, /* i/o: Quantized vector */ - float *fg_pred, /* o : Predicted fine gains */ - const int16_t core /* i : Core */ -); - -void fine_gain_dec( - Decoder_State *st, /* i/o: Decoder state struct */ - const int16_t *ord, /* i : Indices for energy order */ - const int16_t num_sfm, /* i : Number of bands */ - const int16_t *gain_bits, /* i : Gain adjustment bits per sub band */ - float *fg_pred /* i/o: Predicted gains / Corrected gains */ -); - -void get_max_pulses( - const int16_t *band_start, /* i : Sub band start indices */ - const int16_t *band_end, /* i : Sub band end indices */ - const int16_t *k_sort, /* i : Indices for sorting by energy */ - const int16_t *npulses, /* i : Pulses per sub band */ - const int16_t BANDS, /* i : Number of bands */ - int16_t *inp_vector, /* i/o: Encoded shape vectors */ - int16_t *maxpulse /* o : Maximum pulse height per band */ -); - -Word32 ar_div_ivas( - Word32 num, - Word32 denum ); - -void ar_encoder_start( - PARCODEC arInst, - TCQ_PBITSTREAM bsInst, - int16_t max_bits ); - -void ar_decoder_start( - PARCODEC arInst, - TCQ_PBITSTREAM bsInst ); - -void ar_encoder_done( - PARCODEC arInst ); - -void ar_decoder_done( - PARCODEC arInst ); - - -Word32 Mult_32_16( - Word32 a, - Word16 b ); - -Word32 Mult_32_32( - Word32 a, - Word32 b ); - - -void decode_mangitude_tcq_fx_ivas( - ARCODEC *pardec, - Word16 size, - Word16 npulses, - Word16 nzpos, - Word32 *positions, - Word32 *out, - Word32 *surplus_fx ); - -void decode_signs_fx_ivas( - ARCODEC *pardec, - Word16 size, - Word32 *out ); - -void srt_vec_ind_fx_ivas( - const Word32 *linear, - Word32 *srt, - Word16 *I, - Word16 length ); - - -void bit_allocation_second_fx2( - Word32 *Rk, - Word32 *Rk_sort, - Word16 BANDS, - const Word16 *band_width, - Word16 *k_sort, - Word16 *k_num, - const Word16 *p2a_flags, - const Word16 p2a_bands, - const Word16 *last_bitalloc, - const Word16 input_frame ); - - -Word32 encode_magnitude_tcq_fx_ivas( - ARCODEC *parenc, - float *magn_fx, - Word16 size, - Word16 npulses, - Word16 nzpos, - Word32 *savedstates, - Word32 *est_frame_bits_fx ); - -Word32 encode_signs_fx_ivas( - ARCODEC *parenc, - float *magn, - Word16 size, - Word16 npos, - Word32 *est_frame_bits_fx ); - -Word32 encode_magnitude_usq_fx_ivas( - ARCODEC *parenc, - float *magn_fx, - Word16 size, - Word16 npulses, - Word16 nzpos, - Word32 *est_frame_bits_fx ); - -ivas_error tcq_core_LR_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int32_t inp_vector[], - const float coefs_norm[], - float coefs_quant[], - const int16_t bit_budget, /* number of bits */ - const int16_t nb_sfm, - const int16_t *sfm_start, - const int16_t *sfm_end, - const int16_t *sfmsize, - Word32 *Rk_fx, - int16_t *npulses, - int16_t *k_sort, - const int16_t *p2a_flags, - const int16_t p2a_bands, - const int16_t *last_bitalloc, - const int16_t input_frame, - const int16_t adjustFlag, - const int16_t is_transient ); - -void tcq_core_LR_dec( - Decoder_State *st, - int32_t *inp_vector, - const int16_t bit_budget, - const int16_t bands, - const int16_t *band_start, - const int16_t *band_width, - Word32 *Rk_fx, - int16_t npulses[], - int16_t *k_sort, - const int16_t *p2a_flags, - const int16_t p2a_bands, - const int16_t *last_bitalloc, - const int16_t input_frame, - const int16_t adjustFlag, - const int16_t *is_transient ); - - -void TCQLSB( - int16_t bcount, - float *abuffer, - float *mbuffer, - float *sbuffer, - int16_t *dpath ); - -void RestoreTCQ( - float *magn, - int16_t size, - int16_t *bcount, - float *mbuffer ); - -void SaveTCQdata( - PARCODEC arInst, - int16_t *dpath, - int16_t bcount ); - -void LoadTCQdata( - PARCODEC arInst, - int16_t *dpath, - int16_t bcount ); - -void RestoreTCQdec( - int32_t *magn, - int16_t size, - int16_t *bcount, - float *mbuffer ); - -void TCQLSBdec( - int16_t *dpath, - float *mbuffer, - int16_t bcount ); - -void bit_allocation_second_fx2( - Word32 *Rk, - Word32 *Rk_sort, - Word16 BANDS, - const Word16 *band_width, - Word16 *k_sort, - Word16 *k_num, - const Word16 *p2a_flags, - const Word16 p2a_bands, - const Word16 *last_bitalloc, - const Word16 input_frame ); - -void io_ini_enc( - const int32_t argc, /* i : command line arguments number */ - char *argv[], /* i : command line arguments */ - FILE **f_input, /* o : input signal file */ - FILE **f_stream, /* o : output bitstream file */ - FILE **f_rate, /* o : bitrate switching profile (0 if N/A) */ - FILE **f_bwidth, /* o : bandwidth switching profile (0 if N/A) */ - FILE **f_metadata, /* o : metadata files (NULL if N/A) */ -#ifdef DEBUGGING - FILE **f_force, /* o : force switching profile (0 if N/A) */ -#endif - FILE **f_rf, /* o : channel aware configuration file */ - int16_t *quietMode, /* o : limit printouts */ - int16_t *noDelayCmp, /* o : turn off delay compensation */ - Encoder_Struct *st /* o : IVAS encoder structure */ -); - -void read_next_rfparam( - int16_t *rf_fec_offset, /* o : RF offset */ - int16_t *rf_fec_indicator, /* o : RF FEC indicator */ - FILE *f_rf /* i : file pointer to read parameters */ -); - -void read_next_brate( - int32_t *total_brate, /* i/o: total bitrate */ - const int32_t last_total_brate, /* i : last total bitrate */ - FILE *f_rate, /* i : bitrate switching profile (0 if N/A) */ - const int16_t element_mode, /* i : IVAS element mode */ - int32_t input_Fs, /* i : input sampling frequency */ - int16_t *Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - int16_t *Opt_SC_VBR, /* i/o: SC-VBR flag */ - int16_t *codec_mode /* i/o: Mode 1 or 2 */ -); - -void read_next_bwidth( - int16_t *max_bwidth, /* i/o: maximum encoded bandwidth */ - FILE *f_bwidth, /* i : bandwidth switching profile (0 if N/A) */ - int32_t *bwidth_profile_cnt, /* i/o: counter of frames for bandwidth switching profile file */ - int32_t input_Fs /* i : input sampling rate */ -); - -#ifdef DEBUGGING -void read_next_force( - int16_t *force, /* i/o: force value (0/1, 0 = speech, 1 = music)*/ - FILE *f_force, /* i : force switching profile (0 if N/A) */ - int32_t *force_profile_cnt /* i/o: counter of frames for force switching profile file */ -); -#endif - -ivas_error init_encoder_ivas_fx( - Encoder_State *st, /* i/o: state structure */ - Encoder_Struct *st_ivas, /* i/o: encoder state structure */ - const Word16 idchan, /* i : channel ID */ - const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ - const Word16 interval_SID, /* i : interval for SID update */ - const Word16 vad_only_flag, /* i : flag to indicate front-VAD structure */ - const ISM_MODE ism_mode, /* i : ISM mode */ - const Word32 element_brate /* i : element bitrate */ -); - -void LPDmem_enc_init( - LPD_state_HANDLE hLPDmem /* i/o: LP memories */ -); - -ivas_error evs_enc( - Encoder_State *st, /* i/o: state structure */ - const int16_t *data, /* i : input signal */ - float *mem_hp20_in, /* i/o: hp20 filter memory */ - const int16_t n_samples /* i : number of input samples */ -); -void amr_wb_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t *data, /* i : input signal */ - float *mem_hp20_in, /* i/o: hp20 filter memory */ - const int16_t n_samples /* i : number of input samples */ -); - -void sc_vbr_enc_init( - SC_VBR_ENC_HANDLE hSC_VBR /* i/o: SC-VBR encoder handle */ -); - -void amr_wb_enc_init( - AMRWB_IO_ENC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO encoder handle */ -); - -void pre_proc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t input_frame, /* i : frame length */ - float old_inp_12k8[], /* i/o: buffer of old input signal */ - float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ - float **inp, /* o : ptr. to inp. signal in the current frame*/ - float fr_bands[2 * NB_BANDS], /* i : energy in frequency bands */ - float *ener, /* o : residual energy from Levinson-Durbin */ - int16_t pitch_orig[3], /* o : open-loop pitch values for quantization */ - float A[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ - float Aw[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ - float epsP[M + 1], /* i/o: LP prediction errors */ - float lsp_new[M], /* i/o: LSPs at the end of the frame */ - float lsp_mid[M], /* i/o: LSPs in the middle of the frame */ - int16_t *vad_hover_flag, /* i : VAD hangover flag */ - int16_t *attack_flag, /* o : attack flag */ - float *new_inp_resamp16k, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ - int16_t *Voicing_flag, /* o : voicing flag for HQ FEC */ - float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer */ - float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer */ - int16_t *hq_core_type /* o : HQ core type */ -); - - -/*! r: HQ_CORE/TCX_20_CORE decision */ -int16_t mdct_classifier( - Encoder_State *st, /* i/o: Encoder state variable */ - const float *fft_buff, /* i : FFT spectrum from fft_rel */ - const float enerBuffer[], /* i : energy buffer */ - const int32_t brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ -); - -void MDCT_selector( - Encoder_State *st, /* i/o: Encoder State */ - const float sp_floor, /* i : Noise floor estimate */ - const float Etot, /* i : Total energy */ - const float cor_map_sum, /* i : sum of correlation map */ - const float enerBuffer[] /* i : energy buffer */ -); - -ivas_error acelp_core_enc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 inp[], /* i : input signal of the current frame Q_new*/ - Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes Q12*/ - const Word32 epsP[M + 1], /* i : LP prediction errors Qx*/ - Word16 lsp_new[M], /* i : LSPs at the end of the frame Q15*/ - Word16 lsp_mid[M], /* i : LSPs in the middle of the frame Q15*/ - const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ - const Word16 attack_flag, /* i : attack flag (GSC or TC) Q0*/ - Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ - Word16 *voice_factors_fx, /* o : voicing factors Q15*/ - Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ - Word16 *q_old_syn_12k8_16, - Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ - Word16 *unbits, /* o : number of unused bits Q0*/ - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel X2.56*/ - Word16 Q_new ); - -ivas_error acelp_core_switch_dec_bfi( - Decoder_State *st /* i/o: decoder state structure */ -); - -void acelp_core_switch_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float inp12k8[], /* i : input signal @12.8 kHz */ - const float inp16k[], /* i : input signal @16 kHz */ - const float A[NB_SUBFR16k * ( M + 1 )] /* i : A(z) unquantized for the 4 subframes */ -); - -/*! r: length of output */ -int16_t modify_Fs_intcub3m_sup( - const float sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */ - const int16_t lg, /* i : length of input */ - const int32_t fin, /* i : frequency of input */ - float sigOut[], /* o : decimated signal */ - const int32_t fout, /* i : frequency of output */ - int16_t *delayout /* o : delay of output */ -); - -void core_switching_OLA( - const float *mem_over_hp, /* i : upsampling filter memory */ - const int16_t last_L_frame, /* i : last L_frame lengthture */ - const int32_t output_Fs, /* i : output sampling rate */ - float *synth, /* i/o: synthesized signal from HQ core */ - const float *synth_subfr_out, /* i : synthesized signal from ACELP core */ - float *synth_subfr_bwe, /* i : synthesized BWE from ACELP core */ - const int16_t output_frame, /* i : output frame length */ - const int16_t bwidth /* i : output bandwidth */ -); - -void retro_interp4_5( - const float *syn, - float *pst_old_syn ); - -void retro_interp5_4( - float *pst_old_syn ); -void core_switching_hq_prepare_dec( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t *num_bits, /* i/o: bit budget update */ - const int16_t input_frame /* i : input frame length */ -); - -ivas_error acelp_core_switch_dec( - Decoder_State *st, /* i/o: decoder structure */ - float *synth_subfr_out, /* o : synthesized ACELP subframe */ - float *tmp_synth_bwe, /* o : synthesized ACELP subframe BWE */ - const int16_t output_frame, /* i : input frame length */ - const int16_t core_switching_flag, /* i : core switching flag */ - float *mem_synth, /* o : synthesis to overlap */ - const int16_t nchan_out /* i : number of output channels */ -); - -void ResetSHBbuffer_Enc( - TD_BWE_ENC_HANDLE hBWE_TD /* i/o: TD BWE data handle */ -); - -void ResetSHBbuffer_Dec( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t extl /* i : BWE extension layer */ -); - -void calc_st_filt( - const float *apond2, /* i : coefficients of numerator */ - const float *apond1, /* i : coefficients of denominator */ - float *parcor0, /* o : 1st parcor calcul. on composed filter */ - float *sig_ltp_ptr, /* i/o: input of 1/A(gamma1) : scaled by 1/g0 */ - float *mem_zero, /* i/o: All zero memory */ - const int16_t L_subfr, /* i : the length of subframe */ - const int16_t extl /* i : extension layer info */ -); - - -void scale_st_ivas( - const float *sig_in, /* i : postfilter input signal */ - float *sig_out, /* i/o: postfilter output signal */ - float *gain_prec, /* i/o: last value of gain for subframe */ - const int16_t L_subfr, /* i : the length of subframe */ - const int16_t extl /* i : extension layer info */ -); - -void filt_mu( - const float *sig_in, /* i : signal (beginning at sample -1) */ - float *sig_out, /* o : output signal */ - const float parcor0, /* i : parcor0 (mu = parcor0 * gamma3) */ - const int16_t L_subfr, /* i : the length of subframe */ - const int16_t extl /* i : extension layer info */ -); - -void PostShortTerm( - float *sig_in, /* i : input signal (ptr. to current subframe */ - float *lpccoeff, /* i : LPC coefficients for current subframe */ - float *sig_out, /* o : postfiltered output */ - float *mem_stp, /* i/o: postfilter memory */ - float *ptr_mem_stp, /* i/o: pointer to postfilter memory */ - float *ptr_gain_prec, /* i/o: for gain adjustment */ - float *mem_zero, /* i/o: null memory to compute h_st */ - const float formant_fac /* i : Strength of post-filter [0,1] */ -); - -/*! r: Formant filter strength [0,1] */ -float swb_formant_fac( - const float lpc_shb2, /* i : 2nd HB LPC coefficient */ - float *tilt_mem /* i/o: Tilt smoothing memory */ -); - -void GenShapedSHBExcitation( - float *excSHB, /* o : synthesized shaped shb exctiation */ - const float *lpc_shb, /* i : lpc coefficients */ - float *exc16kWhtnd, /* o : whitened synthesized shb excitation */ - float *mem_csfilt, /* i/o: memory */ - float *mem_genSHBexc_filt_down_shb, /* i/o: memory */ - float *state_lpc_syn, /* i/o: memory */ - const int16_t coder_type, /* i : coding type */ - const float *bwe_exc_extended, /* i : bandwidth extended excitation */ - int16_t bwe_seed[], /* i/o: random number generator seed */ - float voice_factors[], /* i : voicing factor */ - const int16_t extl, /* i : extension layer */ - float *tbe_demph, /* i/o: de-emphasis memory */ - float *tbe_premph, /* i/o: pre-emphasis memory */ - float *lpc_shb_sf, /* i : LP coefficients */ - float *shb_ener_sf, /* i : SHB subframe energies */ - float *shb_res_gshape, /* i : SHB LP residual gain shape */ - float *shb_res, /* i : SHB residual used in encoder only */ - int16_t *vf_ind, /* i/o: Mixing factor index */ - const float formant_fac, /* i : Formant sharpening factor [0..1] */ - float fb_state_lpc_syn[], /* i/o: memory */ - float *fb_tbe_demph, /* i/o: fb de-emphasis memory */ - const int32_t total_brate, /* i : overall bitrate */ - const int16_t prev_bfi, /* i : previous frame was lost flag */ - const int16_t element_mode, /* i : element mode */ - const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ - float *nlExc16k, /* i/o: NL exc for IC-BWE */ - float *mixExc16k, /* i/o: exc spreading for IC-BWE */ - const int32_t extl_brate, /* i : TD BWE bitrate */ - const int16_t MSFlag, /* i : Multi-source flag */ - float EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */ - float *prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */ - float *prev_mix_factor, /* i/o: mixing factor in the previous frame */ - float *Env_error, /* o : error in SHB residual envelope modelling*/ - float Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */ -); - -void GenSHBSynth( - const float *shb_target_speech, /* i : input synthesized speech */ - float *shb_syn_speech_32k, /* o : output highband component */ - float Hilbert_Mem[], /* i/o: memory */ - float state_lsyn_filt_shb_local[], /* i/o: memory */ - const int16_t L_frame, /* i : ACELP Frame length */ - int16_t *syn_dm_phase ); - -void ScaleShapedSHB( - const int16_t length, /* i : SHB overlap length */ - float *synSHB, /* i/o: synthesized shb signal */ - float *overlap, /* i/o: buffer for overlap-add */ - const float *subgain, /* i : subframe gain */ - const float frame_gain, /* i : frame gain */ - const float *win, /* i : window */ - const float *subwin /* i : subframes window */ -); - -void Interpolate_allpass_steep( - const float *in, /* i : input array of size N */ - float *mem, /* i/o: memory */ - const int16_t N, /* i : number of input samples */ - float *out /* o : output array of size 2*N */ -); - -void Decimate_allpass_steep( - const float *in, /* i : input array of size N */ - float *mem, /* i/o: memory */ - const int16_t N, /* i : number of input samples */ - float *out /* o : output array of size N/2 */ -); - -void interpolate_3_over_2_allpass( - const float *input, /* i : input signal */ - const int16_t len, /* i : number of input samples */ - float *out, /* o : output signal */ - float *mem /* i/o: memory */ -); - -void decimate_2_over_3_allpass( - const float *input, /* i : input signal */ - const int16_t len, /* i : number of input samples */ - float *out, /* o : output signal */ - float *mem, /* i/o: memory */ - float *lp_mem ); - -void interpolate_3_over_1_allpass( - const float *input, /* i : input signal */ - const int16_t len, /* i : number of input samples */ - float *out, /* o : output signal */ - float *mem /* i/o: memory */ -); - -void InitSWBencBuffer( - TD_BWE_ENC_HANDLE hBWE_TD /* i/o: TD BWE data handle */ -); - -void InitSWBencBufferStates( - TD_BWE_ENC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - float *shb_speech /* o : SHB target signal (6-14kHz) at 16kHz */ -); - -void swb_tbe_enc( - Encoder_State *st, /* i/o: encoder state structure */ - STEREO_ICBWE_ENC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure */ - const float *new_speech, /* i : original input signal */ - const float *bwe_exc_extended, /* i : bandwidth extended exciatation */ - const float voice_factors[], /* i : voicing factors */ - float *White_exc16k, /* o : shaped white excitation for the FB TBE */ - const float pitch_buf[] /* i : pitch for each subframe */ -); - -void swb_tbe_dec( - Decoder_State *st, /* i/o: decoder state structure */ - STEREO_ICBWE_DEC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure */ - const float *bwe_exc_extended, /* i : bandwidth extended exciatation */ - const float voice_factors[], /* i : voicing factors */ - const float old_syn_12k8_16k[], /* i : low band synthesis at 12.8kHz or 16kHz */ - float *White_exc16k, /* o : shaped white excitation for the FB TBE */ - float *synth, /* i/o: ACELP core synthesis/final synthesis */ - float *pitch_buf ); - -void flip_and_downmix_generic( - float input[], /* i : input spectrum */ - float output[], /* o : output spectrum */ - const int16_t length, /* i : length of spectra */ - float mem1_ext[HILBERT_ORDER1], /* i/o: Hilbert filter memory */ - float mem2_ext[2 * HILBERT_ORDER2], /* i/o: memory */ - float mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory */ - int16_t *phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ -); -void flip_and_downmix_generic_fx_32( - Word32 input[], /* i : input spectrum Qx*/ - Word32 output[], /* o : output spectrum Qx*/ - const Word16 length, /* i : length of spectra */ - Word32 mem1_ext[HILBERT_ORDER1], /* i/o: memory Qx*/ - Word32 mem2_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ - Word32 mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ - Word16 *phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ -); -void non_linearity( - const float input[], /* i : input signal */ - float output[], /* i : output signal */ - float old_bwe_exc_extended[], /* i/o: memory bugffer */ - const int16_t length, /* i : input length */ - float *prev_scale, /* i/o: memory */ - const int16_t coder_type, /* i : Coder Type */ - const float *voice_factors, /* i : Voice Factors */ - const int16_t L_frame /* i : ACELP frame length */ -); - -void interp_code_5over2( - const float inp_code[], /* i : input vector */ - float interp_code[], /* o : output vector */ - const int16_t inp_length /* i : length of the input vector */ -); - -void interp_code_4over2( - const float inp_code[], /* i : input vector */ - float interp_code[], /* o : output vector */ - const int16_t inp_length /* i : length of the input vector */ -); - -void flip_spectrum_and_decimby4( - const float input[], /* i : input spectrum */ - float output[], /* o : output spectrum */ - const int16_t length, /* i : vector length */ - float mem1[], /* i/o: memory */ - float mem2[], /* i/o: memory */ - const int16_t ramp_flag /* i : flag to trigger slow ramp-up of output */ -); - -void GenShapedWBExcitation( - float *excSHB, /* o : synthesized shaped shb exctiation */ - const float *lpc_shb, /* i : lpc coefficients */ - float *exc4kWhtnd, /* o : whitened synthesized shb excitation */ - float *mem_csfilt, /* i/o: memory */ - float *mem_genSHBexc_filt_down1, /* i/o: memory */ - float *mem_genSHBexc_filt_down2, /* i/o: memory */ - float *mem_genSHBexc_filt_down3, /* i/o: memory */ - float *state_lpc_syn, /* i/o: memory */ - const int16_t coder_type, /* i : coding type */ - const float *bwe_exc_extended, /* i : bandwidth extended exciatation */ - int16_t bwe_seed[], /* i/o: random number generator seed */ - const float voice_factors[], /* i : voicing factor */ - const int16_t uv_flag, /* i : unvoiced flag */ - const int16_t igf_flag ); - -void GenWBSynth( - const float *input_synspeech, /* i : input synthesized speech */ - float *shb_syn_speech_16k, /* o : output highband compnent */ - float *state_lsyn_filt_shb1, /* i/o: memory */ - float *state_lsyn_filt_shb2 /* i/o: memory */ -); - -void wb_tbe_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz */ - const float *bwe_exc_extended, /* i : bandwidth extended exciatation */ - const float pitch_buf[], /* i : pitch for each subframe */ - const float voicing[] /* o : OL maximum normalized correlation */ -); - -void wb_tbe_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const float *bwe_exc_extended, /* i : bandwidth extended exciatation */ - const float voice_factors[], /* i : voicing factors */ - float *synth /* i/o: ACELP core synthesis/final synthesis */ -); - -void tbe_write_bitstream( - Encoder_State *st /* i/o: encoder state structure */ -); - -void tbe_read_bitstream( - Decoder_State *st /* i/o: decoder state structure */ -); - -void GenTransition( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - float *outputHB, /* o : synthesized HB transitions signal */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t element_mode, /* i : element mode */ - const int16_t L_frame, /* i : ACELP frame length */ - const int16_t rf_flag, /* i : RF flag */ - const int32_t total_brate /* i : total bitrate */ -); - - -void GenTransition_fixed( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - Word32 *outputHB_fx, /* o : synthesized HB transitions signal : Q11 */ - const Word32 output_Fs, /* i : output sampling rate : Q0 */ - const Word16 element_mode, /* i : element mode : Q0 */ - const Word16 L_frame, /* i : ACELP frame length : Q0 */ - const Word16 rf_flag, /* i : RF flag : Q0 */ - const Word32 total_brate, /* i : total bitrate : Q0 */ - const Word16 prev_Qx ); - -void GenTransition_WB( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - float *outputHB, /* o : synthesized HB transitions signal */ - const int32_t output_Fs /* i : output sampling rate */ -); - -void GenTransition_WB_fixed( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - Word32 *outputHB_fx, /* o : synthesized HB transitions signal : Q11 */ - const Word32 output_Fs /* i : output sampling rate */ -); - -void td_bwe_dec_init( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t extl, /* i : BWE extension layer */ - const int32_t output_Fs /* i : output sampling rate */ -); - -void TBEreset_enc( - TD_BWE_ENC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t last_core, /* i : last core */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void TBEreset_dec( - Decoder_State *st /* i/o: decoder state structure */ -); - -/*! r: TBE bit consumption per frame */ -int16_t get_tbe_bits( - const int32_t total_brate, /* i : overall bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t rf_mode /* i : channel aware mode */ -); - -void fb_tbe_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float new_input[], /* i : input speech at 48 kHz sample rate */ - const float fb_exc[] /* i : FB excitation from the SWB part */ -); - -void fb_tbe_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const float fb_exc[], /* i : FB excitation from the SWB part */ - float *hb_synth, /* i/o: high-band synthesis */ - float *fb_synth_ref, /* o : high-band synthesis 16-20 kHz */ - const int16_t output_frame /* i : output frame length */ -); - -void calc_tilt_bwe( - const float *sp, /* i : input signal */ - float *tilt, /* o : signal tilt */ - const int16_t N /* i : signal length */ -); - -void fd_bwe_enc_init( - FD_BWE_ENC_HANDLE hBWE_FD /* i/o: FD BWE data handle */ -); - -void swb_pre_proc( - Encoder_State *st, /* i/o: encoder state structure */ - float *new_swb_speech, /* o : original input signal at 32kHz */ - float *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz */ - float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer */ - float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer */ - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ -); - -void wb_pre_proc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ - const float *new_inp_resamp16k, /* i : original input signal */ - float *hb_speech /* o : HB target signal (6-8kHz) at 16kHz */ -); - -void wb_bwe_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float *new_wb_speech /* i : original input signal at 16kHz */ -); - -void wb_bwe_dec_flt( - Decoder_State *st, /* i/o: decoder state structure */ - const float output[], /* i : synthesis @internal Fs */ - float *synth, /* i/o: ACELP core synthesis/final synthesis */ - float *hb_synth, /* o : SHB synthesis/final synthesis */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t output_frame, /* i : frame length */ - const float voice_factors[], /* i : voicing factors */ - const float pitch_buf[] /* i : pitch buffer */ -); - -void swb_bwe_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ - const float *old_input_12k8, /* i : input signal @12.8kHz for SWB BWE */ - const float *old_input_16k, /* i : input signal @16kHz for SWB BWE */ - const float *old_syn_12k8_16k, /* i : ACELP core synthesis at 12.8kHz or 16kHz*/ - const float *new_swb_speech, /* i : original input signal at 32kHz */ - const float *shb_speech /* i : SHB target signal (6-14kHz) at 16kHz */ -); - -void swb_bwe_enc_hr( - Encoder_State *st, /* i/o: encoder state structure */ - const float *new_input, /* i : input signal */ - const int16_t input_frame, /* i : frame length */ - const int16_t unbits /* i : number of core unused bits */ -); - -void fd_bwe_dec_init_flt( - FD_BWE_DEC_HANDLE hBWE_FD /* i/o: FD BWE data handle */ -); - -void swb_bwe_dec_flt( - Decoder_State *st, /* i/o: decoder state structure */ - const float output[], /* i : synthesis @internal Fs */ - const float *synth, /* i : ACELP core synthesis/final synthesis */ - float *hb_synth, /* o : SHB synthesis/final synthesis */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t output_frame /* i : frame length */ -); - -void hr_bwe_dec_init_flt( - HR_BWE_DEC_HANDLE hBWE_FD_HR /* i/o: HR BWE data handle */ -); - -void swb_bwe_dec_hr( - Decoder_State *st, /* i/o: decoder state structure */ - const float *syn_12k8_16k, /* i : ACELP core synthesis @16kHz */ - float *hb_synth, /* o : SHB synthesis */ - const int16_t output_frame, /* i : frame length */ - const int16_t unbits, /* i : number of core unused bits */ - const float pitch_buf[] /* i : pitch buffer */ -); - - -void calc_normal_length( - const int16_t core, /* i : core */ - const float *sp, /* i : input signal */ - const int16_t mode, /* i : input mode */ - const int16_t extl, /* i : extension layer */ - int16_t *L_swb_norm, /* o : normalize length */ - int16_t *prev_L_swb_norm /* i/o: last normalize length */ -); - -void calc_norm_envelop( - const float SWB_signal[], /* i : SWB spectrum */ - float *envelope, /* o : normalized envelope */ - const int16_t L_swb_norm, /* i : length of envelope */ - const int16_t SWB_flength, /* i : Length of input/output */ - const int16_t st_offset /* i : offset */ -); - -void time_envelop_shaping( - float werr[], /* i/o: SHB synthesis */ - float SWB_tenv[], /* i/o: frequency envelope */ - const int16_t L /* i : frame length */ -); - -void time_reduce_pre_echo( - const float *synth, /* i : ACELP core synthesis */ - float *error, /* o : SHB BWE synthesis */ - float prev_td_energy, /* o : last td energy */ - const int16_t L /* i : subframe length */ -); - -int16_t WB_BWE_gain_pred( - float *WB_fenv, /* o : WB frequency envelopes */ - const float *core_dec_freq, /* i : Frequency domain core decoded signal */ - const int16_t coder_type, /* i : coding type */ - const int16_t prev_code_type, /* i : coding type of last frame */ - const float prev_WB_fenv, /* i : envelope for last frame */ - const float voice_factors[], /* i : voicing factors */ - const float pitch_buf[], /* i : pitch buffer */ - const int32_t last_core_brate, /* i : previous frame core bitrate */ - const float last_wb_bwe_ener, /* i : previous frame wb bwe signal energy */ - const int16_t last_extl, /* i : extl. layer for last frame */ - const float tilt ); - -void WB_BWE_decoding( - const float *core_dec_freq, /* i : Frequency domain core decoded signal */ - float *WB_fenv, /* i : WB frequency envelopes */ - float *WB_signal, /* o : WB signal in MDCT domain */ - const int16_t WB_flength, /* i : Length of input/output */ - const int16_t mode, /* i : classification for WB signal */ - const int16_t last_extl, /* i : extl. layer for last frame */ - float *prev_Energy, /* i/o: energy for last frame */ - float *prev_WB_fenv, /* i/o: envelope for last frame */ - int16_t *prev_L_wb_norm, /* i/o: length for last frame wb norm */ - const int16_t extl, /* i : extension layer */ - const int16_t coder_type, /* i : coding type */ - const int32_t total_brate, /* i : core layer bitrate */ - int16_t *Seed, /* i/o: random generator seed */ - int16_t *prev_flag, /* i/o: attenu flag of last frame */ - int16_t prev_coder_type /* i : coding type of last frame */ -); - -void SWB_BWE_decoding( - const float *core_dec_freq, /* i : Frequency domain core decoded signal */ - float *SWB_fenv, /* i/o: SWB frequency envelopes */ - float *SWB_signal, /* o : SWB signal in MDCT domain */ - const int16_t SWB_flength, /* i : Length of input/output */ - const int16_t mode, /* i : classification for SWB signal */ - int16_t *frica_flag, /* o : fricative signal flag */ - float *prev_Energy, /* i/o: energy for last frame */ - float *prev_SWB_fenv, /* i/o: envelope for last frame */ - int16_t *prev_L_swb_norm, /* i/o: length for last frame wb norm */ - const float tilt_nb, /* i : tilt of synthesis wb signal */ - int16_t *Seed, /* i/o: random generator seed */ - const int16_t st_offset, /* i : offset value due to different core */ - float *prev_weight, /* i/o: excitation weight value of last frame */ - const int16_t extl, /* i : extension layer */ - const int16_t last_extl /* i : extension layer of last frame */ -); - -void CNG_reset_enc( - Encoder_State *st, /* i/o: encoder state structure */ - float *pitch_buf, /* o : floating pitch for each subframe */ - float *voice_factors, /* o : voicing factors */ - int16_t VBR_cng_reset_flag ); - -/*! r: stability flag */ -uint16_t a2rc( - const float *a, /* i : LPC coefficients */ - float *refl, /* o : Reflection co-efficients */ - const int16_t lpcorder /* i : LPC order */ -); - - -void analy_sp( - const int16_t element_mode, /* i : element mode */ - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const int32_t input_Fs, /* i : input sampling rate */ - float *speech, /* i : speech buffer */ - float *Bin_E, /* o : per bin log energy spectrum */ - float *Bin_E_old, /* o : per bin log energy spectrum for mid-frame */ - float *fr_bands, /* o : per band energy spectrum (2 analyses) */ - float lf_E[], /* o : per bin E for first VOIC_BINS bins (without DC) */ - float *Etot, /* o : total input energy */ - const int16_t min_band, /* i : minimum critical band */ - const int16_t max_band, /* i : maximum critical band */ - float *band_ener, /* o : energy in critical frequency bands without minimum noise floor E_MIN */ - float *PS, /* o : Per bin energy spectrum */ - float *fft_buff /* o : FFT coefficients */ -); - -void CNG_enc( - Encoder_State *st, /* i/o: State structure */ - float Aq[], /* o : LP coefficients */ - const float *speech, /* i : pointer to current frame input speech buffer */ - float enr, /* i : frame energy output from Levinson recursion */ - const float *lsp_mid, /* i : mid frame LSPs */ - float *lsp_new, /* i/o: current frame LSPs */ - float *lsf_new, /* i/o: current frame LSFs */ - int16_t *allow_cn_step, /* o : allow CN step */ - float *q_env, - int16_t *sid_bw ); - -void swb_CNG_enc( - Encoder_State *st, /* i/o: State structure */ - const float *shb_speech, /* i : SHB target signal (6-14kHz) at 16kHz */ - const float *syn_12k8_16k /* i : ACELP core synthesis at 12.8kHz or 16kHz */ -); - -void lsf_enc( - Encoder_State *st, /* i/o: state structure */ - float *lsf_new, /* o : quantized LSF vector */ - float *lsp_new, /* i/o: LSP vector to quantize/quantized */ - float *lsp_mid, /* i : mid-frame LSP vector */ - float *Aq, /* o : quantized A(z) for 4 subframes */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t GSC_IVAS_mode, /* i : GSC IVAS mode */ - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -); - -void isf_enc_amr_wb( - Encoder_State *st, /* i/o: state structure */ - float *isf_new, /* o : quantized ISF vector */ - float *isp_new, /* i/o: ISP vector to quantize/quantized */ - float *Aq /* o : quantized A(z) for 4 subframes */ -); - -void find_targets( - const float *speech, /* i : pointer to the speech frame */ - const float *mem_syn, /* i : memory of the synthesis filter */ - const int16_t i_subfr, /* i : subframe index */ - float *mem_w0, /* i/o: weighting filter denominator memory */ - const float *p_Aq, /* i : interpolated quantized A(z) filter */ - const float *res, /* i : residual signal */ - const int16_t L_subfr, /* i : length of vectors for gain quantization */ - const float *Ap, /* i : unquantized A(z) filter with bandwidth expansion */ - const float tilt_fac, /* i : tilt factor */ - float *xn, /* o : Close-loop Pitch search target vector */ - float *cn, /* o : target vector in residual domain */ - float *h1 /* o : impulse response of weighted synthesis filter */ -); - -Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ - const Word16 pos1, /* i: position of the pulse 1 */ - const Word16 pos2, /* i: position of the pulse 2 */ - const Word16 N /* i: number of bits FOR position */ -); -void find_tilt( - const float fr_bands[], /* i : energy in frequency bands */ - const float bckr[], /* i : per band background noise energy estimate */ - float ee[2], /* o : lf/hf E ration for present frame */ - const int16_t pitch[3], /* i : open loop pitch values for 3 half-frames */ - const float voicing[3], /* i : normalized correlation for 3 half-frames */ - const float *lf_E, /* i : per bin energy for low frequencies */ - const float corr_shift, /* i : normalized correlation correction */ - const int16_t bwidth, /* i : input signal bandwidth */ - const int16_t max_band, /* i : maximum critical band */ - float hp_E[], /* o : energy in HF */ - const int16_t codec_mode, /* i : Mode 1 or 2 */ - float *bckr_tilt_lt, /* i/o: lf/hf E ratio of background noise */ - int16_t Opt_vbr_mode ); - -void init_gp_clip( - float mem[] /* o : memory of gain of pitch clipping algorithm */ -); - -int16_t gp_clip( - const int16_t element_mode, /* i : element mode */ - const int32_t core_brate, /* i : core bitrate */ - const float *voicing, /* i : normalized correlations (from OL pitch) */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t coder_type, /* i : coding type */ - const float xn[], /* i : target vector */ - float mem[] /* i/o: memory of gain of pitch clipping algorithm */ -); - -void gp_clip_test_lsf( - const int16_t element_mode, /* i : element mode */ - const int32_t core_brate, /* i : core bitrate */ - const float lsf[], /* i : LSF vector */ - float mem[], /* i/o: memory of gain of pitch clipping algorithm */ - const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ -); - -void gp_clip_test_gain_pit( - const int16_t element_mode, /* i : element mode */ - const int32_t core_brate, /* i : core bitrate */ - const float gain_pit, /* i : gain of quantized pitch */ - float mem[] /* i/o: memory of gain of pitch clipping algorithm */ -); - -void analy_lp( - const float speech[], /* i : pointer to the denoised speech frame */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t L_look, /* i : look-ahead length */ - float *ener, /* o : residual signal energy */ - float A[], /* o : A(z) filter coefficients */ - float epsP[], /* o : LP analysis residual energies for each iteration */ - float lsp_new[], /* o : current frame ISPs */ - float lsp_mid[], /* o : current mid-frame ISPs */ - float lsp_old[], /* i/o: previous frame unquantized ISPs */ - const int16_t Top[2], /* i : open loop pitch lag */ - const float Tnc[2], /* i : open loop pitch gain */ - const int32_t sr_core, /* i : internal sampling rate */ - const int16_t sec_chan_low_rate /* i : TD secondary channel flag */ -); - -void analy_lp_AMR_WB( - const float speech[], /* i : pointer to the speech frame */ - float *ener, /* o : residual energy from Levinson-Durbin */ - float A[], /* o : A(z) filter coefficients */ - float epsP[], /* o : LP analysis residual energies for each iteration */ - float isp_new[], /* o : current frame ISPs */ - float isp_old[], /* i/o: previous frame unquantized ISPs */ - float isf_new[], /* o : current frame ISFs */ - const int16_t Top, /* i : open loop pitch lag */ - const float Tnc /* i : open loop pitch gain */ -); - -void noise_est_init( - NOISE_EST_HANDLE hNoiseEst /* i/o: Noise estimation handle */ -); - -void speech_music_clas_init( - SP_MUS_CLAS_HANDLE hSpMusClas /* i/o: speech/music classifier handle */ -); - -void long_enr( - Encoder_State *st, /* i/o: encoder state structure */ - const float Etot, /* i : total channel energy */ - const int16_t localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ - const int16_t high_lpn_flag, /* i : sp/mus LPN flag */ - FRONT_VAD_ENC_HANDLE hFrontVad[], /* i/o: front-VAD handles */ - const int16_t n_chan, /* i : number of channels */ - const int16_t localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover LR channels */ - const float Etot_LR[] /* i : total channel energy LR channels */ -); - -void noise_est_pre( - const float Etot, /* i : Energy of current frame */ - const int16_t ini_frame, /* i : Frame number (init) */ - NOISE_EST_HANDLE hNoiseEst, /* i/o: Noise estimation data handle */ - const int16_t idchan, /* i : channel ID */ - const int16_t element_mode, /* i : element mode */ - const int16_t last_element_mode /* i : last element mode */ -); - -void noise_est_down( - const float fr_bands[], /* i : per band input energy (contains 2 vectors) */ - float bckr[], /* i/o: per band background noise energy estimate */ - float tmpN[], /* o : temporary noise update */ - float enr[], /* o : averaged energy over both subframes */ - const int16_t min_band, /* i : minimum critical band */ - const int16_t max_band, /* i : maximum critical band */ - float *totalNoise, /* o : noise estimate over all critical bands */ - const float Etot, /* i : Energy of current frame */ - float *Etot_last, /* i/o: Energy of last frame */ - float *Etot_v_h2 /* i/o: Energy variaions of noise frames */ -); - -void noise_est( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t old_pitch1, /* i : previous frame OL pitch[1] */ - const float tmpN[], /* i : temporary noise update */ - const float *epsP, /* i : LP prediction error energies */ - const float Etot, /* i : total channel E */ - const float relE, /* i : relative frame energy */ - const float corr_shift, /* i : normalized correlation correction */ - const float enr[], /* i : averaged energy over both subframes */ - float fr_bands[], /* i : spectrum per critical bands of the current frame */ - float *cor_map_sum, /* o : sum of correlation map from mult-harm analysis */ - float *ncharX, /* o : noise character for sp/mus classifier */ - float *sp_div, /* o : soectral diversity feature */ - float *non_staX, /* o : non-stationarity for sp/mus classifier */ - int16_t *loc_harm, /* o : multi-harmonicity flag for UV classifier */ - const float *lf_E, /* i : per bin energy for low frequencies */ - int16_t *st_harm_cor_cnt, /* i : 1st harm correlation timer */ - const float Etot_l_lp, /* i : Smoothed low energy */ - float *sp_floor, /* o : noise floor estimate */ - float S_map[], /* o : short-term correlation map */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - FRONT_VAD_ENC_HANDLE hFrontVad, /* i/o: front-VAD handle */ - const int16_t ini_frame /* i : Frame number (init) */ -); - -void vad_param_updt( - Encoder_State *st, /* i/o: encoder state structure */ - const float corr_shift, /* i : correlation shift */ - const float corr_shiftR, /* i : correlation shift right channel */ - const float A[], /* i : A(z) unquantized for the 4 subframes */ - const int16_t old_pitch1, /* i : previous frame OL pitch[1] */ - FRONT_VAD_ENC_HANDLE hFrontVad[], /* i/o: front-VAD handles */ - const int16_t n_channels /* i : number of channels */ -); - - -void lp_gain_updt( - const int16_t i_subfr, /* i : subframe number */ - const float gain_pit, /* i : Decoded gain pitch */ - const float norm_gain_code, /* i : Normalised gain code */ - float *lp_gainp, /* i/o: LP-filtered pitch gain(FEC) */ - float *lp_gainc, /* i/o: LP-filtered code gain (FEC) */ - const int16_t L_frame /* i : length of the frame */ -); - -void GSC_enc_init( - GSC_ENC_HANDLE hGSCEnc /* i/o: GSC data handle */ -); - - -/*! r: index of the last band where pitch contribution is significant */ -int16_t Pit_exc_contribution_len( - Encoder_State *st, /* i/o: state structure */ - const float *dct_res, /* i : DCT of residual */ - float *dct_pitex, /* i/o: DCT of pitch contribution */ - float *pitch_buf, /* i/o: Pitch per subframe */ - int16_t *hangover /* i : Hangover for the time contribution switching */ -); - -int16_t stab_est( - float etot, /* i : Total energy of the current frame */ - float *lt_diff_etot, /* i/o: Long term total energy variation */ - float *mem_etot, /* i/o: Total energy memory */ - int16_t *nb_thr_3, /* i/o: Number of consecutives frames of level 3 */ - int16_t *nb_thr_1, /* i/o: Number of consecutives frames of level 1 */ - float *thresh, /* i/o: Detection thresold */ - int16_t *last_music_flag, /* i/o: Previous music detection ouptut */ - const int16_t vad_flag /* i : VAD flag */ -); - -float gsc_gainQ( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - const float y_gain4[], /* i : gain per band */ - float y_gainQ[], /* o : quantized gain per band */ - const int32_t core_brate, /* i : Core rate */ - const int16_t coder_type, /* i : coding type */ - const int16_t bwidth, /* i : input signal bandwidth */ - const int16_t L_frame, /* i : frame length */ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int32_t core_brate_inp /* i : true core brate */ -); - -void Comp_and_apply_gain( - float exc_diffQ[], /* i/o: gain per band */ - float Ener_per_bd_iQ[], /* o : Quant Ener per band */ - float Ener_per_bd_yQ[], /* o : Ener per band for quantize y */ - int16_t Mbands_gn, /* i : number of bands */ - const int16_t ReUseGain /* i : Reuse the gain in Ener_per_bd_yQ */ -); - -void bands_and_bit_alloc_ivas_fx( - const Word16 cor_strong_limit, /* i : HF correlation */ - const Word16 noise_lev, /* i : dwn scaling factor */ - const Word32 core_brate, /* i : core bit rate */ - const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/ - const Word16 bits_used, /* i : Number of bit used before frequency Q */ - Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */ - const Word16 *Ener_per_bd_iQ, /* i/o: Quantized energy vector */ - Word16 *max_ener_band, /* o : Sorted order */ - Word16 *out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */ - Word16 *nb_subbands, /* o : Number of subband allowed */ - const Word16 *exc_diff, /* i : Difference signal to quantize (encoder side only) */ - Word16 *concat_in, /* o : Concatened PVQ's input vector (encoder side only) */ - Word16 *pvq_len, /* o : Number of bin covered with the PVQ */ - const Word16 coder_type, /* i : coding type */ - const Word16 bwidth, /* i : input signal bandwidth */ - const Word16 GSC_noisy_speech, /* i : GSC noisy speech flag */ - const Word16 L_frame, /* i : frame length */ - const Word16 element_mode, /* i : element mode */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ -); - -void GSC_dec_init_ivas( - GSC_DEC_HANDLE hGSCDec /* i/o: GSC data handle */ -); - -void decod_audio( - Decoder_State *st, /* i/o: decoder static memory */ - float dct_epit[], /* o : GSC excitation in DCT domain */ - const float *Aq, /* i : LP filter coefficient */ - float *tmp_noise, /* o : long term temporary noise energy */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *exc_dct_in, /* i/o: adapt. excitation exc */ - float *exc2, /* i/o: adapt. excitation/total exc */ - float *bwe_exc, /* o : excitation for SWB TBE */ - float *lsf_new, /* i : current frame ISF vector */ - float *gain_buf, /* o : floating pitch gain for each subframe */ - const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -); - -void gsc_dec( - Decoder_State *st, /* i/o: State structure */ - float exc_dct_in[], /* i/o: dct of pitch-only/total excitation */ - const int16_t pit_band_idx, /* i : pitch band index */ - const int16_t Diff_len, /* i : */ - const int16_t bits_used, /* i : total number of bits used */ - const int16_t nb_subfr, /* i : Number of subframe considered */ - const int16_t coder_type, /* i : coding type */ - int16_t *last_bin, /* i : last bin of bit allocation */ - const float *lsf_new, /* i : ISFs at the end of the frame */ - float *exc_wo_nf, /* o : excitation (in f domain) without noisefill*/ - float *tmp_noise /* o : long-term noise energy */ -); - -void dec_pit_exc( - Decoder_State *st, /* i/o: decoder static memory */ - const int16_t L_frame, /* i : length of the frame */ - const float *Aq, /* i : LP filter coefficient */ - const float Es_pred, /* i : predicted scaled innov. energy */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *code, /* o : innovation */ - float *exc, /* i/o: adapt. excitation exc */ - const int16_t nb_subfr, /* i : Number of subframe considered */ - float *gain_buf, /* o : floating pitch gain for each subframe */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -); - -void music_postfilt_init_flt( - MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */ -); - -void LD_music_post_filter( - MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */ - const float dtc_in[], /* i : input synthesis */ - float dtc_out[], /* o : output synthesis */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t coder_type, /* i : Coder type : -1 in case of IO */ - const int16_t Last_coder_type /* i : last Coder type */ -); - -void Post_music_postP( - float dct_buffer_in[], /* i/o: excitation buffer */ - float exc_buffer_out[], /* o : DCT output buffer */ - float *exc2, /* i/o: Current excitation to be overwriten */ - const float *mem_tmp, /* i : previous frame synthesis memory */ - float *st_mem_syn2, /* i/o: current frame synthesis memory */ - const float *Aq, /* i : LPC filter coefficients */ - float *syn /* i/o: 12k8 synthesis */ -); - -void Prep_music_postP( - float exc_buffer_in[], /* i/o: excitation buffer */ - float dct_buffer_out[], /* o : DCT output buffer */ - float filt_lfE[], /* i/o: long term spectrum energy */ - const int16_t last_core, /* i : last core */ - const float *pitch_buf, /* i : current frame pitch information */ - float *LDm_enh_lp_gbin /* o : smoothed suppression gain, per bin FFT */ -); - -void speech_music_classif( - Encoder_State *st, /* i/o: encoder state structure */ - const float *new_inp, /* i : new input signal */ - const float *inp, /* i : input signal to locate attach position */ - const int16_t localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ - const float lsp_new[M], /* i : LSPs in current frame */ - const float cor_map_sum, /* i : correlation map sum (from multi-harmonic anal.) */ - const float epsP[M + 1], /* i : LP prediciton error */ - const float PS[], /* i : energy spectrum */ - const float Etot, /* i : total frame energy */ - const float old_cor, /* i : max correlation from previous frame */ - int16_t *attack_flag, /* o : attack flag (GSC or TC) */ - const float non_staX, /* i : unbound non-stationarity for sp/mus classifier */ - const float relE, /* i : relative frame energy */ - int16_t *high_lpn_flag, /* o : sp/mus LPN flag */ - const int16_t flag_spitch /* i : flag to indicate very short stable pitch */ -); -void ivas_find_wsp_fx( - const Word16 L_frame, /* i : length of the frame Q0*/ - const Word16 L_subfr, /* i : length of subframe Q0*/ - const Word16 nb_subfr, /* i : number of subframes Q0*/ - const Word16 *A_fx, - /* i : A(z) filter coefficients */ // Q12 - Word16 *Aw_fx, - /* o : weighted A(z) filter coefficients */ // Q12 - const Word16 *speech_fx, - /* i : pointer to the denoised speech frame */ // Q_new - const Word16 tilt_fact, - /* i : tilt factor */ // Q15 - Word16 *wsp_fx, - /* o : poitnter to the weighted speech frame */ // Q_new - Word16 *mem_wsp_fx, - /* i/o: W(Z) denominator memory */ // Q_new - const Word16 gamma, - /* i : weighting factor */ // Q15 - const Word16 L_look /* i : look-ahead Q0*/ -); - -void gain_enc_amr_wb( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const float *xn, /* i : target vector */ - const float *y1, /* i : zero-memory filtered adaptive excitation */ - const float *y2, /* i : zero-memory filtered algebraic codebook excitation */ - const float *code, /* i : algebraic excitation */ - const int32_t core_brate, /* i : core bitrate */ - float *gain_pit, /* i/o: Pitch gain / Quantized pitch gain */ - float *gain_code, /* o : Quantized codebook gain */ - float *gain_inov, /* o : innovation gain */ - float *norm_gain_code, /* o : norm. gain of the codebook excitation */ - float *coeff, /* i/o: correlations , -2,, -2 and 2 */ - const int16_t clip_gain, /* i : gain pitch clipping flag (1 = clipping) */ - float *past_qua_en /* i/o: gain quantization memory (4 words) */ -); - -void gain_enc_lbr( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t gains_mode[], /* i : gain bits */ - const int16_t coder_type, /* i : coding type */ - const int16_t i_subfr, /* i : subframe index */ - const float *xn, /* i : target vector */ - const float *y1, /* i : zero-memory filtered adaptive excitation */ - const float *y2, /* i : zero-memory filtered algebraic codebook excitation */ - const float *code, /* i : algebraic excitation */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_inov, /* o : gain of the innovation (used for normalization) */ - float *norm_gain_code, /* o : norm. gain of the codebook excitation */ - float *g_corr, /* i/o: correlations , -2,, -2 and 2 */ - float gains_mem[], /* i/o: pitch gain and code gain from previous subframes */ - const int16_t clip_gain, /* i : gain pitch clipping flag (1 = clipping) */ - const int16_t L_subfr /* i : subfr Lenght */ -); - -void gain_enc_mless( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t gains_mode[], /* i : gain bits */ - const int16_t element_mode, /* i : element mode */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t tc_subfr, /* i : TC subframe index */ - const float *xn, /* i : target vector */ - const float *y1, /* i : zero-memory filtered adaptive excitation */ - const float *y2, /* i : zero-memory filtered algebraic codebook excitation */ - const float *code, /* i : algebraic excitation */ - const float Es_pred, /* i : predicted scaled innovation energy */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_inov, /* o : innovation gain */ - float *norm_gain_code, /* o : norm. gain of the codebook excitation */ - float *coeff, /* i/o: correlations , -2,, -2 and 2 */ - const int16_t clip_gain /* i : gain pitch clipping flag (1 = clipping) */ -); - -void gain_enc_SQ( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t gains_mode[], /* i : gain bits */ - const int16_t i_subfr, /* i : subframe index */ - const float *xn, /* i : target vector */ - const float *yy1, /* i : zero-memory filtered adaptive excitation */ - const float *y2, /* i : zero-memory filtered algebraic codebook excitation */ - const float *code, /* i : algebraic excitation */ - const float Es_pred, /* i : predicted scaled innovation energy */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_inov, /* o : gain of the innovation (used for normalization) */ - float *norm_gain_code, /* o : norm. gain of the codebook excitation */ - float *g_corr, /* i/o: correlations , -2,, -2 and 2 */ - const int16_t clip_gain /* i : gain pitch clipping flag (1 = clipping) */ -); - -/*! r: Return index of quantization */ -int16_t gain_enc_gaus( - float *gain, /* i/o: Code gain to quantize */ - const int16_t bits, /* i : number of bits to quantize */ - const float lowBound, /* i : lower bound of quantizer (dB) */ - const float topBound /* i : upper bound of quantizer (dB) */ -); - -void E_corr_xy2( - const float xn[], /* i : target vector */ - const float y1[], /* i : filtered excitation components 1 */ - const float y2[], /* i : filtered excitation components 2 */ - float g_corr[], /* o : correlations between x, y1, y2, y3, y4 */ - const int16_t L_subfr /* i : subframe size */ -); - - -/*! r: coding type */ -int16_t find_uv( - Encoder_State *st, /* i/o: encoder state structure */ - const float *pitch_fr, /* i : pointer to adjusted fractional pitch (4 val.) */ - const float *voicing_fr, /* i : refined correlation for each subframes */ - const float *speech, /* i : pointer to speech signal for E computation */ - const float *ee, /* i : lf/hf Energy ratio for present frame */ - float *dE1X, /* o : sudden energy increase for S/M classifier */ - const float corr_shift, /* i : normalized correlation correction in noise */ - const float relE, /* i : relative frame energy */ - const float Etot, /* i : total energy */ - const float hp_E[], /* i : energy in HF */ - int16_t *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation */ - const int16_t last_core_orig, /* i : original last core */ - STEREO_CLASSIF_HANDLE hStereoClf /* i/o: stereo classifier structure */ -); - -/*! r: classification for current frames */ -int16_t signal_clas( - Encoder_State *st, /* i/o: encoder state structure */ - const float *speech, /* i : pointer to speech signal for E computation */ - const float *ee, /* i : lf/hf E ration for 2 half-frames */ - const float relE, /* i : frame relative E to the long term average */ - const int16_t L_look, /* i : look-ahead */ - int16_t *clas_mod /* o : class flag for NOOP detection */ -); - -void select_TC( - const int16_t codec_mode, /* i : codec mode */ - const int16_t tc_cnt, /* i : TC frame counter */ - int16_t *coder_type, /* i/o: coder type */ - const int16_t localVAD /* i : VAD without hangover */ -); - - -void wb_vad_init( - VAD_HANDLE hVAD /* i/o: VAD data handle */ -); - -int16_t dtx_hangover_addition( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t vad_flag, /* i : VAD flag */ - const float snr, /* i : input single SNR estimate */ - const int16_t cldfb_subtraction, /* i : */ - int16_t *vad_hover_flag, /* o : VAD hangover flag */ - VAD_HANDLE hVAD, /* i/o: VAD handle for L or R channel */ - NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */ - int16_t *rem_dtx_ho /* o : Expected remaining hangover frames */ -); - -int16_t wb_vad( - Encoder_State *st, /* i/o: encoder state structure */ - const float fr_bands[], /* i : per band input energy (contains 2 vectors) */ - int16_t *noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */ - int16_t *clean_speech_HO, /* o : SC-VBR clean speech HO flag */ - int16_t *NB_speech_HO, /* o : SC-VBR NB speech HO flag */ - float *snr_sum_he, /* i : voicing metric from SAD */ - int16_t *localVAD_HE_SAD, /* o : HE_SAD decision without hangovers */ - int16_t *flag_noisy_speech_snr, /* o : */ - VAD_HANDLE hVAD, /* i/o: VAD handle */ - NOISE_EST_HANDLE hNoiseEst, /* i/o: Noise estimation handle */ - float lp_speech, /* i : long term active speech energy average */ - float lp_noise /* i : long term noise energy */ -); - -void bw_detect( - Encoder_State *st, /* i/o: Encoder State */ - const float signal_in[], /* i : input signal */ - float *spectrum, /* i : MDCT spectrum */ - const float *enerBuffer, /* i : energy buffer */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t mct_on /* i : flag MCT mode */ -); - -void set_bw( - const int16_t element_mode, /* i : element mode */ - const int32_t element_brate, /* i : element bitrate */ - Encoder_State *st, /* i/o: Encoder State */ - const int16_t codec_mode /* i : codec mode */ -); - -float gaus_encode( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t i_subfr, /* i : subframe index */ - const float *h1, /* i : weighted filter input response */ - const float *xn, /* i : target vector */ - float *exc, /* o : pointer to excitation signal frame */ - float *mem_w0, /* o : weighting filter denominator memory */ - float *gp_clip_mem, /* o : memory of gain of pitch clipping algorithm */ - float *tilt_code, /* o : synthesis excitation spectrum tilt */ - float *code, /* o : algebraic excitation */ - float *gain_code, /* o : Code gain. */ - float *y2, /* o : zero-memory filtered adaptive excitation */ - float *gain_inov, /* o : innovation gain */ - float *voice_fac, /* o : voicing factor */ - float *gain_pit, /* o : adaptive excitation gain */ - float *norm_gain_code /* o : normalized innovative cb. gain */ -); - -void td_cng_enc_init( - TD_CNG_ENC_HANDLE hTdCngEnc, /* i/o: DTX/TD CNG data handle */ - const int16_t Opt_DTX_ON, /* i : flag indicating DTX operation */ - const int16_t max_bwidth /* i : maximum encoded bandwidth */ -); - -void dtx( - Encoder_State *st, /* i/o: encoder state structure */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ -); - -void dtx_hangover_control( - Encoder_State *st, /* i/o: encoder state structure */ - const float lsp_new[M] /* i : current frame LSPs */ -); - - -void updt_enc_common( - Encoder_State *st /* i/o: encoder state structure */ -); - -void updt_IO_switch_enc( - Encoder_State *st, /* i/o: state structure */ - const int16_t input_frame /* i : input frame length */ -); - -void transition_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t i_subfr, /* i : subframe index */ - int16_t *tc_subfr, /* i/o: TC subframe index */ - int16_t *Jopt_flag, /* i : joint optimization flag */ - int16_t *position, /* i/o: maximum of residual signal index */ - int16_t *T0, /* i/o: close loop integer pitch */ - int16_t *T0_frac, /* i/o: close loop fractional part of the pitch */ - int16_t *T0_min, /* i/o: lower limit for close-loop search */ - int16_t *T0_max, /* i/o: higher limit for close-loop search */ - float *exc, /* i/o: pointer to excitation signal frame */ - float *y1, /* o : zero-memory filtered adaptive excitation */ - const float *h1, /* i : weighted filter input response */ - const float *xn, /* i : target vector */ - float *xn2, /* o : target vector for innovation search */ - float *gp_cl, /* i/o: memory of gain of pitch clipping algorithm */ - float *gain_pit, /* o : adaptive excitation gain */ - float *g_corr, /* o : ACELP correlation values */ - int16_t *clip_gain, /* i/o: adaptive gain clipping flag */ - float **pt_pitch, /* o : floating pitch values */ - float *bwe_exc, /* i/o: excitation for SWB TBE */ - int16_t *unbits /* i/o: unused bits */ -); - -void tc_classif_enc( - const int16_t L_frame, /* i : length of the frame */ - int16_t *tc_subfr, /* i/o: TC subframe index */ - int16_t *position, /* i/o: maximum of residual signal index */ - const int16_t attack_flag, /* i : attack flag */ - const int16_t pitch, /* i : open loop pitch estimates for first halfframe */ - const float *res /* i : pointer to the LP residual signal frame */ -); - - -void gain_enc_tc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t gains_mode[], /* i : gain bits */ - const int16_t i_subfr, /* i : subframe index */ - const float xn[], /* i : target vector */ - const float y2[], /* i : zero-memory filtered algebraic codebook excitation */ - const float code[], /* i : algebraic excitation */ - const float Es_pred, /* i : predicted scaled innovation energy */ - float *gain_pit, /* o : pitch gain / Quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_inov, /* o : innovation gain */ - float *norm_gain_code /* o : norm. gain of the codebook excitation */ -); - - -/*! r: comfort noise gain factor */ -float AVQ_cod( - const float xri[], /* i : vector to quantize */ - int16_t xriq[], /* o : quantized normalized vector (assuming the bit budget is enough) */ - const int16_t nb_bits, /* i : number of allocated bits */ - const int16_t Nsv /* i : number of subvectors (lg=Nsv*8) */ -); - -void AVQ_encmux( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t extl, /* i : extension layer */ - int16_t xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ - int16_t *nb_bits, /* i/o: number of allocated bits */ - const int16_t Nsv, /* i : number of subvectors */ - int16_t nq[], /* o : AVQ nq index */ - int16_t avq_bit_sFlag, /* i : flag indicating AVQ bit savings */ - int16_t trgtSvPos /* i : target SV for AVQ bit savings */ -); - -void ordr_esti( - const int16_t k, /* i : sub-vector index */ - int16_t *Mpos, /* i/o: dominant sub-vector position from ACV */ - int16_t svOrder[], /* i/o: AVQ sub-vector order */ - const int16_t Nsv /* i : total sub-vectors in a sub-frames */ -); - -void re8_cod( - int16_t x[], /* i : point in RE8 (8-dimensional integer vector) */ - int16_t *n, /* i : codebook number (*n is an integer defined in {0,2,3,4,..,n_max}) */ - uint16_t *I, /* o : index of c (pointer to unsigned 16-bit word) */ - int16_t k[] /* o : index of v (8-dimensional vector of binary indices) = Voronoi index */ -); - -void pre_exc( - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t L_frame, /* i : frame length */ - const float *speech, /* i : input speech */ - const float *p_Aq, /* i : 12k8 Lp coefficient */ - const float *p_A, /* i : unquantized A(q) filter with bandwidth expansion */ - const int16_t coder_type, /* i : coding type */ - const int16_t i_subfr, /* i : current sub frame indicator */ - float *Ap, /* o : weighted LP filter coefficients */ - const float *res, /* i : residual signal */ - float *h1, /* o : impulse response of weighted synthesis filter */ - float *xn, /* o : close-loop Pitch search target vector */ - float *cn, /* o : target vector in residual domain */ - float *mem_syn, /* i/o: memory of the synthesis filter */ - float *mem_w0, /* i/o: weighting filter denominator memory */ - const int16_t L_subfr /* i : subframe length */ -); - - -void encod_amr_wb( - Encoder_State *st, /* i/o: state structure */ - const float speech[], /* i : input speech */ - const float Aw[], /* i : weighted A(z) unquantized for subframes */ - const float Aq[], /* i : 12k8 Lp coefficient */ - const float *res, /* i : residual signal */ - float *syn, /* i/o: core synthesis */ - float *exc, /* i/o: current non-enhanced excitation */ - float *exc2, /* i/o: current enhanced excitation */ - float *pitch_buf, /* i/o: floating pitch values for each subframe */ - int16_t hf_gain[NB_SUBFR], /* o : decoded HF gain */ - const float *speech16k /* i : input speech @16kHz */ -); - -void stat_noise_uv_enc( - Encoder_State *st, /* i/o: state structure */ - const float *epsP, /* i : LP prediction errors */ - const float *isp_new, /* i : immittance spectral pairs at 4th sfr */ - const float *isp_mid, /* i : immittance spectral pairs at 2nd sfr */ - float *Aq, /* i/o: A(z) quantized for the 4 subframes */ - float *exc2, /* i/o: excitation buffer */ - const int16_t uc_two_stage_flag /* o : flag undicating two-stage UC */ -); - -void re8_compute_base_index( - const int16_t *x, /* i : Elemen of Q2, Q3 or Q4 */ - const int16_t ka, /* i : Identifier of the absolute leader related to x */ - uint16_t *I /* o : index */ -); - -void transf_cdbk_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t harm_flag_acelp, /* i : harmonic flag for higher rates ACELP */ - const int16_t i_subfr, /* i : subframe index */ - float cn[], /* i/o: target vector in residual domain */ - float exc[], /* i/o: pointer to excitation signal frame */ - const float *p_Aq, /* i : 12k8 Lp coefficient */ - const float Ap[], /* i : weighted LP filter coefficients */ - const float h1[], /* i : weighted filter input response */ - float xn[], /* i/o: target vector */ - float xn2[], /* i/o: target vector for innovation search */ - float y1[], /* i/o: zero-memory filtered adaptive excitation */ - const float y2[], /* i : zero-memory filtered innovative excitation */ - const float Es_pred, /* i : predicited scaled innovation energy */ - float *gain_pit, /* i/o: adaptive excitation gain */ - const float gain_code, /* i : innovative excitation gain */ - float g_corr[], /* o : ACELP correlation values */ - const int16_t clip_gain, /* i : adaptive gain clipping flag */ - float *gain_preQ, /* o : prequantizer excitation gain */ - float code_preQ[], /* o : prequantizer excitation */ - int16_t *unbits /* i/o: number of AVQ unused bits */ -); -void deemph_lpc( - float *p_Aq_cuerr, /* i : LP coefficients current frame */ - float *p_Aq_old, /* i : LP coefficients previous frame */ - float *LPC_de_curr, /* o : De-emphasized LP coefficients current frame */ - float *LPC_de_old, /* o : De-emphasized LP coefficients previous frame*/ - const int16_t deemph_old ); - -void Interpol_delay( - float *out, /* o : pitch interpolation output */ - float *last, /* i : last frame pitch lag */ - float *current, /* i : current frame pitch lag */ - int16_t SubNum, /* i : subframe number */ - const float *frac /* i : interpolation constant */ -); - -void dequantize_uvg( - int16_t iG1, /* i : gain 1 index */ - int16_t *iG2, /* i : gain 2 index */ - float *G, /* o : quantized gain */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void generate_nelp_excitation( - int16_t *seed, /* i/o: random number seed */ - float *Gains, /* i : excitation gains */ - float *output, /* o : excitation output */ - float gain_fac /* i : gain factor */ -); - -void nelp_encoder( - Encoder_State *st, /* i/o: encoder state */ - float *in, /* i : residual signal */ - float *exc, /* o : NELP quantized excitation signal */ - const int16_t reduce_gains ); - -void encod_nelp( - Encoder_State *st, /* i/o: state structure */ - const float *speech, /* i : input speech */ - const float Aw[], /* i : weighted A(z) unquantized for subframes */ - const float *Aq, /* i : 12k8 Lp coefficient */ - float *res, /* o : residual signal */ - float *synth, /* o : core synthesis */ - float *tmp_noise, /* o : long-term noise energy */ - float *exc, /* i/o: current non-enhanced excitation */ - float *exc2, /* i/o: current enhanced excitation */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc /* o : excitation for SWB TBE */ -); - -void realft( - float *data, /* i/o: data array */ - int16_t n, /* i : length of data array */ - int16_t isign /* i : sign +1 or -1 */ -); - -ivas_error DTFS_new( - DTFS_STRUCTURE **dtfs_out ); - -void DTFS_copy( - DTFS_STRUCTURE *Xout, /* o : DTFS */ - DTFS_STRUCTURE Xinp /* i : DTFS */ -); - -void DTFS_sub( - DTFS_STRUCTURE *tmp, /* o : output DFTS */ - DTFS_STRUCTURE X1, /* i : DTFS input 1 */ - DTFS_STRUCTURE X2 /* i : DTFS input 2 */ -); - -void DTFS_to_fs( - const float *x, /* i : Time domain signal */ - const int16_t N, /* i : Length of input vector */ - DTFS_STRUCTURE *X, /* o : DTFS structure with a, b, lag */ - const int32_t sampling_rate, - const int16_t FR_flag /* i : FR flag */ -); - -void DTFS_fs_inv( - DTFS_STRUCTURE *X, /* i : DTFS */ - float *x, /* o : time domain sig */ - const int16_t N, /* i : Output length */ - float ph0 /* i : Input phase */ -); - -void DTFS_car2pol( - DTFS_STRUCTURE *X /* i/o: DTFS structure a, b, lag */ - /* input in Cartesion, output in Polar */ -); - -void DTFS_pol2car( - DTFS_STRUCTURE *X /* i/o: DTFS structure a, b, lag */ - /* input in Polar, output in Cartesian */ -); - -/*! r: Return Input RMS between f1/f2 b4 scaling */ -float DTFS_setEngyHarm( - float f1, /* i : lower band freq of input to control energy */ - float f2, /* i : upper band freq of input to control energy */ - float g1, /* i : lower band freq of output to control energy */ - float g2, /* i : upper band freq of output to control energy */ - float en2, /* i : Target Energy to set the DTFS to */ - DTFS_STRUCTURE *X /* i/o: DTFS to adjust the energy of */ -); - -void DTFS_to_erb( - DTFS_STRUCTURE X, /* i : DTFS input */ - float *out /* o : ERB output */ -); - -void DTFS_zeroPadd( - const int16_t N, /* i : Target lag */ - DTFS_STRUCTURE *X /* i/o: DTFS */ -); - -/*! r: Energy */ -float DTFS_getEngy( - DTFS_STRUCTURE X /* i : DTFS to compute energy of */ -); - -void DTFS_adjustLag( - DTFS_STRUCTURE *X_DTFS, /* i/o: DTFS to adjust lag for */ - const int16_t N /* i : Target lag */ -); - -void DTFS_poleFilter( - DTFS_STRUCTURE *X, /* i/o: DTFS to poleFilter inplace */ - const float *LPC, /* i : LPCs */ - const int16_t N /* i : LPCORDER */ -); - -void DTFS_zeroFilter( - DTFS_STRUCTURE *X, /* i/o: DTFS to zeroFilter inplace */ - const float *LPC, /* i : LPCs */ - const int16_t N /* i : LPCORDER */ -); - -float DTFS_alignment_full( - DTFS_STRUCTURE X1_DTFS, /* i : reference DTFS */ - DTFS_STRUCTURE X2_DTFS, /* i : DTFS to shift */ - const int16_t num_steps /* i : resolution */ -); - -void DTFS_phaseShift( - DTFS_STRUCTURE *X, /* i : DTFS to shift */ - float ph /* i : phase to shift */ -); - -void erb_add( - float *curr_erb, /* i/o: current ERB */ - const int16_t l, /* i : current lag */ - const float *prev_erb, /* i : previous ERB */ - const int16_t pl, /* i : previous lag */ - const int16_t *index, /* i : ERB index */ - const int16_t num_erb /* i : number of ERBs */ -); - -void erb_slot( - int16_t lag, /* i : input lag */ - int16_t *out, /* o : ERB slots */ - float *mfreq, /* i : ERB frequencies */ - int16_t num_erb /* i : number of ERBs */ -); - -void erb_diff( - const float *prev_erb, /* i : previous ERB */ - const int16_t pl, /* i : previous lag */ - const float *curr_erb, /* i : current ERB */ - const int16_t l, /* i : current lag */ - const float *curr_lsp, /* i : current LSP coefficients */ - float *out, /* o : ERB difference */ - int16_t *index, /* i : ERB index */ - const int16_t num_erb /* i : Number of ERBs */ -); - -void DTFS_erb_inv( - float *in, /* i : ERB inpt */ - int16_t *slot, /* i : ERB slots filled based on lag */ - float *mfreq, /* i : erb frequence edges */ - DTFS_STRUCTURE *X, /* o : DTFS after erb-inv */ - const int16_t num_erb /* i : Number of ERB bands */ -); - -ivas_error ppp_quarter_encoder( - int16_t *returnFlag, /* o : return value */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - DTFS_STRUCTURE *CURRCW_Q, /* o : Quantized (amp/phase) DTFS */ - DTFS_STRUCTURE *TARGETCW, /* o : DTFS with quant phase but unquant Amp */ - const int16_t prevCW_lag, /* i : previous lag */ - DTFS_STRUCTURE vCURRCW_NQ, /* i : Unquantized DTFS */ - const float *curr_lpc, /* i : LPCS */ - float *lastLgainE, /* i/o: last low band gain */ - float *lastHgainE, /* i/o: last high band gain */ - float *lasterbE, /* i/o: last ERB vector */ - DTFS_STRUCTURE PREV_CW_E /* i : past DTFS */ -); - -ivas_error WIsyn( - DTFS_STRUCTURE PREVCW, /* i : Prev frame DTFS */ - DTFS_STRUCTURE *CURR_CW_DTFS, /* i/o: Curr frame DTFS */ - const float *curr_lpc, /* i : LPC */ - float *ph_offset, /* i/o: Phase offset to line up at end of frame */ - float *out, /* o : Waveform Interpolated time domain signal */ - const int16_t N, /* i : Number of samples of output to generate */ - const int16_t FR_flag /* i : called for post-smoothing in FR */ -); - -void set_ppp_mode( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */ - const int16_t clean_speech_HO, /* i : SC-VBR clean speech HO flag */ - const int16_t NB_speech_HO, /* i : SC-VBR NB speech HO flag */ - const int16_t localVAD_he /* i : HE-SAD flag without hangover */ -); - -ivas_error ppp_voiced_encoder( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - SC_VBR_ENC_HANDLE hSC_VBR, /* i/o: SC-VBR state structure */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t last_coder_type_raw, /* i : raw last_coder_type */ - const float old_pitch_buf[], /* i : buffer of old subframe pitch values */ - float *in, /* i : residual signal */ - float *out, /* o : Quantized residual signal */ - const int16_t delay, /* i : open loop pitch */ - float *lpc1, /* i : prev frame de-emphasized LPC */ - float *lpc2, /* i : current frame de-emphasized LPC */ - float *exc, /* i : previous frame quantized excitation */ - float *pitch /* o : floating pitch values for each subframe */ -); - -ivas_error encod_ppp( - Encoder_State *st, /* i/o: state structure */ - const float speech[], /* i : input speech */ - const float Aw[], /* i : weighted A(z) unquantized for subframes */ - const float Aq[], /* i : 12k8 Lp coefficient */ - float *res, /* i/o: residual signal */ - float *synth, /* i/o: core synthesis */ - float *exc, /* i/o: current non-enhanced excitation */ - float *exc2, /* i/o: current enhanced excitation */ - float *pitch_buf, /* i/o: floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc /* o : excitation for SWB TBE */ -); - -void reset_rf_indices( - RF_ENC_HANDLE hRF, /* i/o: RF state structure */ - const int16_t L_frame, /* i : frame length */ - int16_t *rf_target_bits_write ); - -void signaling_enc_rf( - Encoder_State *st /* i/o: encoder state structure */ -); - -ivas_error acelp_core_dec( - Decoder_State *st, /* i/o: Decoder state structure */ - float output[], /* o : synthesis @internal Fs */ - float synth[], /* o : synthesis */ - float save_hb_synth[], /* o : HB synthesis */ - float bwe_exc_extended[], /* i/o: bandwidth extended excitation */ - float *voice_factors, /* o : voicing factors */ - float old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */ - const int16_t sharpFlag, /* i : formant sharpening flag */ - float pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe */ - int16_t *unbits, /* o : number of unused bits */ - int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ - const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t read_sid_info /* i : read SID info flag */ -); - -void bass_psfilter_init( - BPF_DEC_HANDLE hBPF /* o : BPF data handle */ -); - -void bass_psfilter( - BPF_DEC_HANDLE hBPF, /* o : BPF data handle */ - const int16_t Opt_AMR_WB, /* i : AMR-WB IO flag */ - const float synth_in[], /* i : synthesis (at 16kHz) */ - const int16_t L_frame, /* i : length of the last frame */ - const float pitch_buf[], /* i : pitch for every subfr [0,1,2,3] */ - const int16_t bpf_off, /* i : do not use BPF when set to 1 */ - float v_stab, /* i : stability factor */ - float *v_stab_smooth, /* i : smoothed stability factor */ - const int16_t coder_type, /* i : coder_type */ - float bpf_noise_buf[] /* o : BPF error signal (at int_fs) */ -); - -void CNG_reset_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *pitch_buf, /* o : floating pitch for each subframe */ - float *voice_factors /* o : voicing factors */ -); - -void updt_dec( - Decoder_State *st, /* i/o: state structure */ - const float *old_exc, /* i : buffer of excitation */ - const float *pitch_buf, /* i : floating pitch values for each subframe */ - const float Es_pred, /* i : predicited scaled innovation energy */ - const float *Aq, /* i : A(z) quantized for all subframes */ - const float *lsf_new, /* i : current frame LSF vector */ - const float *lsp_new, /* i : current frame LSP vector */ - const float voice_factors[], /* i : voicing factors */ - const float *old_bwe_exc, /* i : buffer of excitation */ - const float *gain_buf /* o : floating pitch gain for each subframe */ -); - -void updt_IO_switch_dec( - const int16_t output_frame, /* i : output frame length */ - Decoder_State *st /* i/o: state structure */ -); - -void updt_dec_common( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t hq_core_type, /* i : HQ core type */ - const int16_t concealWholeFrameTmp, /* i : concealWholeFrameTmp flag */ - const float *synth /* i : decoded synthesis */ -); - -void td_cng_dec_init( - DEC_CORE_HANDLE st /* i/o: decoder state structure */ -); - -void CNG_dec( - Decoder_State *st, /* i/o: State structure */ - const int16_t last_element_mode, /* i : last element mode */ - float Aq[], /* o : LP coefficients */ - float *lsp_new, /* i/o: current frame LSPs */ - float *lsf_new, /* i/o: current frame LSFs */ - int16_t *allow_cn_step, /* o : allow cn step */ - int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ - float *q_env ); - -void swb_CNG_dec( - Decoder_State *st, /* i/o: State structure */ - const float *synth, /* i : ACELP core synthesis at 32kHz */ - float *shb_synth, /* o : high-band CNG synthesis */ - const int16_t sid_bw /* i : 0-NB/WB, 1-SWB SID */ -); - -void lsf_dec( - Decoder_State *st, /* i/o: State structure */ - const int16_t tc_subfr, /* i : TC subframe index */ - float *Aq, /* o : quantized A(z) for 4 subframes */ - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - float *lsf_new, /* o : de-quantized LSF vector */ - float *lsp_new, /* o : de-quantized LSP vector */ - float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -); - -void isf_dec_amr_wb( - Decoder_State *st, /* i/o: State structure */ - float *Aq, /* o : quantized A(z) for 4 subframes */ - float *isf_new, /* o : de-quantized ISF vector */ - float *isp_new /* o : de-quantized ISP vector */ -); - -void Es_pred_dec( - float *Es_pred, /* o : predicted scaled innovation energy */ - const int16_t enr_idx, /* i : indice */ - const int16_t nb_bits, /* i : number of bits */ - const int16_t no_ltp /* i : no LTP flag */ -); - -void gaus_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t i_subfr, /* i : subframe index */ - float *code, /* o : gaussian excitation */ - float *norm_gain_code, /* o : gain of the normalized gaussian excitation */ - float *lp_gainp, /* i/o: lp filtered pitch gain(FER) */ - float *lp_gainc, /* i/o: lp filtered code gain (FER) */ - float *gain_inov, /* o : unscaled innovation gain */ - float *tilt_code, /* o : synthesis excitation spectrum tilt */ - float *voice_fac, /* o : estimated voicing factor */ - float *gain_pit, /* o : reset pitch gain */ - float *pt_pitch, /* o : reset floating pitch buffer */ - float *exc, /* o : excitation signal frame */ - float *gain_code, /* o : gain of the gaussian excitation */ - float *exc2 /* o : scaled excitation signal frame */ -); - -void gain_dec_amr_wb( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t core_brate, /* i : core bitrate */ - float *gain_pit, /* o : Quantized pitch gain */ - float *gain_code, /* o : Quantized codeebook gain */ - float *past_qua_en, /* i/o: gain quantization memory (4 words) */ - float *gain_inov, /* o : unscaled innovation gain */ - const float *code, /* i : algebraic code excitation */ - float *norm_gain_code /* o : norm. gain of the codebook excitation */ -); - -void gain_dec_lbr( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t coder_type, /* i : coding type */ - const int16_t i_subfr, /* i : subframe index */ - const float *code, /* i : algebraic excitation */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_inov, /* o : gain of the innovation (used for normalization) */ - float *norm_gain_code, /* o : norm. gain of the codebook excitation */ - float gains_mem[], /* i/o: pitch gain and code gain from previous subframes */ - const int16_t L_subfr /* i : subframe length */ -); - -void gain_dec_mless( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t coder_type, /* i : coding type */ - const int16_t i_subfr, /* i : subframe number */ - const int16_t tc_subfr, /* i : TC subframe index */ - const float *code, /* i : algebraic code excitation */ - const float Es_pred, /* i : predicted scaled innov. energy */ - float *gain_pit, /* o : Quantized pitch gain */ - float *gain_code, /* o : Quantized codeebook gain */ - float *gain_inov, /* o : unscaled innovation gain */ - float *norm_gain_code /* o : norm. gain of the codebook excitation */ -); - -void gain_dec_SQ( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t i_subfr, /* i : subframe number */ - const float *code, /* i : algebraic code excitation */ - const float Es_pred, /* i : predicted scaled innov. energy */ - float *gain_pit, /* o : Quantized pitch gain */ - float *gain_code, /* o : Quantized codeebook gain */ - float *gain_inov, /* o : unscaled innovation gain */ - float *norm_gain_code /* o : norm. gain of the codebook excitation */ -); - -/*! r: quantized codebook gain */ -float gain_dec_gaus( - const int16_t index, /* i : quantization index */ - const int16_t bits, /* i : number of bits to quantize */ - const float lowBound, /* i : lower bound of quantizer (dB) */ - const float topBound, /* i : upper bound of quantizer (dB) */ - const float gain_inov, /* i : unscaled innovation gain */ - float *norm_gain_code /* o : gain of normalized gaus. excit. */ -); - -/*! r: floating pitch value */ -float pit_decode_flt( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t L_frame, /* i : length of the frame */ - int16_t i_subfr, /* i : subframe index */ - const int16_t coder_type, /* i : coding type */ - int16_t *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */ - int16_t *T0, /* o : close loop integer pitch */ - int16_t *T0_frac, /* o : close loop fractional part of the pitch */ - int16_t *T0_min, /* i/o: delta search min for sf 2 & 4 */ - int16_t *T0_max, /* i/o: delta search max for sf 2 & 4 */ - const int16_t L_subfr, /* i : subframe length */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -); - -void abs_pit_dec_flt( - const int16_t fr_steps, /* i : fractional resolution steps (0, 2, 4) */ - int16_t pitch_index, /* i : pitch index */ - const int16_t limit_flag, /* i : restrained(0) or extended(1) Q limits */ - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac /* o : pitch fraction */ -); - -void delta_pit_dec_flt( - const int16_t fr_steps, /* i : fractional resolution steps (0, 2, 4) */ - const int16_t pitch_index, /* i : pitch index */ - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac, /* o : pitch fraction */ - const int16_t T0_min /* i : delta search min */ -); - -void pit_Q_dec_flt( - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t pitch_index, /* i : pitch index */ - const int16_t nBits, /* i : # of Q bits */ - const int16_t delta, /* i : Half the CL searched interval */ - const int16_t pit_flag, /* i : absolute(0) or delta(1) pitch Q */ - const int16_t limit_flag, /* i : restrained(0) or extended(1) Q limits */ - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac, /* o : pitch fraction */ - int16_t *T0_min, /* i/o: delta search min */ - int16_t *T0_max, /* i/o: delta search max */ - int16_t *BER_detect /* o : BER detect flag */ -); - -void pit16k_Q_dec_flt( - const int16_t pitch_index, /* i : pitch index */ - const int16_t nBits, /* i : # of Q bits */ - const int16_t limit_flag, /* i : restrained(0) or extended(1) Q limits */ - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac, /* o : pitch fraction */ - int16_t *T0_min, /* i/o: delta search min */ - int16_t *T0_max, /* i/o: delta search max */ - int16_t *BER_detect /* o : BER detect flag */ -); - - -void inov_decode( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t sharpFlag, /* i : formant sharpening flag */ - const int16_t i_subfr, /* i : subframe index */ - const float *p_Aq, /* i : LP filter coefficients */ - const float tilt_code, /* i : tilt of of the excitation of previous subframe */ - const float pt_pitch, /* i : pointer to current subframe fractional pitch */ - float *code, /* o : algebraic excitation */ - const int16_t L_subfr /* i : subframe length */ -); - -void dec_acelp_1t64( - Decoder_State *st, /* i/o: decoder state structure */ - float code[], /* o : algebraic (fixed) codebook excitation */ - const int16_t L_subfr /* i : subframe length */ -); - -void dec_acelp_2t32( - Decoder_State *st, /* i/o: decoder state structure */ - float code[] /* o : algebraic (fixed) codebook excitation */ -); - -void dec_acelp_4t64( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t nbbits, /* i : number of bits per codebook */ - float code[], /* o : algebraic (fixed) codebook excitation */ - const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ -); - - -void FEC_exc_estim( - Decoder_State *st, /* i/o: Decoder static memory */ - const int16_t L_frame, /* i : length of the frame */ - float *old_exc, /* i/o: excitation buffer */ - float *exc2, /* o : excitation buffer (for synthesis) */ - float *exc_dct_in, /* o : GSC excitation in DCT domain */ - float *pitch_buf, /* o : Floating pitch for each subframe */ - float *tmp_tc, /* o : FEC pitch */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc, /* i/o: excitation for SWB TBE */ - float *lsf_new, /* i : ISFs at the end of the frame */ - float *tmp_noise /* o : long-term noise energy */ -); - -void FEC_lsf2lsp_interp_flt( - Decoder_State *st, /* i/o: Decoder static memory */ - const int16_t L_frame, /* i : length of the frame */ - float *Aq, /* o : calculated A(z) for 4 subframes */ - float *lsf, /* o : estimated LSF vector */ - float *lsp /* o : estimated LSP vector */ -); - -void FEC_lsf_estim_enc( - Encoder_State *st, /* i : Encoder static memory */ - float *lsf /* o : estimated LSF vector */ -); - -float frame_energy( - const int16_t L_frame, /* i : length of the frame */ - const float *pitch, /* i : pitch values for each subframe */ - const float *speech, /* i : pointer to speech signal for E computation */ - const float lp_speech, /* i : long term active speech energy average */ - float *frame_ener /* o : pitch-synchronous energy at frame end */ -); - -void FEC_SinOnset( - float *exc, /* i/o: exc vector to modify */ - int16_t puls_pos, /* i : Last pulse position desired */ - int16_t T0, /* i : decoded first frame pitch */ - float enr_q, /* i : energy provided by the encoder */ - float *Aq, /* i : Lsp coefficient */ - const int16_t L_frame /* i : Frame length */ -); - -int16_t FEC_enhACB( - const int16_t L_frame, /* i : Frame length */ - const int16_t last_L_frame, /* i : frame length of last frame */ - float *exc_io, /* i/o: Adaptive codebook memory */ - const int16_t new_pit, /* i : decoded first frame pitch */ - const int16_t puls_pos, /* i : decoder position of the last glottal pulses decoded in the previous frame */ - const float bfi_pitch /* i : Pitch used for concealment */ -); - -void FEC_scale_syn( - const int16_t L_frame, /* i : length of the frame */ - int16_t clas, /* i/o: frame classification */ - const int16_t last_good, /* i : last good frame classification */ - float *synth, /* i/o: synthesized speech at Fs = 12k8 Hz */ - const float *pitch, /* i : pitch values for each subframe */ - float enr_old, /* i : energy at the end of prvious frame */ - float enr_q, /* i : transmitted energy for current frame */ - const int16_t coder_type, /* i : coding type */ - const int16_t LSF_Q_prediction, /* i : LSF prediction mode */ - int16_t *scaling_flag, /* i/o: flag to indicate energy control of syn */ - float *lp_ener_FEC_av, /* i/o: averaged voiced signal energy */ - float *lp_ener_FEC_max, /* i/o: averaged voiced signal energy */ - const int16_t bfi, /* i : current frame BFI */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t prev_bfi, /* i : previous frame BFI */ - const int32_t last_core_brate, /* i : previous frame core bitrate */ - float *exc, /* i/o: excitation signal without enhancement */ - float *exc2, /* i/o: excitation signal with enhancement */ - const float Aq[], /* i : LP filter coefs */ - float *old_enr_LP, /* i/o: LP filter E of last good voiced frame */ - const float *mem_tmp, /* i : temp. initial synthesis filter states */ - float *mem_syn, /* o : initial synthesis filter states */ - const int16_t avoid_lpc_burst_on_recovery, /* i : if true the excitation energy is limited if LP has big gain */ - const int16_t force_scaling /* i : force scaling */ -); - -void FEC_pitch_estim( - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const int16_t last_core, /* i : last core */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t clas, /* i : current frame classification */ - const int16_t last_good, /* i : last good clas information */ - const float pitch_buf[], /* i : Floating pitch for each subframe */ - const float old_pitch_buf[], /* i : buffer of old subframe pitch values */ - float *bfi_pitch, /* i/o: update of the estimated pitch for FEC */ - int16_t *bfi_pitch_frame, /* o : frame length when pitch was updated */ - int16_t *upd_cnt, /* i/o: update counter */ - const int16_t coder_type ); - -void FEC_encode( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const ACELP_config acelp_cfg, /* i : configuration of the ACELP */ - const float *synth, /* i : pointer to synthesized speech for E computation */ - const int16_t coder_type, /* i : type of coder */ - int16_t clas, /* i : signal clas for current frame */ - const float *fpit, /* i : close loop fractional pitch buffer */ - const float *res, /* i : LP residual signal frame */ - int16_t *last_pulse_pos, /* i/o: Position of the last pulse */ - const int16_t L_frame, /* i : Frame length */ - const int32_t total_brate /* i : total codec bitrate */ -); - -int16_t FEC_pos_dec( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t *last_pulse_pos, /* o : Last glottal pulse position in the lost ACB */ - float *enr_q, /* o : Decoded energy */ - const int16_t nBits_es_Pred /* i : number of bits for Es_pred Q */ -); - -void improv_amr_wb_gs( - const int16_t clas, /* i : bitrate allocated to the core */ - const int16_t coder_type, /* i : coder_type */ - const int32_t core_brate, /* i : bitrate allocated to the core */ - int16_t *seed_tcx, /* i/o: Seed used for noise generation */ - float *old_Aq, /* i/o: old LPC filter coefficient */ - float *mem_syn2, /* i/o: synthesis memory */ - const float lt_voice_fac, /* i/o: long term voice factor */ - const int16_t locattack, /* i : Flag for a detected attack */ - float *Aq, /* i/o: Decoded LP filter coefficient */ - float *exc2, /* i/o: Decoded complete excitation */ - float *mem_tmp, /* i/o: synthesis temporary memory */ - float *syn, /* i/o: Decoded synthesis to be updated */ - const float *pitch_buf, /* i : Decoded pitch buffer */ - const float Last_ener, /* i : Last energy */ - const int16_t rate_switching_reset, /* i : rate switching reset flag */ - const int16_t last_coder_type, /* i : Last coder_type */ - const int16_t VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */ -); - -int16_t tc_classif( - Decoder_State *st /* i/o: decoder state structure */ -); - -void transition_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t tc_subfr, /* i : TC subframe index */ - int16_t *Jopt_flag, /* i : joint optimization flag */ - float *exc, /* i/o: current frame excitation signal */ - int16_t *T0, /* o : close loop integer pitch */ - int16_t *T0_frac, /* o : close loop fractional part of the pitch */ - int16_t *T0_min, /* i/o: delta search min for sf 2 & 4 */ - int16_t *T0_max, /* i/o: delta search max for sf 2 & 4 */ - float **pt_pitch, /* o : floating pitch values */ - int16_t *position, /* i/o: first glottal impulse position in frame */ - float *bwe_exc /* i/o: excitation for SWB TBE */ -); - -void gain_dec_tc( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t i_subfr, /* i : subframe number */ - const float Es_pred, /* i : predicted scaled innov. energy */ - const float *code, /* i : algebraic code excitation */ - float *gain_pit, /* o : pitch gain */ - float *gain_code, /* o : Quantized codeebook gain */ - float *gain_inov, /* o : unscaled innovation gain */ - float *norm_gain_code /* o : norm. gain of the codebook excit. */ -); - -void stat_noise_uv_dec( - Decoder_State *st, /* i/o: decoder static memory */ - const float *lsp_new, /* i : end-frame LSP vector */ - const float *lsp_mid, /* i : mid-frame LSP vector */ - float *Aq, /* o : A(z) quantized for the 4 subframes */ - float *exc2, /* i/o: excitation buffer */ - const int16_t uc_two_stage_flag /* 1 : flag undicating two-stage UC */ -); - -void sc_vbr_dec_init_flt( - SC_VBR_DEC_HANDLE hSC_VBR /* i/o: SC-VBR decoder handle */ -); - -void decod_nelp( - Decoder_State *st, /* i/o: decoder static memory */ - float *tmp_noise, /* o : long term temporary noise energy */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *exc, /* o : adapt. excitation exc */ - float *exc2, /* o : adapt. excitation/total exc */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc, /* o : excitation for SWB TBE */ - const int16_t bfi, /* i : bad frame indicator */ - float *gain_buf /* o : floating pitch gain for each subframe */ -); - -void nelp_decoder( - Decoder_State *st, /* i/o: decoder static memory */ - float *exc_nelp, /* o : adapt. excitation/total exc */ - float *exc, /* o : adapt. excitation exc */ - int16_t bfi, /* i : frame error rate */ - const int16_t coder_type, /* i : coding type */ - float *gain_buf /* o : floating pitch gain for each subframe */ -); - -ivas_error decod_ppp( - Decoder_State *st, /* i/o: state structure */ - const float Aq[], /* i : 12k8 Lp coefficient */ - float *pitch_buf, /* i/o: floating pitch values for each subframe */ - float *exc, /* i/o: current non-enhanced excitation */ - float *exc2, /* i/o: current enhanced excitation */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc, /* o : excitation for SWB TBE */ - float *gain_buf, /* o : floating pitch gain for each subframe */ - const int16_t bfi /* i : BFI flag */ -); - -ivas_error ppp_quarter_decoder( - Decoder_State *st, /* i/o: decoder state structure */ - DTFS_STRUCTURE *CURRCW_Q_DTFS, /* i/o: Current CW DTFS */ - int16_t prevCW_lag, /* i : Previous lag */ - float *lastLgainD, /* i/o: Last gain lowband */ - float *lastHgainD, /* i/o: Last gain highwband */ - float *lasterbD, /* i/o: Last ERB vector */ - int16_t bfi, /* i : FER flag */ - DTFS_STRUCTURE PREV_CW_D /* i : Previous DTFS */ -); - -ivas_error ppp_voiced_decoder( - Decoder_State *st, /* i/o: state structure */ - float *out, /* o : residual signal */ - const float *lpc2, /* i : current frame LPC */ - float *exc, /* i : previous frame excitation */ - float *pitch, /* o : floating pitch values for each subframe */ - const int16_t bfi /* i : BFI flag */ -); - -void AVQ_demuxdec( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t xriq[], /* o : decoded subvectors [0..8*Nsv-1] */ - int16_t *nb_bits, /* i/o: number of allocated bits */ - const int16_t Nsv, /* i : number of subvectors */ - int16_t nq[], /* i/o: AVQ nq index */ - int16_t avq_bit_sFlag, /* i : flag for AVQ bit saving solution*/ - int16_t trgtSvPos /* i : target SV for AVQ bit savings */ -); - - -void Init_post_filter_ivas( - PFSTAT_HANDLE hPFstat /* i : post-filter state memories */ -); - -void nb_post_filt_ivas( - const int16_t L_frame, /* i : frame length */ - const int16_t L_subfr, /* i : sub-frame length */ - PFSTAT_HANDLE hPFstat, /* i/o: Post filter related memories */ - float *lp_noise, /* i/o: long term noise energy */ - const float tmp_noise, /* i : noise energy */ - float *synth, /* i/o: synthesis */ - const float *Aq, /* i : LP filter coefficient */ - const float *pitch_buf, /* i : Floating pitch for each subframe */ - const int16_t coder_type, /* i : coder_type -> deactivated in AUDIO */ - const int16_t BER_detect, /* i : BER detect flag */ - const int16_t disable_hpf /* i : flag to diabled HPF */ -); - -void decod_unvoiced( - Decoder_State *st, /* i/o: decoder static memory */ - const float *Aq, /* i : LP filter coefficient */ - const float Es_pred, /* i : predicted scaled innov. energy */ - const int16_t uc_two_stage_flag, /* i : flag indicating two-stage UC */ - float *tmp_noise, /* o : long term temporary noise energy */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *exc, /* o : adapt. excitation exc */ - float *exc2, /* o : adapt. excitation/total exc */ - float *bwe_exc, /* i/o: excitation for SWB TBE */ - float *gain_buf /* o : floating pitch gain for each subfram */ -); - -void decod_tran( - Decoder_State *st, /* i/o: decoder static memory */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t tc_subfr, /* i : TC subframe index */ - const float *Aq, /* i : LP filter coefficient */ - const float Es_pred, /* i : predicted scaled innov. energy */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *exc, /* i/o: adapt. excitation exc */ - float *exc2, /* i/o: adapt. excitation/total exc */ - float *bwe_exc, /* i/o: excitation for SWB TBE */ - int16_t *unbits, /* i/o: number of unused bits */ - const int16_t sharpFlag, /* i : formant sharpening flag */ - float *gain_buf /* o : floating pitch gain for each subframe */ -); - -ivas_error decod_gen_voic( - Decoder_State *st, /* i/o: decoder static memory */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t sharpFlag, /* i : formant sharpening flag */ - const float *Aq, /* i : LP filter coefficient */ - const float Es_pred, /* i : predicted scaled innov. energy */ - const int16_t do_WI, /* i : FEC fast recovery flag */ - float *pitch_buf, /* o : floating pitch for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *exc, /* i/o: adapt. excitation exc */ - float *exc2, /* i/o: adapt. excitation/total exc */ - float *bwe_exc, /* i/o: excitation for SWB TBE */ - int16_t *unbits, /* i/o: number of unused bits */ - float *gain_buf, /* o : floating pitch gain for each subframe */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -); - -void decod_amr_wb( - Decoder_State *st, /* i/o: decoder static memory */ - const float *Aq, /* i : LP filter coefficients */ - float *pitch_buf, /* o : floating pitch values for each subframe */ - float *exc, /* i/o: adapt. excitation exc */ - float *exc2, /* i/o: adapt. excitation/total exc */ - int16_t hf_gain[NB_SUBFR], /* o : decoded HF gain */ - float *voice_factors, /* o : voicing factors */ - float *gain_buf /* o : floating pitch gain for each subframe */ -); - -ivas_error init_decoder( - Decoder_State *st, /* o : Decoder static variables structure */ - const int16_t idchan, /* i : channel ID */ - const MC_MODE mc_mode /* i : MC mode */ -); - -void destroy_cldfb_decoder_flt( - Decoder_State *st /* o : Decoder static variables structure */ -); - -void HQ_core_dec_init_flt( - HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ -); - -void HQ_nbfec_init_flt( - HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ -); - -ivas_error evs_dec( - Decoder_State *st, /* i/o: Decoder state structure */ - float mem_hp20_out[L_HP20_MEM], /* i/o: HP filter memory for synthesis */ - float *output, /* o : output synthesis signal */ - FRAME_MODE frameMode /* i : Decoder frame mode */ -); - -void get_next_frame_parameters( - Decoder_State *st /* i/o: Decoder state structure */ -); - -ivas_error amr_wb_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float mem_hp20_out[L_HP20_MEM], /* i/o: HP filter memory for synthesis */ - float *output /* o : synthesis output */ -); - -void transf_cdbk_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t harm_flag_acelp, /* i : harmonic flag for higher rates ACELP */ - const int16_t i_subfr, /* i : subframe index */ - const float Es_pred, /* i : predicited scaled innovation energy */ - const float gain_code, /* i : innovative excitation gain */ - float *gain_preQ, /* o : prequantizer excitation gain */ - float *norm_gain_preQ, /* o : normalized prequantizer excitation gain */ - float code_preQ[], /* o : prequantizer excitation */ - int16_t *unbits /* o : number of AVQ unused bits */ -); - -/*! r: decoded gain */ -float gain_dequant( - int16_t index, /* i : quantization index */ - const float min_val, /* i : value of lower limit */ - const float max_val, /* i : value of upper limit */ - const int16_t bits /* i : number of bits to dequantize */ -); - -void hq_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float *audio, /* i : input audio signal */ - const int16_t input_frame, /* i : frame length */ - const int16_t hq_core_type, /* i : HQ core type */ - const int16_t Voicing_flag, /* i : Voicing flag for FER method selection */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -int16_t detect_transient( - Encoder_State *st, /* i/o: encoder state structure */ - const float *in, /* i : input signal */ - const int16_t L /* i : length */ -); - -void wtda( - const float *new_audio, /* i : input audio */ - float *wtda_audio, /* o : windowed audio */ - float *old_wtda, /* i/o: windowed audio from previous frame */ - const int16_t left_mode, /* i : window overlap of previous frame (0: full, 2: none, or 3: half) */ - const int16_t right_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */ - const int16_t L /* i : length */ -); - -void wtda_ext( - const float *new_audio, /* i : input audio */ - float *wtda_audio, /* o : windowed audio */ - const int16_t left_mode, /* i : window overlap of previous frame (0: full, 2: none, or 3: half) */ - const int16_t right_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */ - const int16_t L, /* i : length */ - const uint16_t kernel_type /* i : transform kernel type (0 - 3) */ -); - -void tcx_get_windows_mode1_flt( - const int16_t left_mode, /* i : overlap mode of left window half */ - const int16_t right_mode, /* i : overlap mode of right window half */ - float *left_win, /* o : left overlap window */ - float *right_win, /* o : right overlap window */ - float *left_win_int, /* o : left overlap window */ - float *right_win_int, /* o : right overlap window */ - const int16_t L /* i : length */ -); - -void direct_transform( - const float *in32, /* i : input signal */ - float *out32, /* o : output transformation */ - const int16_t is_transient, /* i : transient flag */ - const int16_t L, /* i : length */ - const int16_t element_mode /* i : IVAS element mode */ -); - - -void interleave_spectrum( - float *coefs, /* i/o: input and output coefficients */ - const int16_t length /* i : length of spectrum */ -); - -void hq_hr_enc( - Encoder_State *st, /* i/o: encoder state structure */ - float *coefs, /* i/o: transform-domain coefficients */ - const int16_t length, /* i : length of spectrum */ - int16_t *num_bits, /* i/o: number of available bits */ - const int16_t is_transient, /* i : transient flag */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void huff_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t N, /* i : Number of codewords to decode */ - const int16_t buffer_len, /* i : Number of bits to read */ - const int16_t num_lengths, /* i : Number of different huffman codeword lengths */ - const int16_t *thres, /* i : Threshold of first codeword of each length */ - const int16_t *offset, /* i : Offset for first codeword */ - const int16_t *huff_tab, /* i : Huffman table order by codeword lengths */ - int16_t *index /* o : Decoded index */ -); - -void reordernorm( - const int16_t *ynrm, /* i : quantization indices for norms */ - const int16_t *normqlg2, /* i : quantized norms */ - int16_t *idxbuf, /* o : reordered quantization indices */ - int16_t *normbuf, /* o : reordered quantized norms */ - const int16_t nb_sfm /* i : number of bands */ -); - -void diffcod( - const int16_t N, /* i : number of sub-vectors */ - int16_t *y, /* i/o: indices of quantized norms */ - int16_t *difidx /* o : differential code */ -); - -void diffcod_lrmdct( - const int16_t N, /* i : number of sub-vectors */ - const int16_t be_ref, /* i : band energy reference */ - int16_t *y, /* i/o: indices of quantized norms */ - int16_t *difidx, /* o : differential code */ - const int16_t is_transient /* i : transient flag */ -); - -void bitallocsum( - int16_t *R, /* i : bit-allocation vector */ - const int16_t nb_sfm, /* i : number of sub-vectors */ - int16_t *sum, /* o : total number of bits allocated */ - int16_t *Rsubband, /* o : rate per subband (Q3) */ - const int16_t num_bits, /* i : number of bits */ - const int16_t length, /* i : length of spectrum */ - const int16_t *sfmsize /* i : Length of bands */ -); -/*! r: BWE class */ -int16_t swb_bwe_gain_deq_flt( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t core, /* i : core */ - float *SWB_tenv, /* o : time-domain BWE envelope */ - float *SWB_fenv, /* o : frequency-domain BWE envelope */ - const int16_t hr_flag, /* i : high rate flag */ - const int16_t hqswb_clas /* i : HQ BWE class */ -); - -void save_old_syn( - const int16_t L_frame, /* i : frame length */ - const float syn[], /* i : ACELP synthesis */ - float old_syn[], /* o : old synthesis buffer */ - float old_syn_12k8_16k[], /* i/o: old synthesis buffer */ - const float preemph_fac, /* i : preemphasis factor */ - float *mem_deemph /* i/o: deemphasis filter memory */ -); - -void hq_generic_hf_decoding( - const int16_t HQ_mode, /* i : HQ mode */ - float *coeff_out1, /* i/o: BWE input & temporary buffer */ - const float *hq_generic_fenv, /* i : SWB frequency envelopes */ - float *coeff_out, /* o : SWB signal in MDCT domain */ - const int16_t hq_generic_offset, /* i : frequency offset for representing hq swb bwe*/ - int16_t *prev_L_swb_norm, /* i/o: last normalize length */ - const int16_t hq_swb_bwe_exc_clas, /* i : bwe excitation class */ - const int16_t *R ); - -void hq_core_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float out[], /* o : output synthesis */ - const int16_t output_frame, /* i : output frame length */ - const int16_t hq_core_type, /* i : HQ core type */ - const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ - float *output /* o : LB synthesis in case of ACELP-HQ switch */ -); - -void IMDCT( - float *x, - float *old_syn_overl, - float *syn_Overl_TDAC, - float *xn_buf, - const float *tcx_aldo_window_1_trunc, - const float *tcx_aldo_window_2, - const float *tcx_mdct_window_half, - const float *tcx_mdct_window_minimum, - const float *tcx_mdct_window_trans, - const int16_t tcx_mdct_window_half_length, - const int16_t tcx_mdct_window_min_length, - int16_t index, - const uint16_t kernel_type, /* i : TCX transform kernel type */ - const int16_t left_rect, - const int16_t tcx_offset, - const int16_t overlap, - const int16_t L_frame, - const int16_t L_frameTCX, - const int16_t L_spec_TCX5, - const int16_t L_frame_glob, - const int16_t frame_cnt, - const int16_t bfi, - float *old_out, - const int16_t FB_flag, - Decoder_State *st, - const int16_t fullband, - float *acelp_zir ); - -void hq_hr_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *t_audio_q, /* o : transform-domain coefficients */ - const int16_t length, /* i : frame length */ - const int16_t num_bits, /* i : number of available bits */ - int16_t *ynrm, /* o : norm quantization index vector */ - int16_t *is_transient, /* o : transient flag */ - int16_t *hqswb_clas, /* o : HQ SWB class */ - float *SWB_fenv, /* o : SWB frequency envelopes */ - const int16_t core_switching_flag /* i : Core switching flag */ - -); - -void hdecnrm_context( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t N, /* i : number of norms */ - int16_t *index, /* o : indices of quantized norms */ - int16_t *n_length /* o : decoded stream length */ -); - -void hdecnrm_tran( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t N, /* i : number of norms */ - int16_t *index /* o : indices of quantized norms */ -); - -void hdecnrm_resize( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t N, /* i : number of SFMs */ - int16_t *index /* o : norm quantization index vector */ -); - -void hdecnrm( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t N, /* i : number of norms */ - int16_t *index /* o : indices of quantized norms */ -); - -/*! r: index of last band */ -int16_t find_last_band( - const int16_t *bitalloc, /* i : bit allocation */ - const int16_t nb_sfm /* i : number of possibly coded bands */ -); - -void fill_spectrum( - float *coeff, /* i/o: normalized MLT spectrum / nf spectrum */ - int16_t *R, /* i : number of pulses per band */ - const int16_t is_transient, /* i : transient flag */ - int16_t norm[], /* i : quantization indices for norms */ - const float *hq_generic_fenv, /* i : HQ GENERIC envelope */ - const int16_t hq_generic_offset, /* i : HQ GENERIC offset */ - const int16_t nf_idx, /* i : noise fill index */ - const int16_t length, /* i : Length of spectrum (32 or 48 kHz) */ - const float env_stab, /* i : Envelope stability measure [0..1] */ - int16_t *no_att_hangover, /* i/o: Frame counter for attenuation hangover */ - float *energy_lt, /* i/o: Long-term energy measure for transient detection */ - int16_t *bwe_seed, /* i/o: random seed for generating BWE input */ - const int16_t hq_generic_exc_clas, /* i : HF excitation class */ - const int16_t core_sfm, /* i : index of the end band for core */ - int16_t HQ_mode, /* i : HQ mode */ - float noise_level[], /* i : noise level for harmonic modes */ - int32_t core_brate, /* i : target bitrate */ - float prev_noise_level[], /* i/o: noise factor in previous frame */ - int16_t *prev_R, /* i/o: bit allocation info. in previous frame */ - float *prev_coeff_out, /* i/o: decoded spectrum in previous frame */ - const int16_t *peak_idx, /* i : peak positions */ - const int16_t Npeaks, /* i : number of peaks */ - const int16_t *npulses, /* i : Number of assigned pulses per band */ - int16_t prev_is_transient, /* i : previous transient flag */ - float *prev_normq, /* i : previous norms */ - float *prev_env, /* i : previous noise envelopes */ - int16_t prev_bfi, /* i : previous bad frame indicator */ - const int16_t *sfmsize, /* i : Length of bands */ - const int16_t *sfm_start, /* i : Start of bands */ - const int16_t *sfm_end, /* i : End of bands */ - int16_t *prev_L_swb_norm, /* i/o: last normalize length for harmonic mode */ - int16_t prev_hq_mode, /* i : previous HQ mode */ - const int16_t num_sfm, /* i : Number of bands */ - const int16_t num_env_bands, /* i : Number of envelope bands */ - const int16_t element_mode /* i : element mode */ -); - -void de_interleave_spectrum( - float *coefs, /* i/o: input and output coefficients */ - int16_t length /* i : length of spectrum */ -); - -void inverse_transform( - const float *InMDCT, /* i : input MDCT vector */ - float *Out, /* o : output vector */ - const int16_t IsTransient, /* i : transient flag */ - const int16_t L, /* i : output frame length */ - const int16_t L_inner, /* i : length of the transform */ - const int16_t element_mode /* i : IVAS element mode */ -); - -void window_ola( - const float *ImdctOut, /* i : input */ - float *auOut, /* o : output audio */ - float *OldauOut, /* i/o: audio from previous frame */ - const int16_t L, /* i : length */ - const int16_t right_mode, - const int16_t left_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */ - const int16_t use_bfi_win, /* i : use BFI windowing */ - const int16_t oldHqVoicing, /* i : previous HqVoicing */ - float *oldgapsynth /* i : previous gapsynth */ -); - -void window_ola_ext( - const float *ImdstOut, /* i : input */ - float *auOut, /* o : output audio */ - float *OldauOut, /* i/o: audio from previous frame */ - const int16_t L, /* i : length */ - const int16_t right_mode, - const int16_t left_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */ - const uint16_t kernel_type /* i : transform kernel type */ -); - -void map_quant_weight( - const int16_t normqlg2[], /* i : quantized norms */ - int16_t wnorm[], /* o : weighted norm */ - const int16_t is_transient /* i : transient flag */ -); - -void recovernorm( - const int16_t *const idxbuf, /* i : reordered quantization indices */ - int16_t *ynrm, /* o : recovered quantization indices */ - int16_t *normqlg2, /* o : recovered quantized norms */ - const int16_t nb_sfm /* i : number of subbands */ -); - -void reordvct( - int16_t *y, /* i/o: vector to rearrange */ - const int16_t N, /* i : dimensions */ - int16_t *idx /* o : reordered vector index */ -); - -void bitalloc( - int16_t *y, /* i : reordered norm of sub-vectors */ - int16_t *idx, /* i : reordered sub-vector indices */ - int16_t sum, /* i : number of available bits */ - int16_t N, /* i : number of norms */ - int16_t K, /* i : maximum number of bits per dimension */ - int16_t *r, /* o : bit-allacation vector */ - const int16_t *sfmsize, /* i : Length of bands */ - const int16_t hqswb_clas /* i : signal classification flag */ -); - -/*! r: Integer (truncated) number of allocated bits */ -int16_t BitAllocF( - int16_t *y, /* i : norm of sub-vectors */ - int32_t bit_rate, /* i : bitrate */ - int16_t B, /* i : number of available bits */ - int16_t N, /* i : number of sub-vectors */ - int16_t *R, /* o : bit-allocation indicator */ - int16_t *Rsubband, /* o : sub-band bit-allocation vector (Q3) */ - const int16_t hqswb_clas, /* i : hq swb class */ - const int16_t num_env_bands /* i : Number sub bands to be encoded for HQ_SWB_BWE */ -); - -/*! r: Integer (truncated) number of allocated bits */ -int16_t BitAllocWB( - int16_t *y, /* i : norm of sub-vectors */ - int16_t B, /* i : number of available bits */ - int16_t N, /* i : number of sub-vectors */ - int16_t *R, /* o : bit-allocation indicator */ - int16_t *Rsubband ); /* o : sub-band bit-allocation vector (Q3) */ - -/*! r: Number of low frequency bands */ -int16_t hvq_pvq_bitalloc( - int16_t num_bits, /* i/o: Number of available bits (including gain bits) */ - const int32_t core_brate, /* i : bitrate */ - const int16_t bwidth, /* i : Encoded bandwidth */ - const int16_t *ynrm, /* i : Envelope coefficients */ - const int32_t manE_peak, /* i : Peak energy mantissa */ - const int16_t expE_peak, /* i : Peak energy exponent */ - int16_t *Rk, /* o : bit allocation for concatenated vector */ - int16_t *R, /* i/o: Global bit allocation */ - int16_t *sel_bands, /* o : Selected bands for encoding */ - int16_t *n_sel_bands /* o : No. of selected bands for encoding */ -); - -void floating_point_add_float( - int32_t *mx, /* i/o: mantissa of the addend Q31 */ - int16_t *ex, /* i/o: exponent of the addend Q0 */ - const int32_t my, /* i : mantissa of the adder Q31 */ - const int16_t ey /* i : exponent of the adder Q0 */ -); - -/*! r: Number of bits needed */ -int16_t rc_get_bits2( - const int16_t N, /* i : Number of bits currently used */ - const uint32_t range /* i : Range of range coder */ -); - -void rc_enc_init( - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - int16_t tot_bits /* i : Total bit budget */ -); - -void rc_encode( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - const uint32_t cum_freq, /* i : Cumulative frequency up to symbol */ - const uint32_t sym_freq, /* i : Symbol probability */ - const uint32_t tot /* i : Total cumulative frequency */ -); - -void rc_enc_finish( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ -); - -void rc_enc_bits( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - const uint32_t value, /* i : Value to encode */ - const int16_t bits /* i : Number of bits used */ -); - -void rc_enc_uniform( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - uint32_t value, /* i : Value to encode */ - uint32_t tot /* i : Maximum value */ -); - -void rc_dec_init( - Decoder_State *st, /* i/o: Decoder State */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - int16_t tot_bits /* i : Total bit budget */ -); - -/*! r: Decoded value */ -uint32_t rc_decode( - int16_t *BER_detect, /* o : Bit error detection flag */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - uint32_t tot /* i : Total cumulative frequency */ -); - -void rc_dec_update( - Decoder_State *st, /* i/o: Decoder State */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - const uint32_t cum_freq, /* i : Cumulative frequency */ - const uint32_t sym_freq /* i : Symbol frequency */ -); - -/*! r: Decoded value */ -uint32_t rc_dec_bits( - Decoder_State *st, /* i/o: Decoder State */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - const int16_t bits /* i : Number of bits */ -); - -/*! r: Decoded value */ -uint32_t rc_dec_uniform( - Decoder_State *st, /* i/o: Decoder State */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - const uint32_t tot /* i : Maximum value */ -); - -void rc_dec_finish( - Decoder_State *st, /* i/o: decoder state structure */ - PVQ_DEC_HANDLE hPVQ /* i/o: PVQ decoder handle */ -); - -/*! r: number of bits encoded */ -int16_t pvq_core_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - float coefs_norm[], /* i/o: normalized coefficients to encode */ - float coefs_quant[], /* o : quantized coefficients */ - const int16_t bits_tot, /* i : total number of bits */ - const int16_t nb_sfm, /* i : number of bands */ - const int16_t *sfm_start, /* i : Subband start coefficient */ - const int16_t *sfm_end, /* i : Subband end coefficient */ - const int16_t *sfmsize, /* i : subband width */ - int16_t *R, /* i/o: Bit allocation/Adjusted bit alloc. (Q3) */ - int16_t *Rs, /* i/o: Integer bit allocation */ - int16_t *npulses, /* o : number of pulses */ - int16_t *maxpulse, /* i : maximum pulse per band */ - const int16_t core /* i : number of bands */ -); - -/*! r: number of bits decoded */ -int16_t pvq_core_dec( - Decoder_State *st, /* i/o: Decoder state */ - const int16_t *sfm_start, /* i : indices of first coeffs in the bands */ - const int16_t *sfm_end, /* i : indices of last coeffs in the bands */ - const int16_t *sfmsize, /* i : band sizes */ - float coefs_quant[], /* o : output MDCT */ - const int16_t bits_tot, /* i : bit budget */ - const int16_t nb_sfm, /* i : number of bands */ - int16_t *R, /* i/o: Bit allocation/Adjusted bit alloc.(Q3) */ - int16_t *Rs, /* i/o: Integer bit allocation */ - int16_t *npulses, /* o : number of pulses per band */ - int16_t *maxpulse, /* o : maximum pulse per band */ - const int16_t core /* i : core */ -); - -void pvq_encode( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ - const float *x, /* i : vector to quantize */ - int16_t *y, /* o : quantized vector (non-scaled integer)*/ - float *xq, /* o : quantized vector (scaled float) */ - const int16_t pulses, /* i : number of allocated pulses */ - const int16_t N, /* i : Length of vector */ - const float gain /* i : Gain */ -); - -void pvq_decode( - Decoder_State *st, /* i/o: Decoder State */ - PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ - float *xq, /* o : decoded vector (scaled float) */ - int16_t *y, /* o : decoded vector (non-scaled short)*/ - const int16_t K, /* i : number of allocated pulses */ - const int16_t N, /* i : Length of vector */ - const float gain /* i : Gain */ -); - -void rangeCoderFinalizationFBits( - const int16_t Brc, /* i : Current number of decoded bits */ - const uint32_t INTrc, /* i : Range coder state */ - int16_t *FBits /* i : Fractional finalization bits */ -); - -void bandBitsAdjustment( - const int16_t Brc, /* i : Current number of read quanta in range coder */ - const uint32_t INTrc, /* i : Range coder state */ - const int16_t Bavail, /* i : Available number of quanta */ - const int16_t Nbands, /* i : Number of bands */ - const int16_t D, /* i : Remaining number of bands to encode */ - const int16_t L, /* i : Size of current band */ - const int16_t Bband, /* i : Quanta allocation for current band */ - const int16_t Breserv, /* i : Quanta reservoir */ - int16_t *Bband_adj, /* o : Actual used number of quanta */ - int16_t *Brem, /* o : Quanta remaining */ - int16_t *Breservplus /* o : Quanta pool size */ -); - -void conservativeL1Norm( - const int16_t L, /* i : Length of vector segment */ - const int16_t Qvec, /* i : Assigned number of quanta */ - const int16_t Fcons, /* i : Conservative rounding flag */ - const int16_t Qavail, /* i : Input quanta remaining */ - const int16_t Qreserv, /* i : Input quanta in reservoir */ - const int16_t Dspec, /* i : assigned diracs from bitalloc */ - int16_t *Dvec, /* o : actual number of diracs */ - int16_t *Qspare, /* o : Output quanta remaining */ - int16_t *Qreservplus, /* o : Output quanta in reservoir */ - int16_t *Dspecplus /* o : Output number of diracs */ -); - -void NearOppSplitAdjustment( - const int16_t qband, /* i : quanta for current band */ - const int16_t qzero, /* i : range coder finalization quanta */ - const int16_t Qac, /* i : range coder current quanta */ - const uint32_t INTac, /* i : range coder state */ - const int16_t qglobal, /* i : quanta input */ - const int16_t FlagCons, /* i : conservative rounding flag */ - const int16_t Np, /* i : number of parts */ - const int16_t Nhead, /* i : first part */ - const int16_t Ntail, /* i : remaining parts */ - const int16_t Nnear, /* i : length of near component */ - const int16_t Nopp, /* i : length of opposite component */ - int16_t oppRQ3, /* i : ratio */ - int16_t *qnear, /* o : quantized near */ - int16_t *qopp, /* o : quantized opposite */ - int16_t *qglobalupd /* o : quanta remaining */ -); - -/*! r: Approximate integer division for positive input */ -int32_t intLimCDivPos( - const int32_t NUM, /* i : numerator */ - const int16_t DEN /* i : denominator */ -); - -/*! r: Approximate integer division */ -int16_t shrtCDivSignedApprox_flt( - const int16_t num, /* i : numerator */ - const int16_t den /* i : denominator */ -); - -void QuantaPerDsDirac( - const int16_t td, /* i : Length of vector segment */ - const int16_t dsDiracIndex, /* i : Quanta table index */ - const uint8_t *const *dimFrQuanta, /* i : Quanta lookup table */ - int16_t *Quanta /* i : Quanta */ -); - -void obtainEnergyQuantizerDensity( - const int16_t L_in, /* i : left vector energy */ - const int16_t R_in, /* i : right vector energy */ - int16_t *Density /* o : quantizer density */ -); - -void densityAngle2RmsProjDec( - const int16_t D, /* i : density */ - const int16_t indexphi, /* i : decoded index from AR dec */ - int16_t *oppQ15, /* o : opposite */ - int16_t *nearQ15, /* o : near */ - int16_t *oppRatioQ3 /* o : ratio */ -); - -void densityAngle2RmsProjEnc( - const int16_t D, /* i : density */ - const int16_t phiQ14uq, /* i : angle */ - int16_t *indexphi, /* o : index */ - int16_t *oppQ15, /* o : opposite */ - int16_t *nearQ15, /* o : near */ - int16_t *oppRatioQ3 /* o : ratio */ -); - -void env_adj( - const int16_t *pulses, /* i : number of pulses per band */ - const int16_t length, /* i : length of spectrum */ - const int16_t last_sfm, /* i : Index of last band */ - float *adj, /* o : Adjustment factors for the envelope */ - const float env_stab, /* i : Envelope stability parameter */ - const int16_t *sfmsize /* i : Length of bands */ -); - -float env_stability( - const int16_t *ynrm, /* i : Norm vector for current frame */ - const int16_t nb_sfm, /* i : Number of sub-bands */ - int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ - int16_t *mem_env_delta, /* i/o: Envelope stability memory for smoothing*/ - const int16_t core_switching_flag /* i : Core switching flag */ -); - -/*! r: New speech/music state */ -float env_stab_smo( - float env_stab, /* i : env_stab value */ - float *env_stab_state_p, /* i/o: env_stab state probabilities */ - int16_t *ho_cnt /* i/o: hangover counter for speech state */ -); -void core_switching_post_enc( - Encoder_State *st, /* i/o: encoder state structure */ - // const float *old_inp_12k8, /* i : old input signal @12.8kHz */ - float *old_inp_12k8, /* i : old input signal @12.8kHz */ - // const float *old_inp_16k, /* i : old input signal @16kHz */ - float *old_inp_16k, /* i : old input signal @16kHz */ - // const float A[] /* i : unquant. LP filter coefs. */ - Word16 A_fx[], /* i : unquant. LP filter coefs. */ - Word16 Q_new ); -ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t output_frame, /* i : frame length */ - const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ - const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const int16_t nchan_out, /* i : number of output channels */ - const int16_t last_element_mode /* i : element mode of previous frame */ -); - -ivas_error core_switching_pre_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t output_frame, /* i : frame length */ - const int32_t last_core_brate_st0, /* i : channel 0 last core bitrate */ - const int16_t nchan_out, /* i : number of output channels */ - const int16_t last_element_mode, /* i : last_element_mode */ - const int32_t last_element_brate /* i : last element bitrate */ -); - -void bandwidth_switching_detect( - Decoder_State *st /* i/o: decoder state structure */ -); - -void bw_switching_pre_proc( - Decoder_State *st, /* i/o: decoder state structure */ - const float *old_syn_12k8_16k, /* i : ACELP core synthesis @ 12.8kHz or 16kHz */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t nchan_out /* i : number of output channels */ -); - -void updt_bw_switching( - Decoder_State *st, /* i/o: decoder state structure */ - const float *synth /* i : float synthesis signal */ -); - -void swb_tbe_reset( - float mem_csfilt[], - float mem_genSHBexc_filt_down_shb[], - float state_lpc_syn[], - float syn_overlap[], - float state_syn_shbexc[], - float *tbe_demph, - float *tbe_premph, - float mem_stp_swb[], - float *gain_prec_swb ); - -void swb_tbe_reset_synth( - float genSHBsynth_Hilbert_Mem[], - float genSHBsynth_state_lsyn_filt_shb_local[] ); - -void find_td_envelope( - const float inp[], - const int16_t len, - const int16_t len_h, - float mem_h[], - float out[] ); - -void fb_tbe_reset_enc( - float elliptic_bpf_2_48k_mem[][4], - float *prev_fb_energy ); - -void fb_tbe_reset_synth( - float fbbwe_hpf_mem[][4], - float *prev_fbbwe_ratio ); - -void wb_tbe_extras_reset( - float mem_genSHBexc_filt_down_wb2[], - float mem_genSHBexc_filt_down_wb3[] ); - -void wb_tbe_extras_reset_synth( - float state_lsyn_filt_shb[], - float state_lsyn_filt_dwn_shb[], - float mem_resamp_HB[] ); - -void tbe_celp_exc_flt( - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - float *bwe_exc, /* i/o: BWE excitation */ - const int16_t L_frame, /* i : frame length */ - const int16_t L_subfr, /* i : subframe length */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t T0, /* i : integer pitch lag */ - const int16_t T0_frac, /* i : fraction of lag */ - float *error, /* i/o: error */ - const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */ -); - -void prep_tbe_exc( - const int16_t L_frame, /* i : length of the frame */ - const int16_t L_subfr, /* i : subframe length */ - const int16_t i_subfr, /* i : subframe index */ - const float gain_pit, /* i : Pitch gain */ - const float gain_code, /* i : algebraic codebook gain */ - const float code[], /* i : algebraic excitation */ - const float voice_fac, /* i : voicing factor */ - float *voice_factors, /* o : TBE voicing factor */ - float bwe_exc[], /* i/o: excitation for TBE */ - const float gain_preQ, /* i : prequantizer excitation gain */ - const float code_preQ[], /* i : prequantizer excitation */ - const int16_t T0, /* i : integer pitch variables */ - const int16_t coder_type, /* i : coding type */ - const int32_t core_brate, /* i : core bitrate */ - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - const int16_t flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */ -); - -void synthesise_fb_high_band( - const float excitation_in[], /* i : full band excitation */ - float output[], /* o : high band speech - 14.0 to 20 kHz */ - const float fb_exc_energy, /* i : full band excitation energy */ - const float ratio_float, /* i : energy ratio */ - const int16_t L_frame, /* i : ACELP frame length */ - const int16_t bfi, /* i : BFI flag */ - float *prev_fbbwe_ratio, /* o : previous frame energy for FEC */ - float bpf_memory[][4] /* i/o: memory for elliptic bpf 48k */ -); - -void elliptic_bpf_48k_generic( - const float input[], /* i : input signal */ - float output[], /* o : output signal */ - float memory[][4], /* i/o: 4 arrays for memory */ - const float full_band_bpf[][5] /* i : filter coefficients b0,b1,b2,a0,a1,a2 */ -); - -void HQ_FEC_processing( - Decoder_State *st, /* i/o: decoder state structure */ - float *t_audio_q, /* o : MDCT coeffs. (for synthesis) */ - int16_t is_transient, /* i : Old flag for transient */ - float ynrm_values[][MAX_PGF], /* i : Old average Norm values for each group of bands */ - float r_p_values[][MAX_ROW], /* i : Computed y-intercept and slope by Regression */ - int16_t num_Sb, /* i : Number of sub-band group */ - int16_t nb_sfm, /* i : Number of sub-band */ - int16_t *Num_bands_p, /* i : Number of coeffs. for each sub-band */ - int16_t output_frame, /* i : Frame size */ - const int16_t *sfm_start, /* i : Start of bands */ - const int16_t *sfm_end /* i : End of bands */ -); - -void HQ_FEC_Mem_update( - Decoder_State *st, /* i/o: decoder state structure */ - const float *t_audio_q, - float *normq, - int16_t *ynrm, - const int16_t *Num_bands_p, - const int16_t is_transient, - const int16_t hqswb_clas, - const int16_t c_switching_flag, - const int16_t nb_sfm, - const int16_t num_Sb, - float *mean_en_high, - const int16_t hq_core_type, /* i : normal or low-rate MDCT(HQ) core */ - const int16_t output_frame /* i : Frame size */ -); - -void time_domain_FEC_HQ( - Decoder_State *st, /* i : Decoder State */ - float *wtda_audio, /* i : input */ - float *out, /* o : output audio */ - const float mean_en_high, /* i : transient flag */ - const int16_t output_frame /* i : Frame size */ -); - -void save_synthesis_hq_fec( - Decoder_State *st, /* i/o: decoder state structure */ - const float *output, /* i : decoded synthesis */ - const int16_t output_frame, /* i : decoded synthesis */ - CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */ -); - -void Next_good_after_burst_erasures( - const float *ImdctOut, /* i : input */ - float *auOut, /* o : output audio */ - float *OldauOut, /* i/o: audio from previous frame */ - const int16_t ol_size /* i : overlap size */ -); - - -void reset_preecho_dec( - HQ_DEC_HANDLE hHQ_core /* i/o: HQ decoder handle */ -); - -void preecho_sb( - const int32_t core_brate, /* i : core bitrate */ - const float wtda_audio[], /* i : imdct signal */ - float *rec_sig, /* i : reconstructed signal, output of the imdct transform */ - const int16_t framelength, /* i : frame length */ - float *memfilt_lb, /* i/o: memory */ - float *mean_prev_hb, /* i/o: memory */ - float *smoothmem, /* i/o: memory */ - float *mean_prev, /* i/o: memory */ - float *mean_prev_nc, /* i/o: memory */ - float *wmold_hb, /* i/o: memory */ - int16_t *prevflag, /* i/o: flag */ - int16_t *pastpre, /* i/o: flag */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void hq2_core_configure( - const int16_t frame_length, /* i : frame length */ - const int16_t num_bits, /* i : number of bits */ - const int16_t is_transient, /* i : transient flag */ - int16_t *bands, - int16_t *length, - int16_t band_width[], - int16_t band_start[], - int16_t band_end[], - Word32 *L_qint, /* o : Q29 */ - Word16 *eref_fx, /* o : Q10 */ - Word16 *bit_alloc_weight_fx, /* o : Q13 */ - int16_t *gqlevs, - int16_t *Ngq, - int16_t *p2a_bands, - float *p2a_th, - float *pd_thresh, - float *ld_slope, - float *ni_coef, - float *ni_pd_th, - int32_t bwe_br ); - -void hq_lr_enc( - Encoder_State *st, /* i/o: encoder state structure */ - float t_audio[], /* i/o: transform-domain coefs. */ - const int16_t inner_frame, /* i : inner frame length */ - int16_t *num_bits, /* i/o: number of available bits */ - const int16_t is_transient /* i : transient flag */ -); - -void hq_lr_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float yout[], /* o : transform-domain output coefs. */ - const int16_t inner_frame, /* i : inner frame length */ - int16_t num_bits, /* i : number of available bits */ - int16_t *is_transient /* o : transient flag */ -); - -void hq2_bit_alloc( - const float band_energy[], /* i : band energy of each subband */ - const int16_t bands, /* i : total number of subbands in a frame */ - Word32 L_Rk[], /* i/o: Bit allocation/Adjusted bit alloc. */ - int16_t *bit_budget, /* i/o: bit bugdet */ - int16_t *p2a_flags, /* i : HF tonal indicator */ - const Word16 weight_fx, /* i : weight (Q13) */ - const int16_t band_width[], /* i : Sub band bandwidth */ - const int16_t num_bits, /* i : available bits */ - const int16_t hqswb_clas, /* i : HQ2 class information */ - const int16_t bwidth, /* i : input bandwidth */ - const int16_t is_transient /* i : indicator HQ_TRANSIENT or not */ -); - -void hq2_noise_inject( - float y2hat[], - const int16_t band_start[], - const int16_t band_end[], - const int16_t band_width[], - float Ep[], - float Rk[], - const int16_t npulses[], - int16_t ni_seed, - const int16_t bands, - const int16_t ni_start_band, - const int16_t bw_low, - const int16_t bw_high, - const float enerL, - const float enerH, - float last_ni_gain[], - float last_env[], - int16_t *last_max_pos_pulse, - int16_t *p2a_flags, - int16_t p2a_bands, - const int16_t hqswb_clas, - const int16_t bwidth, - const int32_t bwe_br ); - -void mdct_spectrum_denorm( - const int32_t inp_vector[], - float y2[], - const int16_t band_start[], - const int16_t band_end[], - const int16_t band_width[], - const float band_energy[], - const int16_t npulses[], - const int16_t bands, - const float ld_slope, - const float pd_thresh ); - -void reverse_transient_frame_energies( - float band_energy[], /* o : band energies */ - const int16_t bands /* i : number of bands */ -); - - -void hvq_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t num_bits, /* i : Number of available bits */ - const int32_t core_brate, /* i : Core bitrate */ - const int16_t *ynrm, /* i : Envelope coefficients */ - int16_t *R, /* i/o: Bit allocation/updated bit allocation */ - float *noise_level, /* o : Noise level */ - int16_t *peak_idx, /* o : Peak position vector */ - int16_t *Npeaks, /* o : Total number of peaks */ - float *coefsq_norm, /* o : Output vector */ - const int16_t core /* i : Core */ -); - -void hq_configure_bfi( - int16_t *nb_sfm, /* o : Number of sub bands */ - int16_t *num_Sb, /* o : Number of FEC sub bands ? */ - int16_t *num_bands_p, /* o : FEC sub bands */ - const int16_t **sfmsize, /* o : Subband bandwidths */ - const int16_t **sfm_start, /* o : Subband start coefficients */ - const int16_t **sfm_end /* o : Subband end coefficients */ -); - -void swb_bwe_enc_lr( - Encoder_State *st, /* i/o: encoder state structure */ - const float m_core[], /* i : core synthesis (MDCT) */ - const float m_orig[], /* i/o: scaled orig signal (MDCT) */ - float m[], /* o : output, SWB part (MDCT) */ - const int32_t total_brate, /* i : total bitrate for selecting subband pattern */ - int16_t BANDS, - int16_t *band_start, - int16_t *band_end, - float *band_energy, - int16_t *p2a_flags, - const int16_t hqswb_clas, - int16_t lowlength, - int16_t highlength, - int16_t *prev_frm_index, - const int16_t har_bands, - int16_t *prev_frm_hfe2, - int16_t *prev_stab_hfe2, - int16_t band_width[], - const float y2_ni[], - int16_t *ni_seed ); - -void swb_bwe_dec_lr( - Decoder_State *st, /* i/o: decoder state structure */ - const float m_core[], /* i : lowband synthesis */ - float m[], /* o : highband synthesis with lowband zeroed */ - const int32_t total_brate, /* i : total bitrate for selecting subband pattern */ - int16_t BANDS, - int16_t *band_start, - int16_t *band_end, - float *band_energy, - int16_t *p2a_flags, - const int16_t hqswb_clas, - int16_t lowlength, - int16_t highlength, - const int16_t har_bands, - int16_t *prev_frm_hfe2, - int16_t *prev_stab_hfe2, - int16_t band_width[], - const float y2_ni[], - int16_t *ni_seed ); - -int16_t get_usebit_npswb( - const int16_t hqswb_clas ); - -void GetPredictedSignal( - const float *predBuf, /* i : prediction buffer */ - float *outBuf, /* o : output buffer */ - const int16_t lag, /* i : prediction buffer offset */ - const int16_t fLen, /* i : length of loop (output) */ - const float gain /* i : gain to be applied */ -); - -void convert_lagIndices_pls2smp( - int16_t lagIndices_in[], - int16_t nBands_search, - int16_t lagIndices_out[], - const float sspectra[], - const int16_t sbWidth[], - const int16_t fLenLow ); - -void FindNBiggest2_simple( - const float *inBuf, /* i : input buffer (searched) */ - GainItem *g, /* o : N biggest components found */ - const int16_t nIdx, /* i : search length */ - int16_t *n, /* i : number of components searched (N biggest) */ - const int16_t N_NBIGGESTSEARCH ); - -void updat_prev_frm( - float y2[], - float t_audio[], - const int32_t bwe_br, - const int16_t length, - const int16_t inner_frame, - const int16_t bands, - const int16_t bwidth, - const int16_t is_transient, - const int16_t hqswb_clas, - int16_t *prev_hqswb_clas, - int16_t *prev_SWB_peak_pos, - int16_t prev_SWB_peak_pos_tmp[], - int16_t *prev_frm_hfe2, - int16_t *prev_stab_hfe2, - const int16_t bws_cnt ); - -void hf_parinitiz( - const int32_t total_brate, - const int16_t hqswb_clas, - int16_t lowlength, - int16_t highlength, - int16_t wBands[], - const int16_t **subband_search_offset, - const int16_t **subband_offsets, - int16_t *nBands, - int16_t *nBands_search, - int16_t *swb_lowband, - int16_t *swb_highband ); - -float spectrumsmooth_noiseton( - float spectra[], - const float spectra_ni[], - float sspectra[], - float sspectra_diff[], - float sspectra_ni[], - const int16_t fLenLow, - int16_t *ni_seed ); - -void noiseinj_hf( - float xSynth_har[], - const float th_g[], - const float band_energy[], - float *prev_En_sb, - const int16_t p2a_flags[], - const int16_t BANDS, - const int16_t band_start[], - const int16_t band_end[], - const int16_t fLenLow ); - -void noise_extr_corcod( - float spectra[], - const float spectra_ni[], - float sspectra[], - float sspectra_diff[], - float sspectra_ni[], - const int16_t fLenLow, - int16_t prev_hqswb_clas, - float *prev_ni_ratio ); - -void genhf_noise( - float noise_flr[], - float xSynth_har[], - float *predBuf, - int16_t bands, /* i : total number of subbands in a frame */ - int16_t harmonic_band, /* i : Number of LF harmonic frames */ - int16_t har_freq_est2, - int16_t pos_max_hfe2, - int16_t *pul_res, - GainItem pk_sf[], - const int16_t fLenLow, - const int16_t fLenHigh, - const int16_t sbWidth[], - const int16_t lagIndices[], - const int16_t subband_offsets[], - const int16_t subband_search_offset[] ); - -void ton_ene_est( - float xSynth_har[], - float be_tonal[], - float band_energy[], - int16_t band_start[], - int16_t band_end[], - int16_t band_width[], - const int16_t fLenLow, - const int16_t fLenHigh, - int16_t bands, - int16_t har_bands, - float ni_lvl, - GainItem pk_sf[], - int16_t *pul_res ); - -void Gettonl_scalfact( - float *outBuf, /* o : synthesized spectrum */ - const float *codbuf, /* i : core coder */ - const int16_t fLenLow, /* i : lowband length */ - const int16_t fLenHigh, /* i : highband length */ - int16_t harmonic_band, /* i : Number of LF harmonic frames */ - int16_t bands, /* i : total number of subbands in a frame */ - float *band_energy, /* i : band energy of each subband */ - int16_t *band_start, /* i : subband start indices */ - int16_t *band_end, /* i : subband end indices */ - const int16_t p2aflags[], - float be_tonal[], - GainItem *pk_sf, - int16_t *pul_res ); - -void SpectrumSmoothing( - float *inBuf, - float *outBuf, - const int16_t fLen, - const float th_cut ); - -void hq2_bit_alloc_har( - float *y, /* i : band energy of sub-vectors */ - int16_t B, /* i : number of available bits */ - int16_t N, /* i : number of sub-vectors */ - Word32 *L_Rsubband, - int16_t p2a_bands, - int32_t core_brate, /* i : core bitrate */ - int16_t p2a_flags[], - int16_t band_width[] ); - -void GetSynthesizedSpecThinOut( - const float *predBuf, - float *outBuf, - const int16_t nBands, - const int16_t *sbWidth, - const int16_t *lagIndices, - const float *lagGains, - const int16_t predBufLen ); - -void return_bits_normal2( - int16_t *bit_budget, - const int16_t p2a_flags[], - const int16_t bands, - const int16_t bits_lagIndices[] ); - -void GetlagGains( - const float *predBuf, - const float *band_energy, - const int16_t nBands, - const int16_t *sbWidth, - const int16_t *lagIndices, - const int16_t predBufLen, - float *lagGains ); - -void preset_hq2_swb( - const int16_t hqswb_clas, - const int16_t band_end[], - int16_t *har_bands, - int16_t p2a_bands, - const int16_t length, - const int16_t bands, - int16_t *lowlength, - int16_t *highlength, - float m[] ); - -void post_hq2_swb( - const float m[], - const int16_t lowlength, - const int16_t highlength, - const int16_t hqswb_clas, - const int16_t har_bands, - const int16_t bands, - const int16_t p2a_flags[], - const int16_t band_start[], - const int16_t band_end[], - float y2[], - int16_t npulses[] ); - -void har_denorm_pulcnt( - float spectra[], /* i/o: MDCT domain spectrum */ - const int16_t band_start[], /* i : Number subbands/Frame */ - const int16_t band_end[], /* i : Band Start of each SB */ - const float band_energy[], /* i : Band end of each SB */ - const int16_t band_width[], - const int16_t npulses[], - const int16_t har_bands /* i : No. of harmonic bands */ -); - -int16_t har_est( - float spectra[], - const int16_t N, - int16_t *har_freq_est1, - int16_t *har_freq_est2, - int16_t *flag_dis, - int16_t *prev_frm_hfe2, - const int16_t subband_search_offset[], - const int16_t sbWidth[], - int16_t *prev_stab_hfe2 ); - -void spt_shorten_domain_pre( - const int16_t band_start[], - const int16_t band_end[], - const int16_t prev_SWB_peak_pos[], - const int16_t BANDS, - const int32_t bwe_br, - int16_t new_band_start[], - int16_t new_band_end[], - int16_t new_band_width[] ); - -void spt_shorten_domain_band_save( - const int16_t bands, - const int16_t band_start[], - const int16_t band_end[], - const int16_t band_width[], - int16_t org_band_start[], - int16_t org_band_end[], - int16_t org_band_width[] ); - -void spt_shorten_domain_band_restore( - const int16_t bands, - int16_t band_start[], - int16_t band_end[], - int16_t band_width[], - const int16_t org_band_start[], - const int16_t org_band_end[], - const int16_t org_band_width[] ); - -void spt_swb_peakpos_tmp_save( - const float y2[], - const int16_t bands, - const int16_t band_start[], - const int16_t band_end[], - int16_t prev_SWB_peak_pos_tmp[] ); - -void hq_ecu( - const float *prevsynth, /* i : buffer of previously synthesized signal */ - float *ecu_rec, /* o : reconstructed frame in tda domain */ - int16_t *time_offs, /* i/o: Sample offset for consecutive frame losses*/ - float *X_sav, /* i/o: Stored spectrum of prototype frame */ - int16_t *num_p, /* i/o: Number of identified peaks */ - int16_t *plocs, /* i/o: Peak locations */ - float *plocsi, /* i/o: Interpolated peak locations */ - const float env_stab, /* i : Envelope stability parameter */ - int16_t *last_fec, /* i/o: Flag for usage of pitch dependent ECU */ - const int16_t ph_ecu_HqVoicing, /* i : HQ Voicing flag */ - int16_t *ph_ecu_active, /* i : Phase ECU active flag */ - float *gapsynth, /* o : Gap synthesis */ - const int16_t prev_bfi, /* i : indicating burst frame error */ - const int16_t old_is_transient[2], /* i : flags indicating previous transient frames*/ - float *mag_chg_1st, /* i/o: per band magnitude modifier for transients*/ - float Xavg[LGW_MAX], /* i/o: Frequency group average gain to fade to */ - float *beta_mute, /* o : Factor for long-term mute */ - const int16_t output_frame, /* i : frame length */ - Decoder_State *st /* i/o: decoder state structure */ -); - -void peakfinder( - const float *x0, /* i : vector from which the maxima will be found */ - const int16_t len0, /* i : length of input vector */ - int16_t *plocs, /* o : the indicies of the identified peaks in x0 */ - int16_t *cInd, /* o : number of identified peaks */ - const float sel, /* i : The amount above surrounding data for a peak to be identified */ - const int16_t endpoints /* i : Flag to include endpoints in peak search */ -); - -/*! r: interpolated maximum position */ -float imax_pos( - const float *y /* i : Input vector for peak interpolation */ -); - - -void fft3( - const float X[], /* i : input frame */ - float Y[], /* o : DFT of input frame */ - const int16_t n /* i : block length (must be radix 3) */ -); - -void ifft3( - const float X[], /* i : input frame */ - float Y[], /* o : iDFT of input frame */ - const int16_t n /* i : block length (must be radix 3) */ -); - -/*! r: updated estimate of background noise */ -void minimumStatistics( - float *noiseLevelMemory, /* i/o: internal state */ - int16_t *noiseLevelIndex, /* i/o: internal state */ - int16_t *currLevelIndex, /* i/o: internal state (circular buffer) */ - float *noiseEstimate, /* i/o: previous estimate of background noise */ - float *lastFrameLevel, /* i/o: level of the last frame */ - float currentFrameLevel, /* i : level of the current frame */ - const float minLev, /* i : minimum level */ - const int16_t buffSize /* i : buffer size */ -); - -void E_ACELP_toeplitz_mul( - const float R[], - const float c[], - float d[] ); - -void E_ACELP_innovative_codebook( - const float *exc, /* i : pointer to the excitation frame */ - const int16_t T0, /* i : integer pitch lag */ - const int16_t T0_frac, /* i : fraction of lag */ - const int16_t T0_res, /* i : pitch resolution */ - const float pitch_gain, /* i : adaptive codebook gain */ - const float tilt_code, /* i : tilt factor */ - ACELP_config *acelp_cfg, /* i/o: configuration of the ACELP */ - const int16_t i_subfr, /* i : subframe index */ - const float *Aq, /* i : quantized LPC coefficients */ - const float *h1, /* i : impulse response of weighted synthesis filter */ - const float *xn, /* i : Close-loop Pitch search target vector */ - const float *cn, /* i : Innovative codebook search target vector */ - const float *y1, /* i : zero-memory filtered adaptive excitation */ - float *y2, /* o : zero-memory filtered algebraic excitation */ - const int16_t acelpautoc, /* i : autocorrelation mode enabled */ - int16_t **pt_indice, /* i/o: quantization indices pointer */ - float *code, /* o : innovative codebook */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t last_L_frame, /* i : length of the last frame */ - const int32_t total_brate /* i : total bitrate */ -); - -int16_t E_ACELP_code43bit( - const float code[], - uint32_t *ps, - int16_t *p, - uint16_t idxs[] ); -void D_ACELP_indexing_ivas( - float code[], - PulseConfig config, - const int16_t num_tracks, - int16_t prm[], - int16_t *BER_detect ); - -void D_ACELP_decode_43bit( - uint16_t idxs[], - float code[], - int16_t *pulsestrack ); - -void fcb_pulse_track_joint_decode_ivas( - uint16_t *idxs, - const int16_t wordcnt, - uint32_t *index_n, - const int16_t *pulse_num, - const int16_t track_num ); - -void lag_wind_flt( - float r[], /* i/o: autocorrelations */ - const int16_t m, /* i : order of LP filter */ - const int32_t sr_core, /* i : sampling rate */ - const int16_t strength /* i : LAGW_WEAK, LAGW_MEDIUM, or LAGW_STRONG */ -); - -void adapt_lag_wind_fx( - float r[], /* i/o: autocorrelations */ - const int16_t m, /* i : order of LP filter */ - const int16_t Top, /* i : open loop pitch lags from curr. frame (or NULL if n/a) */ - const float Tnc, /* i : open loop pitch gains from curr. frame (NULL if n/a) */ - const int32_t sr_core /* i : core sampling rate */ -); - -void core_coder_reconfig( - Encoder_State *st, /* i/o: encoder state structure */ - const int32_t last_total_brate /* i : last total bitrate */ -); - -void core_coder_mode_switch( - Encoder_State *st, /* i/o: encoder state structure */ - const int32_t last_total_brate, /* i : last bitrate */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ -); - -void enc_acelp_tcx_main( - Encoder_State *st, /* i/o: encoder state structure */ - const float new_samples[], /* i : new samples */ - float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ - const float lsp_new[M], /* i : LSPs at the end of the frame */ - const float lsp_mid[M], /* i : LSPs at the middle of the frame */ - float bwe_exc_extended[], /* i/o: bandwidth extended excitation */ - float *voice_factors, /* o : voicing factors */ - float pitch_buf[], /* o : floating pitch for each subframe */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void getTCXMode_ivas( - Decoder_State *st, /* i/o: decoder memory state */ - Decoder_State *st0, /* i : bitstream */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ -); - -void getTCXWindowing_ivas( - const Word16 core, /* i : current frame mode */ - const Word16 last_core, /* i : last frame mode */ - const Word16 element_mode, /* i : element mode */ - TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ - Decoder_State *st0 /* i : bitstream */ -); - -void getLPCparam_ivas( - Decoder_State *st, /* i/o: decoder memory state */ - int16_t param_lpc[], /* o : LTP parameters */ - Decoder_State *st0, /* i : bitstream */ - const int16_t ch, /* i : channel */ - const int16_t sns_low_br_mode /* i : SNS low-bitrate mode */ -); - -void getTCXparam_ivas( - Decoder_State *st, /* i/o: Decoder State handle */ - Decoder_State *st0, /* i : bitstream */ - CONTEXT_HM_CONFIG hm_cfg, /* i/o: HM config */ - int16_t param[], /* o : decoded parameters */ - const int16_t bits_common, /* i : number of common bits */ - const int16_t start_bit_pos, /* i : position of the start bit */ - const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ - int16_t p_param[2], /* o : pointer to parameters for next round of bs reading*/ - int16_t nTnsBitsTCX10[2], - const int16_t pre_past_flag ); - -void pitch_pred_linear_fit_flt( - const int16_t nbLostCmpt, /* i : bfi counter */ - const int16_t last_good, /* i : last classification type */ - float *old_pitch_buf, /* i : pitch lag buffer */ - float *old_fpitch, /* i/o: pitch used for initial ACB generation */ - float *T0_out, /* o : estimated close loop pitch */ - const int16_t pit_min, /* i : Minimum pitch lag */ - const int16_t pit_max, /* i : Maximum pitch lag */ - float *mem_pitch_gain, /* i : lag pitch gain [0] is the most recent subfr lag */ - const int16_t limitation, - const int16_t plc_use_future_lag, /* i : number of subframes to predict */ - int16_t *extrapolationFailed, /* o : flag if extrap decides not to change the pitch */ - const int16_t nb_subfr /* i : number of ACELP subframes */ -); - -void get_subframe_pitch_flt( - const int16_t nSubframes, /* i : number of subframes */ - float pitchStart, /* i : starting pitch lag (in subframe -1) */ - float pitchEnd, /* i : ending pitch lag (in subframe nSubframes-1) */ - float *pitchBuf /* o : interpolated pitch lag per subframe */ -); - -void core_encode_openloop( - Encoder_State *st, /* i/o: encoder state structure */ - const float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ - const float lsp_new[M], /* i : LSPs at the end of the frame */ - const float lsp_mid[M], /* i : LSPs at the middle of the frame */ - float *pitch_buf, /* i/o: floating pitch values for each subfr*/ - float *voice_factors, /* o : voicing factors */ - float *ptr_bwe_exc, /* o : excitation for SWB TBE */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void core_acelp_tcx20_switching( - Encoder_State *st, /* i/o: encoder state structure */ - float non_staX, /* i : unbound non-stationarity for sp/mu clas */ - float *pitch_fr, /* i/o: fraction pitch values */ - float *voicing_fr, /* i/o: fractional voicing values */ - const float currTempFlatness, /* i : flatness */ - const float lsp_mid[M], /* i : LSPs at the middle of the frame */ - const float stab_fac /* i : LP filter stability */ -); - -void core_encode_twodiv( - Encoder_State *st, /* i/o: coder memory state */ - const float new_samples[], /* i : new samples */ - float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void core_encode_update( - Encoder_State *st /* i/o: encoder state structure */ -); - -void core_encode_update_cng( - Encoder_State *st, /* i/o: encoder state structure */ - float *timeDomainBuffer, - float *A, - const float Aw[] /* i : weighted A(z) unquant. for subframes*/ -); - -void core_signal_analysis_high_bitrate( - const float *new_samples, - const int16_t T_op[3], /* i : open-loop pitch values for quantiz. */ - float lsp_new[], - float lsp_mid[], - Encoder_State *st, - float *mdst_spectrum[2], - int16_t pTnsSize[], - int16_t pTnsBits[], - int16_t param_core[], - int16_t *ltpBits, - float *windowed_samples, /* i/o: backup of windowed time signal */ - const int16_t L_frame, - const int16_t L_frameTCX, - const int16_t last_element_mode, - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void encode_acelp_gains( - const float *code, - const int16_t gains_mode, - const float mean_ener_code, - const int16_t clip_gain, - ACELP_CbkCorr *g_corr, - float *gain_pit, - float *gain_code, - int16_t **pt_indice, - float *past_gcode, - float *gain_inov, - const int16_t L_subfr, - float *code2, - float *gain_code2, - const int16_t noisy_speech_flag ); - -int16_t gain_enc_gacelp_uv( - const float *code, /* i : algebraic excitation */ - const float *code2, /* i : gaussian excitation */ - const int16_t lcode, /* i : Subframe size */ - const float mean_ener, /* i : quantized mean energy of the frame */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - float *gain_code2, /* o : quantized codebook gain */ - ACELP_CbkCorr *coeff, /* i/o: correlations , -2,, -2 and 2 */ - float *past_gcode, /* i/o: past gain of code */ - float *gain_inov, /* o : unscaled innovation gain */ - const int16_t noisy_speech_flag /* i : noisy speech flag */ -); - -int16_t Mode2_gain_enc_mless( - const float *code, /* i : algebraic excitation */ - const int16_t lcode, /* i : Subframe size */ - float *gain_pit, /* o : quantized pitch gain */ - float *gain_code, /* o : quantized codebook gain */ - ACELP_CbkCorr *coeff, /* i/o: correlations , -2,, -2 and 2 */ - const float mean_ener, /* i : mean_ener defined in open-loop (3 bits) */ - const int16_t clip_gain, /* i : gain pitch clipping flag (1 = clipping) */ - float *past_gcode, /* i/o: past gain of code */ - float *gain_inov, /* o : unscaled innovation gain */ - const int16_t coder_type /* i : type of coder */ -); - -void decode_acelp_gains( - const float *code, - const int16_t gains_mode, - const float mean_ener_code, - float *gain_pit, - float *gain_code, - int16_t **pt_indice, - float *past_gpit, - float *past_gcode, - float *gain_inov, - const int16_t L_subfr, - float *code2, - float *gain_code2 ); - -void gain_dec_gacelp_uv( - int16_t index, /* i/o: Quantization index vector */ - const float *code, /* i : algebraic code excitation */ - const float *code2, /* i : algebraic code excitation */ - const float mean_ener, /* i : mean energy */ - const int16_t lcode, /* i : Subframe size */ - float *gain_pit, /* o : Quantized pitch gain */ - float *gain_code, /* o : Quantized codebook gain */ - float *gain_code2, /* o : Quantized codebook gain */ - float *past_gpit, /* i/o: past gain of pitch */ - float *past_gcode, /* i/o: past energy of code */ - float *gain_inov /* o : unscaled innovation gain */ -); - -void limit_T0_voiced_ivas( - const int16_t nbits, - const int16_t res, - const int16_t T0, /* i : rough pitch estimate around which the search is done */ - const int16_t T0_frac, /* i : pitch estimate fractional part */ - const int16_t T0_res, /* i : pitch resolution */ - int16_t *T0_min, /* o : lower pitch limit */ - int16_t *T0_min_frac, /* o : lower pitch limit */ - int16_t *T0_max, /* o : higher pitch limit */ - int16_t *T0_max_frac, /* o : higher pitch limit */ - const int16_t pit_min, /* i : Minimum pitch lag */ - const int16_t pit_max /* i : Maximum pitch lag */ -); - - -/*! r: floating pitch value */ -float Mode2_pit_decode_flt( - const int16_t coder_type, /* i : coding model */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t L_subfr, /* i : sub-frame length */ - int16_t **pt_indice, /* i/o: quantization indices pointer */ - int16_t *T0, /* o : close loop integer pitch */ - int16_t *T0_frac, /* o : close loop fractional part of the pitch */ - int16_t *T0_res, /* i/o: pitch resolution */ - int16_t *T0_min, /* i/o: lower limit for close-loop search */ - int16_t *T0_min_frac, /* i/o: lower limit for close-loop search */ - int16_t *T0_max, /* i/o: higher limit for close-loop search */ - int16_t *T0_max_frac, /* i/o: higher limit for close-loop search */ - const int16_t pit_min, - const int16_t pit_fr1, - const int16_t pit_fr1b, - const int16_t pit_fr2, - const int16_t pit_max, - const int16_t pit_res_max ); - -void Mode2_abs_pit_dec_flt( - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac, /* o : pitch fraction */ - int16_t *T0_res, /* o : pitch resolution */ - int16_t **pt_indice, /* i/o: pointer to Vector of Q indexes */ - const int16_t pit_min, - const int16_t pit_fr1, - const int16_t pit_fr2, - const int16_t pit_res_max ); - -void Mode2_delta_pit_dec_flt( - int16_t *T0, /* o : integer pitch lag */ - int16_t *T0_frac, /* o : pitch fraction */ - int16_t T0_res, /* i : pitch resolution */ - int16_t *T0_min, /* i : delta search min */ - int16_t *T0_min_frac, /* i : delta search min */ - int16_t **pt_indice /* i/o: pointer to Vector of Q indexes */ -); - -void formant_post_filt_ivas( - PFSTAT_HANDLE hPFstat, /* i/o: Post filter related memories */ - float *synth_in, /* i : 12k8 synthesis */ - const float *Aq, /* i : LP filter coefficient */ - float *synth_out, /* i/o: input signal */ - const int16_t L_frame, /* i : frame length */ - const int16_t L_subfr, /* i : sub-frame length */ - const float lp_noise, /* i : background noise energy */ - const int32_t brate, /* i : bitrate */ - const int16_t off_flag /* i : Off flag */ -); - - -int16_t dlpc_avq( - int16_t *index, /* i : Quantization indices */ - float *LSF_Q, /* o : Quantized LSF vectors */ - const int16_t numlpc, /* i : Number of sets of lpc */ - const int32_t sr_core /* i : internal sampling rate */ -); - -int16_t decode_lpc_avq( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t numlpc, /* i : Number of sets of lpc */ - int16_t *param_lpc, /* o : lpc parameters */ - const int16_t ch, /* i : channel */ - const int16_t element_mode, /* i : element mode */ - const int16_t sns_low_br_mode /* i : SNS low-bitrate mode */ -); - - -void vlpc_2st_dec_flt( - float *lsfq, /* i/o: i:1st stage o:1st+2nd stage */ - int16_t *indx, /* i : index[] (4 bits per words) */ - const int16_t mode, /* i : 0=abs, >0=rel */ - const int32_t sr_core /* i : internal sampling rate */ -); - -void lsf_weight_2st_flt( - const float *lsfq, - float *w, - const int16_t mode, - const int32_t sr_core ); - -void mdct_window_sine_flt( - float *window, - const int32_t Fs, - const int16_t n, - const int16_t window_type, - const int16_t element_mode ); - -void mdct_window_aldo_flt( - float *window1, - float *window2, - const int16_t n ); - -void AVQ_cod_lpc( - const float nvec[], /* i : vector to quantize */ - int16_t nvecq[], /* o : quantized normalized vector (assuming the bit budget is enough) */ - int16_t *indx, /* o : index[] (4 bits per words) */ - const int16_t Nsv /* i : number of subvectors (lg=Nsv*8) */ -); - -void AVQ_dec_lpc_ivas( - const int16_t indx[], /* i : index[] (4 bits per words) */ - int16_t nvecq[], /* o : vector quantized */ - const int16_t Nsv /* i : number of subvectors (lg=Nsv*8) */ -); - -void vlpc_1st_dec_flt( - const int16_t index, /* i : codebook index */ - float *lsfq, /* i/o: i:prediction o:quantized lsf */ - const int32_t sr_core ); - -void WindowSignal_flt( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - int16_t offset, /* i : left folding point offset relative to the input signal pointer */ - const int16_t left_overlap_mode, /* i : overlap mode of left window half */ - const int16_t right_overlap_mode, /* i : overlap mode of right window half */ - int16_t *left_overlap_length, /* o : TCX window left overlap length */ - int16_t *right_overlap_length, /* o : TCX window right overlap length */ - const float in[], /* i : input signal */ - int16_t *L_frame, /* i/o: frame length */ - float out[], /* o : output windowed signal */ - const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ - const int16_t fullband /* i : fullband flag */ -); - -void HBAutocorrelation( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - const int16_t left_mode, /* i : overlap mode of left window half */ - const int16_t right_mode, /* i : overlap mode of right window half */ - float speech[], /* i : speech */ - int16_t L_frame_glob, /* i/o: frame length */ - float *r /* o : autocorrelations vector */ -); - -void TNSAnalysis( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - const int16_t L_frame, /* i : frame length */ - int16_t L_spec, /* i : length of the spectrum */ - const int16_t transform_type, /* i : transform type for the frame/subframe - TCX20 | TCX10 | TCX 5 (meaning 2 x TCX 5) */ - const int16_t isAfterACELP, /* i : Flag indicating if the last frame was ACELP. For the second TCX subframe it should be 0 */ - float spectrum[], /* i : MDCT spectrum of the subframe */ - TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */ - const float ltp_gain, /* i : ltp gain */ - STnsData *pTnsData, /* o : TNS data */ - int8_t *pfUseTns, /* o : Flag indicating if TNS is used */ - float *predictionGain /* o : TNS prediction gain */ -); - -void CalculateTnsFilt( - STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ - const float pSpectrum[], /* i : MDCT spectrum */ - STnsData *pTnsData, /* o : TNS data struct */ - float *predictionGain /* o : TNS prediction gain */ -); - -void ShapeSpectrum( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - const float A[], /* i : quantized coefficients NxAz_q[M+1] */ - float gainlpc[], /* o : MDCT gains for the previous frame */ - const int16_t L_frame_glob, /* i : frame length */ - int16_t L_spec, /* i : length of the spectrum */ - float spectrum[], /* i/o: MDCT spectrum */ - const int8_t fUseTns, /* i : Flag indicating if TNS is used */ - Encoder_State *st, /* i/o: encoder state structure */ - float *scf /* i : scale factors */ -); - -void QuantizeSpectrum( - Encoder_State *st, /* i/o: encoder state structure */ - const float A[], /* i : quantized coefficients NxAz_q[M+1] */ - const Word16 Aqind[], /* i : frame-independent quantized coeffs (M+1) */ - float gainlpc[], /* i : MDCT gains of the previous frame */ - float synth[], /* o : synthesis buffer */ - const int16_t nb_bits, /* i : bit budget */ - const int16_t tnsSize, /* i : number of tns parameters put into prm */ - int16_t prm[], /* o : tcx parameters */ - const int16_t frame_cnt, /* i : frame counter in the super_frame */ - CONTEXT_HM_CONFIG *hm_cfg, /* i : HM configuration */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -/*! r: index of next coefficient */ -int16_t get_next_coeff_mapped_ivas( - int16_t ii[2], /* i/o: coefficient indexes */ - int32_t *pp, /* o : peak(1)/hole(0) indicator */ - int16_t *idx, /* o : index in unmapped domain */ - CONTEXT_HM_CONFIG *hm_cfg /* i : HM configuration */ -); - - -void ACcontextMapping_encode2_no_mem_s17_LC( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - int16_t *x, - int16_t nt, - int16_t lastnz, - int16_t nbbits, - int16_t resQMaxBits, - CONTEXT_HM_CONFIG *hm_cfg ); - -int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( - Decoder_State *st, /* i/o: decoder state */ - int16_t *x, /* o : decoded spectrum */ - int16_t nt, /* i : size of spectrum */ - int16_t nbbits, /* i : bit budget */ - int16_t resQMaxBits, /* i : residual coding maximum bits */ - CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ -); - -int16_t ACcontextMapping_encode2_estimate_no_mem_s17_LC( - const int16_t *x, - const int16_t nt, - int16_t *lastnz, - int16_t *nEncoded, - const int16_t target, - int16_t *stop, - CONTEXT_HM_CONFIG *hm_cfg ); - -void RCcontextMapping_encode2_no_mem_s17_LCS( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - int16_t *x, - const int16_t nt, - int16_t lastnz, - const int16_t nbbits, - const int16_t resQMaxBits, - CONTEXT_HM_CONFIG *hm_cfg ); - -int16_t RCcontextMapping_decode2_no_mem_s17_LCS( - Decoder_State *st, /* i/o: decoder state */ - int16_t *x, /* o : decoded spectrum */ - const int16_t nt, /* i : size of spectrum */ - const int16_t nbbits, /* i : bit budget */ - const int16_t resQMaxBits, /* i : residual coding maximum bits */ - CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ -); - -int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS( - int16_t *x, /* Spectral coefficients */ - const int16_t nt, /* L - size of spectrum (no. of spectral coefficients) */ - int16_t *lastnz_out, - int16_t *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring */ - const int16_t target, /* Target bits */ - int16_t *stop, - int16_t mode, - CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ -); - -Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( - Word16 *x, /* Q0 */ - const Word16 nt, /* Q0 */ - const Word16 target, /* Q0 */ - HANDLE_RC_CONTEXT_MEM hContextMem ); - -Word16 RCcontextMapping_encode2_estimate_bandWise_fx( - Word16 *x, /* Q0 */ - const Word16 start_line, /* Q0 */ - const Word16 end_line, /* Q0 */ - HANDLE_RC_CONTEXT_MEM hContextMem /* Q0 */ -); - -void tcx_get_windows_flt( - TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration */ - const int16_t left_mode, /* i : overlap mode of left window half */ - const int16_t right_mode, /* i : overlap mode of right window half */ - int16_t *left_overlap, /* o : left overlap length */ - const float **left_win, /* o : left overlap window */ - int16_t *right_overlap, /* o : right overlap length */ - const float **right_win, /* o : right overlap window */ - const int16_t fullband /* i : fullband flag */ -); - -void tcx_windowing_analysis_flt( - const float *signal, /* i : signal vector */ - const int16_t L_frame, /* i : frame length */ - const int16_t left_overlap, /* i : left overlap length */ - const float *left_win, /* i : left overlap window */ - const int16_t right_overlap, /* i : right overlap length */ - const float *right_win, /* i : right overlap window */ - float *output /* o : windowed signal vector */ -); - -void tcx_windowing_synthesis_current_frame_flt( - float *signal, /* i/o: signal vector */ - const float *window, /* i : TCX window vector */ - const float *window_half, /* i : TCX window vector for half-overlap window */ - const float *window_min, /* i : TCX minimum overlap window */ - const int16_t window_length, /* i : TCX window length */ - const int16_t window_half_length, /* i : TCX half window length */ - const int16_t window_min_length, /* i : TCX minimum overlap length */ - const int16_t left_rect, /* i : left part is rectangular */ - const int16_t left_mode, /* i : overlap mode of left window half */ - float *acelp_zir, /* i/o: acelp ZIR */ - const float *old_syn, /* i : old synthesis */ - const float *syn_overl, /* i : overlap synthesis */ - const float *A_zir, - const float *window_trans, /* i : window for transition from ACELP */ - int16_t acelp_zir_len, - const int16_t acelp_mem_len, - const int16_t last_core_bfi, /* i : last mode */ - const int16_t last_is_cng, - const int16_t fullbandScale ); - -void tcx_windowing_synthesis_past_frame_flt( - float *signal, /* i/o: signal vector */ - const float *window, /* i : TCX window vector */ - const float *window_half, /* i : TCX window vector for half-overlap window */ - const float *window_min, /* i : TCX minimum overlap window */ - const int16_t window_length, /* i : TCX window length */ - const int16_t window_half_length, /* i : TCX half window length */ - const int16_t window_min_length, /* i : TCX minimum overlap length */ - const int16_t right_mode /* i : overlap mode (left_mode of current frame) */ -); - -void ProcessIGF( - Encoder_State *st, /* i : Encoder state */ - float *pMDCTSpectrum, /* i : MDCT spectrum */ - const float *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ - float *pPowerSpectrum, /* i : MDCT^2 + MDST^2 spectrum, or estimate */ - const int16_t isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */ - const int16_t frameno, /* i : flag indicating index of current subframe */ - const int16_t sp_aud_decision0, /* i : first stage switching decision */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void ProcessStereoIGF( - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, - Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ - int16_t ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ - float *pITFMDCTSpectrum[CPE_CHANNELS][NB_DIV], /* i : MDCT spectrum fir ITF */ - float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ - float *pPowerSpectrumMsInv[CPE_CHANNELS][NB_DIV], /* i : inverse power spectrum */ - float *inv_spectrum[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const int16_t frameno, /* i : flag indicating index of current subframe*/ - const int16_t sp_aud_decision0, /* i : sp_aud_decision0 */ - const int32_t element_brate, /* i : element bitrate */ - const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ -); - -void AnalyzePowerSpectrum( - Encoder_State *st, /* i/o: encoder states */ - const int16_t L_frame, /* i : frame length */ - const int16_t L_frameTCX, /* i : full band frame length */ - const int16_t left_overlap, /* i : left overlap length */ - const int16_t right_overlap, /* i : right overlap length */ - const float mdctSpectrum[], /* i : MDCT spectrum */ - const float signal[], /* i : windowed signal corresponding to mdctSpectrum */ - float powerSpec[] /* o : Power spectrum */ -); - -void lpc2mdct_flt( - float *lpcCoeffs, - const int16_t lpcOrder, - float mdct_gains[], - const int16_t length, - const int16_t noInverse ); - -void mdct_preShaping( - float x[], - const int16_t lg, - const float gains[] ); - -void mdct_noiseShaping_flt( - float x[], - const int16_t lg, - const float gains[], - const int16_t nBands ); - - -void PsychAdaptLowFreqDeemph_flt( - float x[], - const float lpcGains[], - float lf_deemph_factors[] ); - -void AdaptLowFreqDeemph_flt( - float x[], - int16_t tcx_lpc_shaped_ari, - const float lpcGains[], - const int16_t lg, - float lf_deemph_factors[] ); - - -void tcx_noise_filling_flt( - float *Q, - const int16_t noiseFillSeed, - const int16_t iFirstLine, - const int16_t lowpassLine, - const int16_t nTransWidth, - const int16_t L_frame, - const float tiltCompFactor, - float fac_ns, - Word16 *infoTCXNoise, - const int16_t element_mode /* i : IVAS element mode */ -); - - -void tcx_decoder_memory_update_flt( - Decoder_State *st, /* i/o: decoder memory state */ - const float *xn_buf, /* i : mdct output buffer */ - float *synth, /* i/o: synth */ - const float *A /* i : Quantized LPC coefficients */ -); - - -/*! r: number of bits used (including "bits") */ -int16_t tcx_ari_res_invQ_spec_flt( - float x_Q[], /* i/o: quantized spectrum */ - const int16_t L_frame, /* i : number of lines */ - const int16_t prm[], /* i : bitstream */ - int16_t target_bits, /* i : number of bits available */ - int16_t bits, /* i : number of bits used so far */ - const float deadzone, /* i : quantizer deadzone */ - const float x_fac[] /* i : spectrum post-quantization factors */ -); - - -void ari_copy_states( - Tastat *source, - Tastat *dest ); - - -void ari_start_encoding_14bits( - Tastat *s ); - - -void ari_start_decoding_14bits_ivas( - Decoder_State *st, - Tastat *s ); - -int16_t ari_start_decoding_14bits_prm_ivas( - const int16_t *ptr, - int16_t bp, - Tastat *s ); - -void ari_decode_14bits_s17_ext_ivas( - Decoder_State *st, - uint16_t *res, - Tastat *s, - const uint16_t *cum_freq ); - -void ari_decode_14bits_s27_ext_ivas( - Decoder_State *st, - uint16_t *res, - Tastat *s, - const uint16_t *cum_freq ); - -void ari_decode_14bits_bit_ext_ivas( - Decoder_State *st, - uint16_t *res, - Tastat *s ); - -/*! r: Q15 */ -Word16 expfp_evs_fx( - const Word16 x, /* i : mantissa Q15-e */ - const Word16 x_e /* i : exponent Q0 */ -); - - -void tcx_arith_render_envelope_ivas_fx( - const Word16 A_ind[], /* i : LPC coefficients of signal envelope Q12*/ - const Word16 L_frame, /* i : number of spectral lines Q0*/ - const Word16 L_spec, /* i : length of the coded spectrum Q0*/ - const Word16 preemph_fac, /* i : pre-emphasis factor Q15*/ - const Word16 gamma_w, /* i : A_ind -> weighted envelope factor Q15*/ - const Word16 gamma_uw, /* i : A_ind -> non-weighted envelope factor Q14*/ - Word32 env[] /* o : shaped signal envelope Q16*/ -); - -int16_t ari_encode_14bits_range( - int16_t *ptr, - int16_t bp, - int32_t bits, - Tastat *s, - uint16_t cum_freq_low, - uint16_t cum_freq_high ); - - -int16_t ari_done_cbr_encoding_14bits( - int16_t *ptr, - int16_t bp, - int32_t bits, - Tastat *s ); - - -void tcx_arith_encode_envelope( - float spectrum[], /* i/o: MDCT coefficients */ - int16_t signs[], /* o : signs (spectrum[.]<0) */ - const int16_t L_frame, /* i : frame or MDCT length */ - const int16_t L_spec, /* i : length w/o BW limitation */ - Encoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients */ - int16_t target_bits, /* i : number of available bits */ - int16_t prm[], /* o : bitstream parameters */ - const int16_t use_hm, /* i : use HM in current frame? */ - int16_t prm_hm[], /* o : HM parameter area */ - const int16_t tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ - int16_t *arith_bits, /* o : bits used for ari. coding */ - int16_t *signaling_bits, /* o : bits used for signaling */ - const int16_t low_complexity /* i : low-complexity flag */ -); - -void tcx_arith_decode_envelope( - Decoder_State *st, /* i/o: coder state */ - float q_spectrum[], /* o : quantised MDCT coefficients */ - const int16_t L_frame, /* i : frame or MDCT length */ - int16_t L_spec, /* i : length w/o BW limitation */ - const Word16 A_ind[], /* i : quantised LPC coefficients */ - const int16_t target_bits, /* i : number of available bits */ - const int16_t prm[], /* i : bitstream parameters */ - const int16_t use_hm, /* i : use HM in current frame? */ - const int16_t prm_hm[], /* i : HM parameter area */ - int16_t tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ - int16_t *arith_bits, /* o : bits used for ari. coding */ - int16_t *signaling_bits, /* o : bits used for signaling */ - const int16_t low_complexity /* i : low-complexity flag */ -); - -void tcx_arith_decode_envelope_ivas_fx( - Decoder_State *st, /* i/o: coder state */ - Word32 q_spectrum[], /* o : quantised MDCT coefficients */ - Word16 *q_spectrum_e, /* o : MDCT exponent */ - const Word16 L_frame, /* i : frame or MDCT length */ - Word16 L_spec, /* i : length w/o BW limitation */ - const Word16 A_ind[], /* i : quantised LPC coefficients */ - const Word16 target_bits, /* i : number of available bits */ - Word16 prm[], /* i : bitstream parameters */ - const Word16 use_hm, /* i : use HM in current frame? */ - const Word16 prm_hm[], /* i : HM parameter area */ - Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ - Word16 *arith_bits, /* o : bits used for ari. coding */ - Word16 *signaling_bits, /* o : bits used for signaling */ - const Word16 low_complexity /* i : low-complexity flag */ -); - - -void UnmapIndex_fx( - const Word16 PeriodicityIndex, /* Q0 */ - const Word16 Bandwidth, /* Q0 */ - const Word16 LtpPitchLag, /* Q0 */ - const Word8 SmallerLags, /* Q0 */ - Word16 *FractionalResolution, /* Q0 */ - Word32 *Lag /* Q0 */ -); - -/*! r: PeriodicityIndex */ -int16_t SearchPeriodicityIndex( - const float Mdct[], /* i : Coefficients, Mdct[0..NumCoeffs-1] */ - const float UnfilteredMdct[], /* i : Unfiltered coefficients, UnfilteredMdct[0..NumCoeffs-1] */ - const int16_t NumCoeffs, /* i : Number of coefficients */ - const int16_t shortTargetBits, /* i : Target bit budget (excl. Done flag) */ - const int16_t LtpPitchLag, /* i : TCX-LTP pitch */ - const float LtpGain, /* i : LTP gain */ - float *RelativeScore /* o : Energy concentration factor */ -); - - -int16_t EncodeIndex( - const int16_t Bandwidth, /* o : NB, 1: (S)WB */ - int16_t PeriodicityIndex, - BSTR_ENC_HANDLE hBstr ); - - -Word16 CountIndexBits_fx( - Word16 Bandwidth, /* 0: NB, 1: (S)WB Q0*/ - Word16 PeriodicityIndex /* Q0 */ -); - -int16_t DecodeIndex( - Decoder_State *st, - const int16_t Bandwidth, /* o : NB, 1: (S)WB */ - int16_t *PeriodicityIndex ); - -#define GET_ADJ( T, L ) GET_ADJ2( T, L, *FractionalResolution ) -#define GET_ADJ2( T, L, F ) ( ( ( L ) << ( F ) ) - ( T ) ) - - -Word32 tcx_hm_render_fx( - const Word32 lag, /* i: pitch lag Q0 */ - const Word16 fract_res, /* i: fractional resolution of the lag Q0 */ - Word16 p[] /* o: harmonic model Q13 */ -); - - -void tcx_hm_modify_envelope_fx( - const Word16 gain, /* i: HM gain Q11 */ - const Word32 lag, /* i: pitch lag Q0 */ - const Word16 fract_res, /* i: fractional resolution of the lag Q0 */ - const Word16 p[], /* i: harmonic model Q13 */ - Word32 env[], /* i/o: envelope Q16 */ - const Word16 L_frame /* i: number of spectral lines Q0 */ -); - -void tcx_hm_analyse( - const float abs_spectrum[], /* i : absolute spectrum */ - const int16_t L_frame, /* i : number of spectral lines */ - Word32 env[], /* i/o: envelope shape (Q16) */ - const int16_t targetBits, /* i : target bit budget */ - const int16_t coder_type, /* i : GC/VC coder type */ - int16_t prm_hm[], /* o : HM parameters */ - int16_t LtpPitchLag, /* i : LTP pitch lag or -1 if none */ - const float LtpGain, /* i : LTP gain */ - int16_t *hm_bits /* o : bit consumption */ -); - -void tcx_hm_decode_ivas( - const int16_t L_frame, /* i : number of spectral lines */ - Word32 env[], /* i/o: envelope shape (Q16) */ - const int16_t targetBits, /* i : target bit budget */ - const int16_t coder_type, /* i : GC/VC coder type */ - const int16_t prm_hm[], /* i : HM parameters */ - const int16_t LtpPitchLag, /* i : LTP pitch lag or -1 if none */ - int16_t *hm_bits /* o : bit consumption */ -); - -void tcx_hm_decode( - const Word16 L_frame, /* i : number of spectral lines */ - Word32 env[], /* i/o: envelope shape (Q16) */ - const Word16 targetBits, /* i : target bit budget */ - const Word16 coder_type, /* i : GC/VC coder type */ - const Word16 prm_hm[], /* i : HM parameters */ - const Word16 LtpPitchLag, /* i : LTP pitch lag or -1 if none */ - Word16 *hm_bits /* o : bit consumption */ -); - -void coder_tcx( - Encoder_State *st, /* i/o: encoder state structure */ - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - const float A[], /* i : quantized coefficients NxAz_q[M+1] */ - const Word16 Aqind[], /* i : frame-independent quantized coefficients (M+1) */ - float synth[], /* o : decoded synthesis */ - const int16_t L_frame_glob, /* i : frame length */ - const int16_t L_frameTCX_glob, - const int16_t L_spec, - int16_t nb_bits, /* i : bit budget */ - float spectrum[], /* i/o: MDCT spectrum */ - int16_t prm[], /* o : tcx parameters */ - CONTEXT_HM_CONFIG *hm_cfg, - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void coder_tcx_post( - Encoder_State *st, /* i/o: encoder memory state */ - float *A, /* o : Quantized LPC coefficients */ - const float *Ai /* i : Unquantized (interpolated) LPC coefficients */ -); - -void decoder_tcx( - Decoder_State *st, /* i/o: coder memory state */ - int16_t prm[], /* i : parameters */ - float A[], /* i : coefficients NxAz[M+1] */ - Word16 Aind[], /* i : frame-independent coefficients Az[M+1]*/ - float synth[], /* i/o: synth[-M..lg] */ - float synthFB[], /* i/o: encoder memory state */ - const int16_t bfi, /* i : Bad frame indicator */ - const int16_t frame_cnt, /* i : frame counter in the super_frame */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -); - -void decoder_tcx_post( - Decoder_State *st, /* i/o: decoder memory state */ - float *synth, - float *synthFB, - float *A, /* i : A(z) filter coefficients */ - const int16_t bfi, - const int16_t isMCT ); - -void coder_acelp( - Encoder_State *st, /* i/o: coder memory state */ - const float A[], /* i : coefficients 4xAz[M+1] */ - const float Aq[], /* i : coefficients 4xAz_q[M+1] */ - const float speech[], /* i : speech[-M..lg] */ - LPD_state *LPDmem, /* i/o: ACELP memories */ - int16_t *prm, /* o : acelp parameters */ - const float stab_fac, - const int16_t target_bits, - float *gain_pitch_buf, /* o : gain pitch values */ - float *gain_code_buf, /* o : gain code values */ - float *pitch_buf, /* o : pitch values for each subfr.*/ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc /* o : excitation for SWB TBE */ -); - -void coder_acelp_rf( - const int16_t target_bits, /* i : target bits */ - const float speech[], /* i : speech[-M..lg] */ - const int16_t coder_type, /* i : coding type */ - const int16_t rf_frame_type, /* i : rf_frame_type */ - const float A[], /* i : coefficients 4xAz[M+1] */ - const float Aq[], /* i : coefficients 4xAz_q[M+1] */ - const float voicing[], /* i : open-loop LTP gain */ - const int16_t T_op[], /* i : open-loop LTP lag */ - const float stab_fac, /* i : LP stability factor */ - Encoder_State *st, /* i/o: coder memory state */ - ACELP_config *acelp_cfg, /* i/o: configuration of the ACELP */ - float *exc_rf, /* i/o: pointer to RF excitation */ - float *syn_rf /* i/o: pointer to RF synthesis */ -); - -void decoder_acelp( - Decoder_State *st, /* i/o: coder memory state */ - int16_t prm[], /* i : parameters */ - const float A[], /* i : coefficients NxAz[M+1] */ - ACELP_config acelp_cfg, /* i : ACELP config */ - float synth[], /* i/o: synthesis */ - int16_t *pT, /* o : pitch for all subframe */ - float *pgainT, /* o : pitch gain for all subfr */ - const float stab_fac, /* i : stability of isf */ - float *pitch_buffer, /* o : pitch values for each subfr.*/ - float *voice_factors, /* o : voicing factors */ - const int16_t LSF_Q_prediction, /* i : LSF prediction mode */ - float *bwe_exc /* o : excitation for SWB TBE */ -); - -void writeTCXMode_fx( - Encoder_State *st, /* i/o: encoder state structure */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ - Word16 *nbits_start /* o : nbits start Q0*/ -); - -void writeTCXWindowing_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const Word16 overlap_mode /* i : overlap mode Q0*/ -); - -void writeLPCparam( - Encoder_State *st, /* i/o: encoder state structure */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const int16_t param_lpc[], /* i : LPC parameters to write */ - const int16_t bits_param_lpc[], /* i : bits per LPC parameter */ - const int16_t no_param_lpc, /* i : number of LPC parameters */ - int16_t *nbits_lpc /* o : LPC bits written */ -); - -void enc_prm( - Encoder_State *st, /* i/o: encoder state structure */ - int16_t param[], /* i : parameters */ - int16_t param_lpc[], /* i : LPC parameters */ - CONTEXT_HM_CONFIG hm_cfg[], - const int16_t bits_param_lpc[], - const int16_t no_param_lpc ); - -void writeTCXparam( - Encoder_State *st, /* i/o: Encoder State handle */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - CONTEXT_HM_CONFIG hm_cfg[], /* i/o: HM config */ - int16_t param[], /* i : parameters */ - const int16_t nbits_header, - const int16_t nbits_start, - const int16_t nbits_lpc, - const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ - int16_t p_param[2], /* i/o: pointer to parameters from previous bs writing */ - const int16_t target_bitsTCX10[2], - const int16_t pre_past_flag ); - -void enc_prm_rf( - Encoder_State *st, /* i/o: encoder memory state */ - const int16_t rf_frame_type, - const int16_t fec_offset ); - -void dec_prm_hm_ivas( - Decoder_State *st, /* i/o: decoder memory state */ - int16_t *prm_hm, - const int16_t hm_size ); - -void dec_prm_ivas( - Decoder_State *st, /* i/o: decoder memory state */ - int16_t param[], /* o : decoded parameters */ - int16_t param_lpc[], /* i : LPC parameters */ - int16_t *total_nbbits, /* i/o: number of bits / decoded bits */ - int16_t *bitsRead ); -void gaus_L2_dec_flt( - float *code, /* o : decoded gaussian codevector */ - float tilt_code, - const float *A, - float formant_enh_num, - int16_t *seed_acelp /* i/o: random seed */ -); - -/*! r: interpolated value */ -float interpolation( - const float *x, /* i : input vector */ - const float *win, /* i : interpolation window */ - const int16_t frac, /* i : fraction */ - const int16_t up_samp, /* i : upsampling factor */ - const int16_t nb_coef /* i : nb of filter coef */ -); - -void predict_signal_flt( - const float excI[], /* i : input excitation buffer */ - float excO[], /* o : output excitation buffer */ - const int16_t T0, /* i : integer pitch lag */ - int16_t frac, /* i : fraction of lag */ - const int16_t frac_max, /* i : max fraction */ - const int16_t L_subfr /* i : subframe size */ -); - -void tcx_ltp_encode( - Encoder_State *st, - const int16_t tcxMode, - const int16_t L_frame, - const float *speech, - float *speech_ltp, - const float *wsp, - const int16_t Top[], - int16_t *ltp_param, - int16_t *ltp_bits, - float *A, - const int16_t disable_ltp, - const int16_t element_mode ); - -void tcx_ltp_post_flt( - Decoder_State *st, - TCX_LTP_DEC_HANDLE hTcxLtpDec, - const int16_t core, - const int16_t output_frame, - const int16_t L_frame, - float sig[], - const float tcx_buf[] ); - -int16_t tcx_ltp_decode_params_flt( - int16_t *ltp_param, - int16_t *pitch_int, - int16_t *pitch_fr, - float *gain, - const int16_t pitmin, - const int16_t pitfr1, - const int16_t pitfr2, - const int16_t pitmax, - const int16_t pitres ); - -void create_IDCT_N_Matrix( - float *inv_matrixFloatQ, /* i/o: RAM buffer */ - const int16_t N, /* i : DCT length, number of time samples */ - const int16_t n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ - const int16_t alloc_size /* i : RAM buffer size in elements */ -); - -void dctT2_N_apply_matrix( - const float *input, /* i : input in fdcng or DCT(fdcng) domain */ - float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ - const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - const int16_t fdcngvq_dim, /* i : fdcng domain length */ - const float *matrix, /* i : IDCT matrix */ - const int16_t matrix_row_dim, /* i : */ - const DCTTYPE dcttype /* i : matrix operation type */ -); - -void extend_dctN_input( - const float *input, /* i : input in fdcng domain */ - const float *dct_input, /* i : input in dctN(fdcng) domain */ - const int16_t in_dim, /* i : in_dim == N */ - float *ext_sig, /* o : extended output in fdcng domain */ - const int16_t out_dim, /* i : output total dim */ - float *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ - const int16_t n_cols, /* i : number of columns == DCT truncation length */ - const DCTTYPE dcttype /* i : matrix operation type */ -); - - -void PulseResynchronization( - const float *src_exc, /* i : Input excitation buffer */ - float *dst_exc, /* o : output excitation buffer */ - const int16_t nFrameLength, /* i : frame length */ - const int16_t nSubframes, /* i : Number of subframes */ - const float pitchStart, /* i : Pitch at the end of the last frame */ - const float pitchEnd /* i : Pitch at the end of the current frame */ -); - -void con_acelp( - float A[], /* i : coefficients NxAz[M+1] */ - const int16_t coder_type, /* i : ACELP coder type */ - float synth[], /* i/o: synthesis */ - int16_t *pT, /* o : pitch for all subframe */ - float *pgainT, /* o : pitch gain for all subfr */ - float stab_fac, /* i : stability of isf */ - Decoder_State *st, /* i/o: coder memory state */ - float pitch_buffer[], /* i/o: floating pitch values for each subframe */ - float *voice_factors, /* o : voicing factors */ - float *bwe_exc /* o : excitation for SWB TBE */ -); - -void con_tcx( - Decoder_State *st, /* i/o: coder memory state */ - float synth[], /* i/o: synth[] */ - const float coh, /* i : coherence of stereo signal */ - int16_t *noise_seed, /* i/o: noise seed for stereo */ - const int16_t only_left, /* i : TD-PLC only in left channel */ - const float A_cng[] /* i : CNG LP filter coefficients */ -); - -int16_t lsf_msvq_ma_decprm_ivas( - Decoder_State *st, - int16_t *param_lpc ); - -int16_t dec_lsf_tcxlpc_ivas( - Decoder_State *st, /* i : Decoder state */ - int16_t **indices, /* o : Ptr to VQ indices */ - const int16_t narrowband, /* i : narrowband flag */ - const int16_t cdk /* i : codebook selector */ -); - -int16_t D_lsf_tcxlpc_ivas( - const int16_t indices[], /* i : VQ indices */ - float lsf_q[], /* o : quantized lsf */ - Word16 lsp_q_ind[], /* o : quantized lsp (w/o MA prediction) */ - const int16_t narrowband, /* i : narrowband flag */ - const int16_t cdk, /* i : codebook selector */ - const float mem_MA[] /* i : MA memory */ -); - -int16_t Q_lsf_tcxlpc( - /* const */ float lsf[], /* i : original lsf */ - float lsf_q[], /* o : quantized lsf */ - Word16 lsp_q_ind[], /* o : quantized lsp (w/o MA prediction) */ - int16_t indices[], /* o : VQ indices */ - const int16_t narrowband, /* i : narrowband flag */ - const int16_t cdk, /* i : codebook selector */ - const float mem_MA[], /* i : MA memory */ - const int16_t coder_type, /* i : acelp extended mode */ - const float *Bin_Ener /* i : Spectrum energy */ -); - -void midlsf_enc( - const float qlsf0[], - const float qlsf1[], - const float lsf[], - int16_t *idx, - const int16_t N, - const float *Bin_Ener, - const int16_t narrowBand, - const int32_t sr_core, - const int16_t coder_type ); - -void lsf_end_enc( - Encoder_State *st, - const float *lsf, - float *qlsf, - const int16_t nBits, - const int16_t coder_type_org, - const int16_t force_sf, - int16_t *lpc_param, - int16_t *no_stages, - int16_t *bits_param_lpc, - const int16_t coder_type_raw, - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -); - -void lsf_end_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t coder_type_org, /* i : coding type */ - const int16_t bwidth, /* i : input signal bandwidth */ - const int16_t nBits, /* i : number of bits used for ISF quantization*/ - float *qlsf, /* o : quantized LSFs in the cosine domain */ - int16_t *lpc_param, /* i : LPC parameters */ - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - int16_t *nb_indices, /* o : number of indices */ - const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -); - -void lpc_quantization( - Encoder_State *st, - const float lsp[], - const float lspmid[], - float lsp_q[], - float lsf_q[], - float lspmid_q[], - const int16_t coder_type, - const int16_t acelp_midLpc, - int16_t param_lpc[], - int16_t nbits_lpc[], - int16_t *bits_param_lpc, - int16_t *no_param_lpc ); - -void lpc_unquantize( - Decoder_State *st, - float *lsf, - float *lsp, - int16_t *param_lpc, - float *lspmid, - float *lsfmid, - const int16_t coder_type, - int16_t *LSF_Q_prediction /* o : LSF prediction mode */ -); - -void dlpc_bfi_flt( - const int16_t L_frame, - float *lsf_q, /* o : quantized lsfs */ - const float *lsfold, /* i : past quantized lsf */ - const int16_t last_good, /* i : last good received frame */ - const int16_t nbLostCmpt, /* i : counter of consecutive bad frames */ - float mem_MA[], /* i/o: quantizer memory for MA model */ - float mem_AR[], /* i/o: quantizer memory for MA model */ - float *stab_fac, /* i : lsf stability factor */ - float *lsf_adaptive_mean, /* i : lsf adaptive mean, updated when BFI==0 */ - const int16_t numlpc, /* i : Number of division per superframe */ - float lsf_cng[], - const int16_t plcBackgroundNoiseUpdated, - float *lsf_q_cng, /* o : quantized lsfs of background noise */ - float *old_lsf_q_cng, /* o : old quantized lsfs for background noise */ - const float lsfBase[] /* i : base for differential lsf coding */ -); - -void Unified_weighting( - const float Bin_Ener_128[], /* i : FFT Bin energy 128 bins in two sets */ - const float lsf[], /* i : LSF vector */ - float w[], /* o : LP weighting filter (numerator) */ - const int16_t narrowBand, /* i : flag for Narrowband */ - const int16_t unvoiced, /* i : flag for Unvoiced frame */ - const int32_t sr_core, /* i : sampling rate of core-coder */ - const int16_t order /* i : LP order */ -); - -int16_t vad_init( - VAD_CLDFB_HANDLE hVAD_CLDFB /* i/o: CLDFB VAD state */ -); - -int16_t vad_proc( - float realValues[16][60], /* i : CLDFB real values */ - float imagValues[16][60], /* i : CLDFB imag values */ - float *sb_power, /* i/o: Energy of CLDFB data */ - const int16_t numBands, /* i : number of input bands */ - VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ - int16_t *cldfb_addition, - const int16_t vada_flag /* i : VAD flag */ -); - - -int16_t update_decision( - VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ - const float snr, /* i : frequency domain SNR */ - const float tsnr, /* i : time domain SNR */ - const float frame_energy, /* i : current frame energy */ - const float high_eng, /* i : current frame high frequency energy */ - const int16_t vad_flag, /* i : VAD flag */ - const int16_t music_backgound_f /* i : background music flag */ -); - -void frame_spec_dif_cor_rate( - float spec_amp[], /* i : spectral amplitude */ - float pre_spec_low_dif[], /* i/o: low spectrum different */ - float f_tonality_rate[] /* o : tonality rate */ -); - - -void SNR_calc( - const float frame_sb_energy[], /* i : energy of sub-band divided non-uniformly*/ - const float sb_bg_energy[], /* i : sub-band background energy */ - const float t_bg_energy, /* i : time background energy of several frames*/ - float *snr, /* o : frequency domain SNR */ - float *tsnr, /* o : time domain SNR */ - const float frame_energy, /* i : current frame energy */ - const int16_t bwidth /* i : audio bandwidth */ -); - -void background_update( - VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ - float frame_energy, /* i : current frame energy 2 */ - const int16_t update_flag, /* i : current frame update flag */ - const int16_t music_backgound_f, /* i : background music flag */ - const float snr ); - -void bg_music_decision( - VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ - int16_t *music_backgound_f, /* i : background music flag */ - const float frame_energy /* i : current frame energy 1 */ -); - -void est_energy( - float sb_power[], /* o : energy of sub-band divided uniformly */ - float frame_sb_energy[], /* o : energy of sub-band divided non-uniformly*/ - float *p_frame_energy, /* o : frame energy 1 */ - float *p_frame_energy2, /* o : frame energy 2 */ - float *p_high_energy, /* o : high frequency energy */ - const int16_t bw /* i : bandwidth */ -); - - -int16_t comvad_decision( - VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ - const float snr, /* i : frequency domain SNR */ - const float tsnr, /* i : time domain SNR */ - const float snr_flux, /* i : average tsnr of several frames */ - const float lt_snr, /* i : long time SNR calculated by fg_energy and bg_energy*/ - const float lt_snr_org, /* i : original long time SNR */ - const float lf_snr, /* i : long time frequency domain SNR calculated by l_speech_snr and l_silence_snr*/ - const float frame_energy, /* i : current frame energy */ - const int16_t music_backgound_f, /* i : background music flag */ - int16_t *cldfb_addition, - const int16_t vada_flag /* i : VAD flag */ -); - -void calc_snr_flux( - float tsnr, /* i : time-domain SNR */ - float pre_snr[], /* i/o: time-domain SNR storage */ - float *snr_flux /* o : average tsnr */ -); - -void calc_lt_snr( - float *lt_snr_org, /* o : original long time SNR */ - float *lt_snr, /* o : long time SNR calculated by fg_energy and bg_energy*/ - const float fg_energy, /* i : foreground energy sum */ - const int16_t fg_energy_count, /* i : number of the foreground energy frame */ - const float bg_energy, /* i : background energy sum */ - const int16_t bg_energy_count, /* i : number of the background energy frame */ - const int16_t bw_index, /* i : band width index */ - const float lt_noise_sp_center0 /* i : long time noise spectral center by 0 */ -); - -void calc_lf_snr( - float *lf_snr_smooth, /* o : smoothed lf_snr */ - float *lf_snr, /* o : long time frequency domain SNR calculated by l_speech_snr and l_silence_snr*/ - const float l_speech_snr, /* i : sum of active frames snr */ - const int16_t l_speech_snr_count, /* i : number of the active frame */ - const float l_silence_snr, /* i : sum of the nonactive frames snr */ - const int16_t l_silence_snr_count, /* i : number of the nonactive frame */ - const int16_t fg_energy_count, /* i : number of the foreground energy frame */ - const int16_t bg_energy_count, /* i : number of the background energy frame */ - const int16_t bw_index /* i : band width index */ -); - -float construct_snr_thresh( - const float sp_center[], /* i : spectral center */ - const float snr_flux, /* i : snr flux */ - const float lt_snr, /* i : long time time domain snr */ - const float lf_snr, /* i : long time frequency domain snr */ - const int16_t continuous_speech_num, /* i : continuous speech number */ - const int16_t continuous_noise_num, /* i : continuous noise number */ - const int16_t fg_energy_est_start, /* i : whether if estimated energy */ - const int16_t bw_index /* i : band width index */ -); - -void minimum_statistics_flt( - const int16_t len, /* i : Vector length */ - const int16_t lenFFT, /* i : Length of the FFT part of the vectors */ - float *psize_flt, - float *msPeriodog, /* i : Periodograms */ - float *msNoiseFloor, - float *msNoiseEst, /* o : Noise estimates */ - float *msAlpha, - float *msPsd, - float *msPsdFirstMoment, - float *msPsdSecondMoment, - float *msMinBuf, - float *msBminWin, - float *msBminSubWin, - float *msCurrentMin, - float *msCurrentMinOut, - float *msCurrentMinSubWindow, - int16_t *msLocalMinFlag, - int16_t *msNewMinFlag, - float *msPeriodogBuf, - int16_t *msPeriodogBufPtr, - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t enc_dec, /* i : encoder/decoder indicator */ - const int16_t element_mode /* i : IVAS element mode */ -); - -void generate_comfort_noise_enc( - Encoder_State *st /* i/o: encoder state structure */ -); - -void generate_comfort_noise_dec( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t nchan_out /* i : number of output channels */ -); - -void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t cng_flag /* i : CNG Flag */ -); - -void generate_masking_noise( - float *timeDomainBuffer, /* i/o: time-domain signal */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t length, /* i : frame size */ - const int16_t core, /* i : core */ - const int16_t return_noise, /* i : noise is returned instead of added */ - const int16_t secondary, /* i : indicator for secondary channel */ - const int16_t element_mode, /* i : element mode */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ -); - -void generate_masking_noise_update_seed( - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -); - -void generate_masking_noise_mdct( - float *mdctBuffer, /* i/o: time-domain signal */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -); - -void SynthesisSTFT_dirac_flt( - float *fftBuffer, /* i : FFT bins */ - float *timeDomainOutput, - float *olapBuffer, - const float *olapWin, - const int16_t samples_out, - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -); - -void generate_masking_noise_dirac( - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ - float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ - float *Cldfb_RealBuffer, /* o : CLDFD real buffer */ - float *Cldfb_ImagBuffer, /* o : CLDFD imaginary buffer */ - const int16_t slot_index, /* i : CLDFB slot index */ - const int16_t cna_flag, /* i : CNA flag for LB and HB */ - const int16_t fd_cng_flag /* i : FD-CNG flag for HB */ -); - -void generate_stereo_masking_noise( - float *syn, /* i/o: time-domain signal */ - Decoder_State *st, /* i/o: decoder state structure */ - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i : TD stereo structure */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t fadeOut, /* i : only fade out of previous state */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ -); - -void apply_scale_flt( - float *scale, /* i : scale factor */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t brate, /* i : Bit rate */ - const SCALE_SETUP *scaleTable, /* i : Scale table */ - const int16_t scaleTableSize /* i : Size of scale table */ -); - -void compress_range_flt( - float *in, - float *out, - const int16_t len ); - -void expand_range_flt( - float *in, - float *out, - const int16_t len ); - -void bandcombinepow_flt( - const float *bandpow, /* i : Power for each band */ - const int16_t nband, /* i : Number of bands */ - int16_t *part, /* i : Partition upper boundaries (band indices starting from 0) */ - const int16_t npart, /* i : Number of partitions */ - const float *psize_inv_flt, /* i : Inverse partition sizes */ - float *partpow /* o : Power for each partition */ -); - -void scalebands_flt( - const float *partpow, /* i : Power for each partition */ - int16_t *part, /* i : Partition upper boundaries (band indices starting from 0) */ - const int16_t npart, /* i : Number of partitions */ - int16_t *midband, /* i : Central band of each partition */ - const int16_t nFFTpart, /* i : Number of FFT partitions */ - const int16_t nband, /* i : Number of bands */ - float *bandpow, /* o : Power for each band */ - const int16_t flag_fft_en ); - -void AnalysisSTFT_flt( - const float *timeDomainInput, - float *fftBuffer, /* o : FFT bins */ - HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */ -); - -void SynthesisSTFT_flt( - float *fftBuffer, - float *timeDomainOutput, - float *olapBuffer, - const float *olapWin, - const int16_t tcx_transition, - HANDLE_FD_CNG_COM hFdCngCom, - const int16_t element_mode, /* i : element mode */ - const int16_t nchan_out /* i : number of output channels */ -); - -void lpc_from_spectrum_flt( - HANDLE_FD_CNG_COM hFdCngCom, - const int16_t start, - const int16_t stop, - const float preemph_fac ); - -ivas_error createFdCngDec( - HANDLE_FD_CNG_DEC *hFdCngDec ); - -void deleteFdCngDec( - HANDLE_FD_CNG_DEC *hFdCngDec ); - -void initFdCngDec( - DEC_CORE_HANDLE st /* i/o: decoder state structure */ -); - -void configureFdCngDec( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ - const int16_t bwidth, - const int32_t total_brate, - const int16_t L_frame, - const int16_t last_L_frame, - const int16_t element_mode ); - -void ApplyFdCng( - float *timeDomainInput, - float *powerSpectrum, - float **realBuffer, /* i/o: Real part of the buffer */ - float **imagBuffer, /* i/o: Imaginary part of the buffer */ - Decoder_State *st, - const int16_t concealWholeFrame, /* i : binary flag indicating frame loss */ - const int16_t is_music ); - -void generate_comfort_noise_dec( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t nchan_out /* i : number of output channels */ -); - -/*! r: CNG energy */ -float cng_energy( - const int16_t element_mode, /* i : element mode */ - const int16_t bwidth, /* i : audio bandwidh */ - const int16_t CNG_mode, /* i : mode for DTX configuration */ - const float CNG_att, /* i : attenuation factor for CNG */ - const float *inputBuffer, /* i : input signal */ - const int16_t len /* i : vector length */ -); - -void FdCng_decodeSID( - Decoder_State *st /* i/o: decoder state structure */ -); - -void FdCng_exc_flt( - HANDLE_FD_CNG_COM hFdCngCom, - int16_t *CNG_mode, - const int16_t L_frame, - const float *lsp_old, - const int16_t first_CNG, - float *lsp_CNG, - float *Aq, /* o : LPC coeffs */ - float *lsp_new, /* o : lsp */ - float *lsf_new, /* o : lsf */ - float *exc, /* o : LP excitation */ - float *exc2, /* o : LP excitation */ - float *bwe_exc /* o : LP excitation for BWE */ -); - -void noisy_speech_detection( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ - const int16_t vad, /* i : VAD flag */ - const float syn[] /* i : input time-domain frame */ -); - -void deleteFdCngEnc( - HANDLE_FD_CNG_ENC *hFdCngEnc /* i/o: FD_CNG structure */ -); - - -void resetFdCngEnc( - Encoder_State *st /* i/o: encoder state structure */ -); - -void perform_noise_estimation_enc( - float *band_energies, /* i : energy in critical bands without minimum noise floor E_MIN */ - float *enerBuffer, /* i : energy buffer */ - HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: CNG structure containing all buffers and variables */ - const int32_t input_Fs, /* i : input sampling rate */ - CPE_ENC_HANDLE hCPE ); - -void AdjustFirstSID( - Encoder_State *st /* i/o: encoder state structure */ -); - -void FdCng_encodeSID( - Encoder_State *st /* i/o: encoder state structure */ -); - -void GetParameters( - ParamsBitMap const *paramsBitMap, - const int16_t nParams, - void const *pParameter, - int16_t **pStream, - int16_t *pnSize, - int16_t *pnBits ); - -void SetParameters( - ParamsBitMap const *paramsBitMap, - const int16_t nParams, - void *pParameter, - const int16_t **pStream, - int16_t *pnSize ); - -void WriteToBitstream( - ParamsBitMap const *paramsBitMap, - const int16_t nParams, - const int16_t **pStream, - int16_t *pnSize, - BSTR_ENC_HANDLE hBstr, - int16_t *pnBits ); - -void ReadFromBitstream( - ParamsBitMap const *paramsBitMap, - const int16_t nArrayLength, - Decoder_State *st, - int16_t **pStream, - int16_t *pnSize ); - -void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); -void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); -void const *GetNumOfTnsFilters_flt( void const *p, const int16_t index, int16_t *pValue ); -void *SetNumOfTnsFilters_flt( void *p, const int16_t index, const int16_t value ); - -int16_t DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -int16_t DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); - -int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); - -int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); - -int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ); - -int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ); -int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); - -void ResetTnsData_flt( - STnsData *pTnsData ); - -void ClearTnsFilterCoefficients_flt( - STnsFilter *pTnsFilter ); - - -int16_t DetectTnsFilt( - const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ - const float pSpectrum[], /* i : MDCT spectrum */ - TRAN_DET_HANDLE hTranDet, /* i : transient detection handle */ - const int16_t isTCX10, /* i : TCX10 or TCX20? */ - const float ltp_gain, /* i : LTP gain */ - STnsData *pTnsData, /* o : TNS data struct */ - float *predictionGain /* o : TNS prediction gain */ -); - -void EncodeTnsData( - STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ - STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ - int16_t *stream, /* o : internal data stream */ - int16_t *pnSize, /* o : number of written parameters */ - int16_t *pnBits /* o : number of written bits */ -); - -int16_t DecodeTnsData_ivas( - STnsConfig const *pTnsConfig, - const int16_t *stream, - int16_t *pnSize, - STnsData *pTnsData ); - -void WriteTnsData( - const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ - const int16_t *stream, /* i : internal data stream */ - int16_t *pnSize, /* o : number of written parameters */ - BSTR_ENC_HANDLE hBstr, /* o : bitstream */ - int16_t *pnBits /* o : number of written bits */ -); - -void ReadTnsData_ivas( - STnsConfig const *pTnsConfig, - Decoder_State *st, - int16_t *pnBits, - int16_t *stream, - int16_t *pnSize ); - -void cldfbAnalysis_ivas( - const float *timeIn, /* i : time buffer */ - float **realBuffer, /* o : real value buffer */ - float **imagBuffer, /* o : imag value buffer */ - const int16_t samplesToProcess, /* i : number of input samples */ - HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filterbank state */ -); - -void cldfbAnalysis_ts_ivas( - const float *timeIn, /* i : time buffer */ - float realBuffer[CLDFB_NO_CHANNELS_MAX], /* o : real value buffer */ - float imagBuffer[CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer */ - const int16_t samplesToProcess, /* i : samples to process */ - HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filterbank state */ -); - -void cldfbSynthesis_ivas( - float **realBuffer, /* i : real values */ - float **imagBuffer, /* i : imag values */ - float *timeOut, /* o : synthesized output */ - const int16_t samplesToProcess, /* i : number of samples */ - HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ -); - -void configureCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i/o: filter bank handle */ - const int32_t sampling_rate /* i : sampling rate */ -); - - -void analysisCldfbEncoder_ivas( - Encoder_State *st, /* i/o: encoder state structure */ - const float *timeIn, - const int16_t samplesToProcess, - float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float *ppBuf_Ener ); - -void analysisCldfbEncoder_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word32 *timeIn, /*q11*/ - Word16 timeInq, /*q0*/ - Word16 samplesToProcess, /*q0*/ - Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - Word16 realBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - Word16 imagBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - Word32 *ppBuf_Ener, - Word16 *enerBuffSum_exp, - CLDFB_SCALE_FACTOR *scale ); - -ivas_error openCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const int32_t sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); - -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); - -void resampleCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ - const int32_t newSamplerate /* i : new samplerate to operate */ -); - -ivas_error cldfb_save_memory_ivas( - HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ -); - -void cldfb_restore_memory_ivas( - HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ -); - -void cldfb_reset_memory_ivas( - HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ -); - -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -); - -void fft_cldfb( - float *data, /* i/o: input/output vector */ - const int16_t size /* i : size of fft operation */ -); - -void BITS_ALLOC_init_config_acelp_IVAS( - const int32_t bit_rate, - const int16_t narrowBand, - const int16_t nb_subfr, - ACELP_config *acelp_cfg /* o : configuration structure of ACELP */ -); - -int16_t BITS_ALLOC_config_acelp_IVAS( - const int16_t bits_frame, /* i : remaining bit budget for the frame */ - const int16_t coder_type, /* i : acelp coder type */ - ACELP_config *acelp_cfg, /* i/o: configuration structure of ACELP */ - const int16_t narrowband, /* i : narrowband flag */ - const int16_t nb_subfr /* i : number of subframes */ -); - - -void FEC_clas_estim( - const float *syn, - const float *pitch, /* i : pitch values for each subframe */ - const int16_t L_frame, /* i : length of the frame */ - const int16_t coder_type, /* i : coder type */ - const int16_t codec_mode, /* i : codec mode */ - float *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */ - int16_t *clas, /* i/o: frame classification */ - float *lp_speech, /* i/o: long term active speech energy average */ - const int16_t Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - int16_t *decision_hyst, /* i/o: hysteresis of the music/speech decision */ - int16_t *locattack, /* i/o: detection of attack (mainly to localized speech burst) */ - int16_t *UV_cnt, /* i/o: number of consecutives frames classified as UV */ - float *LT_UV_cnt, /* i/o: long term consecutives frames classified as UV */ - float *Last_ener, /* i/o: last_energy frame */ - int16_t *amr_io_class, /* i/o: classification for AMR-WB IO mode */ - float *lt_diff_etot, /* i/o: long-term total energy variation */ - float *class_para, /* o : classification para. fmerit1 */ - const float LTP_Gain, /* i : */ - const int16_t narrowBand, /* i : */ - const SIGNAL_CLASSIFIER_MODE mode, /* i : */ - const int16_t bfi, /* i : */ - const float preemph_fac, /* i : */ - const int16_t tcxonly, /* i : */ - const int32_t last_core_brate, /* i : last core bitrate */ - const int16_t FEC_mode /* i : ACELP FEC mode */ -); - - -void SetTCXModeInfo( - Encoder_State *st, /* i/o: encoder state structure */ - TRAN_DET_HANDLE hTranDet, /* i/o: transient detection handle */ - int16_t *tcxModeOverlap /* o : window overlap of current frame */ -); - -void TCX_MDCT_flt( - const float *x, - float *y, - const int16_t l, - const int16_t m, - const int16_t r, - const int16_t element_mode ); - -void TCX_MDST_flt( - const float *x, - float *y, - const int16_t l, - const int16_t m, - const int16_t r, - const int16_t element_mode ); - -void TCX_MDCT_Inverse_flt( - const float *x, - float *y, - const int16_t l, - const int16_t m, - const int16_t r, - const int16_t element_mode ); - -void TCX_MDST_Inverse_flt( - const float *x, - float *y, - const int16_t l, - const int16_t m, - const int16_t r, - const int16_t element_mode ); - -void TCX_MDXT_Inverse_flt( - const float *x, - float *y, - const int16_t l, - const int16_t m, - const int16_t r, - const uint16_t kernel_type ); - -void post_decoder_flt( - Decoder_State *st, - float synth_buf[], - const float pit_gain[], - const int16_t pitch[], - float signal_out[], - float bpf_noise_buf[] ); -void cldfb_synth_set_bandsToZero_flt( - Decoder_State *st, /* i/o: decoder state structure */ - float **rAnalysis, - float **iAnalysis, - const int16_t nTimeSlots ); - -void longadd( - uint16_t a[], /* i/o: vector of the length lena */ - const uint16_t b[], /* i/o: vector of the length lenb */ - const int16_t lena, /* i/o: length of vector a[] */ - const int16_t lenb /* i/o: length of vector b[] */ -); - -void longshiftright( - uint16_t a[], /* i : vector of the length lena */ - const int16_t b, /* i : number of bit positions to shift right */ - uint16_t d[], /* o : vector of the length lend */ - int16_t lena, /* i : length of vector a[] */ - const int16_t lend /* i : length of vector d[] */ -); - -void longshiftleft( - const uint16_t a[], /* i : vector of the length len */ - const int16_t b, /* i : number of bit positions to shift left */ - uint16_t d[], /* o : vector of the length len */ - const int16_t len /* i : length of vector a[] and d[] */ -); - -void open_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const int16_t last_element_mode, /* i : last element mode */ - const int16_t is_init /* i : indicate call during initialization */ -); - -void acelp_plc_mdct_transition( - Decoder_State *st /* i/o: Decoder state */ -); - -void tcxltp_dec_init( - TCX_LTP_DEC_HANDLE hTcxLtpDec, - const int16_t ini_frame, - const int16_t last_codec_mode, - const int16_t element_mode, - const int16_t pit_max, - const int32_t sr_core ); - -void reset_tcx_overl_buf( - TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ -); - -void update_decoder_LPD_cng_flt( - Decoder_State *st, /* i/o: decoder state structure */ - float *timeDomainBuffer, - float *A, - float *bpf_noise_buf ); - -void reconfig_decoder_LPD_ivas( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t bits_frame, /* i : bit budget */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t L_frame_old /* i : frame length */ -); - -void mode_switch_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t bwidth, /* i : audio bandwidth */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last frame total bitrate */ - const int16_t frame_size_index, /* i : index determining the frame size */ - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const int16_t last_element_mode /* i : last element mode */ -); - -void dec_acelp_tcx_frame( - Decoder_State *st, /* i/o: decoder state structure */ - int16_t *concealWholeFrame, /* i/o: concealment flag */ - float *output, /* o : synthesis */ - float *bpf_noise_buf, /* i/o: BPF noise buffer */ - float *pcmbufFB, /* o : synthesis @output_FS */ - float bwe_exc_extended[], /* i/o: bandwidth extended excitation */ - float *voice_factors, /* o : voicing factors */ - float pitch_buf[], /* o : floating pitch for each subframe */ - STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */ -); - -void decoder_LPD( - Decoder_State *st, /* i/o: decoder memory state pointer */ - float signal_out[], /* o : signal with LPD delay (7 subfrs) */ - float signal_outFB[], /* o : synthesis @output_FS */ - int16_t *total_nbbits, /* i/o: number of bits / decoded bits */ - float *bpf_noise_buf, /* i/o: BPF noise buffer */ - int16_t bfi, /* i : BFI flag */ - int16_t *bitsRead, /* o : number of read bits */ - int16_t param[], /* o : buffer of parameters */ - float *pitch_buf, /* i/o: floating pitch values for each subfr*/ - float *voice_factors, /* o : voicing factors */ - float *ptr_bwe_exc /* o : excitation for SWB TBE */ -); - -int16_t tcxGetNoiseFillingTilt_flt( - const float A[], - const int16_t L_frame, - const int16_t mode, - float *noiseTiltFactor ); - -void tcxFormantEnhancement_flt( - float xn_buf[], - const float *gainlpc, - float spectrum[], - const int16_t L_frame ); - -void tcxInvertWindowGrouping_flt( - TCX_CONFIG_HANDLE hTcxCfg, - float xn_buf[], - float spectrum[], - const int16_t L_frame, - const int8_t fUseTns, - const int16_t last_core, - const int16_t index, - const int16_t frame_cnt, - const int16_t bfi ); - -void tcx5SpectrumInterleaving( - const int16_t tcx5Size, - float *spectrum ); - -void tcx5SpectrumDeinterleaving( - const int16_t tcx5Size, - float *spectrum ); - -void tcx5TnsGrouping( - const int16_t L_frame, - const int16_t L_spec, - float *spectrum ); - -void tcx5TnsUngrouping( - const int16_t L_frame, - const int16_t L_spec, - float *spectrum, - const int16_t enc_dec ); - -void lerp_flt( - const float *f, - float *f_out, - const int16_t bufferNewSize, - const int16_t bufferOldSize ); - -void encoderSideLossSimulation( - Encoder_State *st, - PLC_ENC_EVS_HANDLE hPlc_Ext, - float *isf_q, - const float stab_fac, - const int16_t calcOnlyISF, - const int16_t L_frame ); - -void enc_prm_side_Info( - PLC_ENC_EVS_HANDLE hPlc_Ext, - Encoder_State *st ); - -void GplcTcxEncSetup( - const int16_t tcxltp_pitch_int, - PLC_ENC_EVS_HANDLE hPlc_Ext ); - -int16_t encSideSpecPowDiffuseDetector( - float *isf_ref, - float *isf_con, - const int32_t sr_core, - float *prev_isf4_mean, - const int16_t sw, - const int16_t coder_type ); - -void updateSpecPowDiffuseIdx( - const float gain_pitch_buf[], /* i : gain pitch values */ - const float gain_code_buf[], /* i : gain pitch values */ - int16_t glr_idx[2], /* o : */ - float mean_gc[2] /* o : */ -); - -void getLookAheadResSig_flt( - float *speechLookAhead, - const float *A, - float *res, - const int16_t L_frame, - const int16_t L_subfr, - const int16_t m, - const int16_t numSubFrame ); - -void updatelsfForConcealment_flt( - PLC_ENC_EVS_HANDLE decState, - float *lsf ); - -void getConcealedLP_flt( - PLC_ENC_EVS_HANDLE memDecState, - float *AqCon, - const float xsfBase[], - const int32_t sr_core, - const int16_t last_good, - const int16_t L_frame ); - -void RecLpcSpecPowDiffuseLc_flt( - float *ispq, - float *isp_old, - float *isfq, - Decoder_State *st, - const int16_t reset_q ); - -void modify_lsf_flt( - float *lsf, - const int16_t n, - const int32_t sr_core, - const int16_t reset_q ); - -void init_PLC_enc( - PLC_ENC_EVS_HANDLE hPlcExt, - const int32_t sr_core ); - -void gPLC_encInfo( - PLC_ENC_EVS_HANDLE hPlcExt, - const int32_t total_brate, - const int16_t bwidth, - const int16_t last_clas, - const int16_t coder_type ); - -void resetTecDec( - TEC_DEC_HANDLE hTecDec ); - -void calcGainTemp_TBE( - float **pCldfbRealSrc, - float **pCldfbImagSrc, - float *loBuffer, - const int16_t startPos, /*!< Start position of the current envelope. */ - const int16_t stopPos, /*!< Stop position of the current envelope. */ - const int16_t lowSubband, /* lowSubband */ - float *pGainTemp, - const int16_t code ); - -void procTecTfa_TBE( - float *hb_synth, - float *gain, - const int16_t flat_flag, - const int16_t last_core, - const int16_t L_subfr, - const int16_t code ); - -void resetTecEnc( - TEC_ENC_HANDLE hTecEnc, - const int16_t flag ); - -void calcHiEnvLoBuff( - const int16_t noCols, - const int16_t *pFreqBandTable, /* i : freqbandTable */ - const int16_t nSfb, /* i : Number of scalefactors */ - float **pYBuf, - float *loBuf, - float *hiTempEnv ); - -void calcLoEnvCheckCorrHiLo( - const int16_t noCols, - const int16_t *pFreqBandTable, /* i : freqbandTable */ - float *loBuf, - float *loTempEnv, - float *loTempEnv_ns, - float *hiTempEnv, - int16_t *corr_flag /* o : 0 for original, 1 for TEC */ -); - - -void tecEnc_TBE( - int16_t *corrFlag, - const float *voicing, - const int16_t coder_type ); - -void set_TEC_TFA_code( - const int16_t corrFlag, - int16_t *tec_flag, - int16_t *tfa_flag ); - -float Damping_fact_flt( - const int16_t coder_type, /* i : ACELP core coder type */ - const int16_t nbLostCmpt, /* i : compt for number of consecutive lost frame */ - int16_t last_good, /* i : class of last good received frame */ - float stab_fac, /* i : LSF stability factor */ - float *lp_gainp, /* i/o: low passed pitch gain used for concealment */ - const int16_t core /* i : current core: ACELP = 0, TCX20 = 1, TCX10 = 2 */ -); - -float getLevelSynDeemph( - const float h1Init[], /* i : input value or vector to be processed */ - const float A[], /* i : LPC coefficients */ - const int16_t lenLpcExc, /* i : length of the LPC excitation buffer */ - const float preemph_fac, /* i : preemphasis factor */ - const int16_t numLoops /* i : number of loops */ -); - -void genPlcFiltBWAdap( - const int32_t sr_core, /* i : core sampling rate */ - float *lpFiltAdapt, /* o : filter coefficients for filtering codebooks in case of flc */ - const int16_t type, /* i : type of filter, either 0 : lowpass or 1 : highpass */ - const float alpha /* i : fade out factor [0 1) used decrease filter tilt */ -); - -void highPassFiltering( - const int16_t last_good, /* i : last classification type */ - const int16_t L_buffer, /* i : buffer length */ - float exc2[], /* i/o: unvoiced excitation before the high pass filtering */ - const float hp_filt[], /* i : high pass filter coefficients */ - const int16_t l_fir_fer /* i : high pass filter length */ -); - -int16_t GetPLCModeDecision( - Decoder_State *st /* i/o: decoder memory state pointer */ -); - -void addBassPostFilter( - const float *harm_timeIn, - const int16_t samplesToProcess, - float **rAnalysis, - float **iAnalysis, - HANDLE_CLDFB_FILTER_BANK cldfb ); - -ivas_error TonalMDCTConceal_Init_ivas( - TonalMDCTConcealPtr hTonalMDCTConc, - const uint16_t samplesPerBlock, - const uint16_t nSamplesCore, - const uint16_t nScaleFactors, - TCX_CONFIG_HANDLE hTcxCfg ); - -void TonalMDCTConceal_SaveFreqSignal_ivas( - TonalMDCTConcealPtr hTonalMDCTConc, - const float *mdctSpectrum, - const uint16_t numSamples, - const uint16_t nNewSamplesCore, - const float *scaleFactors, - const int16_t infoIGFStartLine ); - -void TonalMDCTConceal_UpdateState_ivas( - TonalMDCTConcealPtr hTonalMDCTConc, - const int16_t numSamples, - const float pitchLag, - const int16_t badBlock, - const int16_t tonalConcealmentActive ); - -void TonalMDCTConceal_SaveTimeSignal_ivas( - TonalMDCTConcealPtr hTonalMDCTConc, - float *timeSignal, - const int16_t numSamples ); - -void TonalMDCTConceal_Detect_ivas( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - const float pitchLag, /*IN */ - int16_t *umIndices, /*OUT*/ - const PsychoacousticParameters *psychParamsCurrent /*IN*/ -); - -void TonalMDCTConceal_Apply_ivas( - TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - float *mdctSpectrum, /*OUT*/ - const PsychoacousticParameters *psychParamsCurrent /*IN*/ -); - -void TonalMDCTConceal_InsertNoise_ivas( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - float *mdctSpectrum, /*OUT*/ - const int16_t tonalConcealmentActive, - int16_t *pSeed, /*IN/OUT*/ - const float tiltCompFactor, - const float crossfadeGain, - const float concealment_noise[L_FRAME48k], - const float cngLevelBackgroundTrace_bfi, - const int16_t crossOverFreq ); - -void DetectTonalComponents_flt( - uint16_t indexOfTonalPeak[], - uint16_t lowerIndex[], - uint16_t upperIndex[], - uint16_t *pNumIndexes, - const float lastPitchLag, - const float currentPitchLag, - const float lastMDCTSpectrum[], - const float scaleFactors[], - const float secondLastPowerSpectrum[], - const uint16_t nSamples, - const uint16_t nSamplesCore, - float floorPowerSpectrum, - const PsychoacousticParameters *psychParamsCurrent ); - -void RefineTonalComponents_flt( - uint16_t indexOfTonalPeak[], - uint16_t lowerIndex[], - uint16_t upperIndex[], - float phaseDiff[], - float phases[], - uint16_t *pNumIndexes, - const float lastPitchLag, - const float currentPitchLag, - const float lastMDCTSpectrum[], - const float scaleFactors[], - const float secondLastPowerSpectrum[], - const uint16_t nSamples, - const uint16_t nSamplesCore, - float floorPowerSpectrum, - const PsychoacousticParameters *psychParamsCurrent ); - -ivas_error PsychoacousticParameters_Init( - const int32_t sr_core, /* i : sampling rate of core-coder */ - const int16_t nBins, /* i : Number of bins (spectral lines) */ - const int8_t nBands, /* i : Number of spectrum subbands */ - const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ - const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ - PsychoacousticParameters *pPsychParams ); - -void concealment_init( - const int16_t L_frameTCX, - T_PLCInfo_HANDLE hPlcInfo ); - -void concealment_decode( - const int16_t core, - float *invkoef, - T_PLCInfo_HANDLE hPlcInfo ); - -void concealment_update( - const int16_t bfi, - const int16_t core, - const int16_t harmonic, - float *invkoef, - T_PLCInfo_HANDLE hPlcInfo ); - -void concealment_update2( - const float *outx_new, - T_PLCInfo_HANDLE hPlcInfo, - const int16_t L_frameTCX ); - -void concealment_signal_tuning( - Decoder_State *st, - const int16_t bfi, - float *outx_new, - const int16_t past_core_mode ); - -void waveform_adj2( - T_PLCInfo_HANDLE hPlcInfo, - float *overlapbuf, - float *outx_new, - const int16_t delay, - const int16_t bfi_cnt, - const int16_t bfi ); - -float SFM_Cal( - const float fcoef[], - const int16_t n ); - -void set_state_ivas( - int16_t *state, - const int16_t num, - const int16_t N ); - -int16_t RFFTN( - float *afftData, - const float *trigPtr, - const int16_t len, - const int16_t isign ); - -void DoFFT( - float *re2, - float *im2, - const int16_t length ); - -/*! r: flag indicating a valid bitrate */ -int16_t is_EVS_bitrate( - const int32_t ivas_total_brate, /* i : EVS total bitrate */ - int16_t *Opt_AMR_WB /* i : AMR-WB IO flag */ -); - -int16_t getTcxonly_ivas( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const int16_t is_ism_format /* i : flag indicating ISM format */ -); - -int16_t getTnsAllowed( - const int32_t total_brate, /* i : total bitrate */ - const int16_t igf, /* i : flag indicating IGF activity*/ - const int16_t element_mode /* i : IVAS element mode */ -); - -int16_t getCtxHm( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t rf_flag /* i : flag to signal the RF mode */ -); - -int16_t getResq( - const int32_t total_brate /* i : total bitrate */ -); - -int16_t getMdctWindowLength( - const int16_t fscale ); - -int16_t sr2fscale( - const int32_t sr_core /* i : internal sampling rate */ -); - -int32_t getCoreSamplerateMode2_flt( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ -); - -float getTcxBandwidth_flt( - const int16_t bwidth /* i : audio bandwidth */ -); - - -int16_t getCnaPresent( - const int16_t element_mode, /* i : element mode */ - const int32_t element_brate, /* i : element bitrate */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bwidth /* i : audio bandwidth */ -); - -int16_t getTcxLtp( - const int32_t sr_core /* i : internal sampling rate */ -); - -int16_t initPitchLagParameters( - const int32_t sr_core, /* i : internal sampling rate */ - int16_t *pit_min, - int16_t *pit_fr1, - int16_t *pit_fr1b, - int16_t *pit_fr2, - int16_t *pit_max ); - -void attenuateNbSpectrum( - const int16_t L_frame, - float *spectrum ); - -void SetModeIndex( - Encoder_State *st, /* i : Encoder state */ - const int32_t last_total_brate, /* i : last total bitrate */ - const int16_t last_element_mode, /* i : last IVAS element mode */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -); - -int16_t getNumTcxCodedLines( - const int16_t bwidth /* i : audio bandwidth */ -); - -int16_t getTcxLpcShapedAri( - const int32_t total_brate, /* i : total bitrate */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const int16_t element_mode /* i : IVAS element mode */ -); - -void IGFEncApplyMono( - Encoder_State *st, /* i : Encoder state */ - const int16_t igfGridIdx, /* i : IGF grid index */ - float *pMDCTSpectrum, /* i/o: MDCT spectrum */ - float *pPowerSpectrum, /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ - const int16_t isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */ - const int16_t isTNSActive, /* i : flag indicating if the TNS is active */ - const int16_t sp_aud_decision0, /* i : first stage switching decision */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ -); - -void IGFEncApplyStereo( - STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */ - int16_t ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ - const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */ - const int16_t igfGridIdx, /* i : IGF grid index */ - Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ - float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ - float *pPowerSpectrumMsInv[CPE_CHANNELS][NB_DIV], /* i/o: inverse power spectrum */ - float *inv_spectrum[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const int16_t frameno, /* i : flag indicating index of current subframe */ - const int16_t sp_aud_decision0, /* i : sp_aud_decision0 */ - const int32_t element_brate, /* i : element bitrate */ - const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ -); - - -void IGFEncResetTCX10BitCounter_ivas_fx( - const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */ -); - -ivas_error IGF_Reconfig( - IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ - const int16_t igf, /* i : IGF on/off */ - const int16_t reset, /* i : reset flag */ - const int32_t brate, /* i : bitrate for configuration */ - const int16_t bwidth, /* i : signal bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t rf_mode /* i : flag to signal the RF mode */ -); - -void IGFEncSetMode( - const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ - const int32_t total_brate, /* i : encoder total bitrate */ - const int16_t bwidth, /* i : encoder audio bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t rf_mode /* i : flag to signal the RF mode */ -); - -/*! r: number of bits written per frame */ -int16_t IGFEncWriteBitstream( - const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t *pBitOffset, /* i : ptr to bitOffset counter */ - const int16_t igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ - const int16_t isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */ -); - -/*! r: total number of bits written */ -int16_t IGFEncWriteConcatenatedBitstream( - const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -); - -void IGFDecApplyMono_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i : instance handle of IGF Decoder */ - float *spectrum, /* i/o: MDCT spectrum */ - const int16_t igfGridIdx, /* i : in case of CELP->TCX switching, use 1.25 framelength */ - const int16_t bfi, /* i : frame loss == 1, frame good == 0 */ - const int16_t element_mode /* i : IVAS element mode */ -); - -void IGFDecCopyLPCFlatSpectrum_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ - const float *pSpectrumFlat, /* i : LPC flattend spectrum from TCX dec */ - const int16_t igfGridIdx /* i : IGF grid index */ -); - -void IGFDecReadData_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Deccoder */ - Decoder_State *st, /* i : decoder state */ - const int16_t igfGridIdx, /* i : in case of CELP->TCX switching, use 1.25 framelength */ - const int16_t isIndepFrame /* i : if 1: arith dec force reset, if 0: no reset */ -); - -/*! r: return igfAllZero flag indicating if no envelope is transmitted */ -int16_t IGFDecReadLevel_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Deccoder */ - Decoder_State *st, /* i : decoder state */ - const int16_t igfGridIdx, /* i : in case of CELP->TCX switching, use 1.25 framelength */ - const int16_t isIndepFrame /* i : if 1: arith dec force reset, if 0: no reset */ -); - -void IGFDecRestoreTCX10SubFrameData_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* o : instance handle of IGF Decoder */ - const int16_t subFrameIdx /* i : index of subframe */ -); - -void init_igf_dec_flt( - IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ -); - -void IGFDecSetMode_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* o : instance handle of IGF Decoder */ - const int32_t total_brate, /* i : bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t defaultStartLine, /* i : default start subband index */ - const int16_t defaultStopLine, /* i : default stop subband index */ - const int16_t rf_mode /* i : flag to signal the RF mode */ -); - -void IGFDecStoreTCX10SubFrameData_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ - const int16_t subFrameIdx /* i : index of subframe */ -); - -void IGFDecUpdateInfo_flt( - const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ - const int16_t subFrameIdx, /* i : subframe index */ - const int16_t igfGridIdx /* i : IGF grid index */ -); - -/*! r: error value: 0 -> error, 1 -> ok */ -int16_t IGFCommonFuncsIGFConfiguration_flt( - const int32_t total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t element_mode, /* i : IVAS element mode */ - H_IGF_INFO hIGFInfo, /* o : IGF info handle */ - const int16_t rf_mode /* i : flag to signal the RF mode */ -); - -/*! r: error value: 0 -> error, 1 -> ok */ -int16_t IGFCommonFuncsIGFGetCFTables_flt( - const int32_t total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t element_mode, /* i : element mode */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const uint16_t **cf_se00, /* i : CF table for t == 0 and f == 0 */ - const uint16_t **cf_se01, /* i : CF table for t == 0 and f == 1 */ - int16_t *cf_off_se01, /* o : offset for CF table above */ - const uint16_t **cf_se02, /* i : CF tables for t == 0 and f >= 2 */ - const int16_t **cf_off_se02, /* o : offsets for CF tables above */ - const uint16_t **cf_se10, /* i : CF table for t == 1 and f == 0 */ - int16_t *cf_off_se10, /* o : offset for CF table above */ - const uint16_t **cf_se11, /* i : CF tables for t == 1 and f >= 1 */ - const int16_t **cf_off_se11 /* o : offsets for CF tables above */ -); - -/*! r: multiplication factor */ -int16_t IGF_ApplyTransFac_flt( - const int16_t val, /* i : input value for multiplication, Q15 */ - const float transFac /* i : multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */ -); - -/*! r: return bitrate index */ -int16_t IGF_MapBitRateToIndex_flt( - const int32_t brate, /* i : bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t element_mode, /* i : element mode */ - const int16_t rf_mode /* i : flag to signal the RF mode */ -); - - -void IGFSCFDecoderOpen_ivas( - IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data */ - H_IGF_INFO hIgfInfo, /* i : IGF info handle */ - const int32_t total_brate, - const int16_t bwidth, - const int16_t element_mode, - const int16_t rf_mode ); - -void IGFSCFDecoderReset_ivas( - IGFSCFDEC_INSTANCE_HANDLE hPublicData /* i : handle to public data or NULL in case there was no instance created */ -); - -void IGFSCFDecoderDecode_ivas( - IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ - Decoder_State *st, /* i/o: pointer to decoder state */ - int16_t *sfe, /* o : ptr to an array which will contain the decoded quantized coefficients */ - const int16_t igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ - const int16_t indepFlag /* i : if 1 on input the decoder will be forced to reset, - if 0 on input the decoder will be forced to encode without a reset */ -); - -/*! r: offset value */ -int16_t tbe_celp_exc_offset_flt( - const int16_t T0, /* i : Integer pitch */ - const int16_t T0_frac /* i : Fractional part of the pitch */ -); - -void blend_subfr2_flt( - float *sigIn1, /* i : input signal for fade-out */ - float *sigIn2, /* i : input signal for fade-in */ - float *sigOut /* o : output signal */ -); - -void init_tcx_window_cfg( - TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX Config handle */ - const int32_t sr_core, /* i : SR core */ - const int32_t input_Fs, /* i : input/output SR */ - const int16_t L_frame, /* i : L_frame at sr_core */ - const int16_t L_frameTCX, /* i : L_frame at i/o SR */ - const int16_t encoderLookahead_enc, /* i : encoder LA at sr_core */ - const int16_t encoderLookahead_FB, /* i : encoder LA at i/o SR */ - const int16_t mdctWindowLength, /* i : window length at sr_core */ - const int16_t mdctWindowLengthFB, /* i : window length at i/o SR */ - const int16_t element_mode /* i : mode of CPE/SCE */ -); - -void init_tcx_cfg( - TCX_CONFIG_HANDLE hTcxCfg, - const int32_t total_brate, - const int32_t sr_core, - const int32_t input_Fs, - const int16_t L_frame, - const int16_t bwidth, - const int16_t L_frameTCX, - const int16_t fscale, - const int16_t encoderLookahead_enc, - const int16_t encoderLookahead_FB, - const float preemph_fac, - const int16_t tcxonly, - const int16_t rf_mode, - const int16_t igf, - const int16_t infoIGFStopFreq, - const int16_t element_mode, - const int16_t ini_frame, - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -); - -#endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 51fbb12d5..9b596ca42 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -49,14 +49,63 @@ #include "ivas_cnst.h" #include "stat_enc.h" #include "stat_dec.h" +#include "stat_com.h" #include "ivas_stat_enc.h" #include "ivas_stat_dec.h" +#include "ivas_stat_com.h" #include "ivas_error.h" #include "ivas_error_utils.h" #include "complex_basop.h" #define TCX_IMDCT_SCALE 15 #define TCX_IMDCT_HEADROOM 1 + +/*----------------------------------------------------------------------------------* + * Prototypes of global macros + *----------------------------------------------------------------------------------*/ + +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef TRUNC +#define TRUNC( x ) ( (int16_t) ( ( ( x ) >= 32767. ? 32767 : ( ( x ) <= -32768. ? -32768 : ( x ) ) ) + 0.5 ) ) +#endif + +#define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) +#define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) + +#ifndef ABSVAL +#define ABSVAL( a ) ( ( a ) >= 0 ? ( a ) : ( -( a ) ) ) +#endif + +#ifndef SQR +#define SQR( a ) ( ( a ) * ( a ) ) +#endif + +#ifndef SWAP +#define SWAP( a, b ) \ + { \ + tempr = ( a ); \ + ( a ) = ( b ); \ + ( b ) = tempr; \ + } +#endif + +#ifndef swap +#define swap( x, y, type ) \ + { \ + type u__p; \ + u__p = x; \ + x = y; \ + y = u__p; \ + } +#endif + /*================================================================================*/ /* conversion functions: */ /*================================================================================*/ @@ -10920,7 +10969,6 @@ void IGFEncConcatenateBitstream( BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ ); -#endif void hq_generic_hf_encoding_fx( const Word32 *coefs_fx, /* i : MDCT coefficients of weighted original */ @@ -11205,3 +11253,746 @@ void WriteToBitstream_ivas_fx( Word16 *pnSize, BSTR_ENC_HANDLE hBstr, Word16 *pnBits ); + + +/*===========================================================================================*/ +/*----------------------------------------------------------------------------------* + * MODE1 prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: inverse square root of input value */ +float inv_sqrt( + const float x /* i : input value */ +); + +/*! r: output random value */ +int16_t own_random( + int16_t *seed /* i/o: random seed */ +); + +/*! r: sign of x (+1/-1) */ +float sign( + const float x /* i : input value of x */ +); + +/*! r: logarithm2 of x */ +float log2_f( + const float x /* i : input value of x */ +); + +int16_t norm_ul_float( + uint32_t UL_var1 ); + +/*! r: sum of all vector elements */ +int16_t sum_s( + const int16_t *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +); + +/*! r: sum of all vector elements */ +int32_t sum_l( + const int32_t *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +); + +/*! r: sum of all squared vector elements */ +float sum2_f( + const float *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +); + +void set_c( + int8_t y[], /* i/o: Vector to set */ + const int8_t a, /* i : Value to set the vector to */ + const int32_t N /* i : Length of the vector */ +); + +void set_s( + int16_t y[], /* i/o: Vector to set */ + const int16_t a, /* i : Value to set the vector to */ + const int16_t N /* i : Lenght of the vector */ +); + +void set_l( + int32_t y[], /* i/o: Vector to set */ + const int32_t a, /* i : Value to set the vector to */ + const int16_t N /* i : Length of the vector */ +); + +void set_f( + float y[], /* i/o: Vector to set */ + const float a, /* i : Value to set the vector to */ + const int16_t N /* i : Lenght of the vector */ +); + +void set_zero_fx( + Word32 *vec, /* o : input vector */ + const Word16 lvec /* i : length of the vector */ +); +void set_zero2_fx( + Word32 *vec, /* o : input vector */ + const Word32 lvec /* i : length of the vector */ +); +void set16_zero_fx( + Word16 *vec, /* o : input vector */ + const Word16 lvec /* i : length of the vector */ +); + +void set_zero( + float *vec, /* o : input vector */ + const int16_t lvec /* i : length of the vector */ +); + +void mvr2r( + const float x[], /* i : input vector */ + float y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + +void mvs2s( + const int16_t x[], /* i : input vector */ + int16_t y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + +uint32_t mvr2s( + const float x[], /* i : input vector */ + int16_t y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + +void mvs2r( + const int16_t x[], /* i : input vector */ + float y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + +void mvl2l( + const int32_t x[], /* i : input vector */ + int32_t y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + + +/*! r: index of the maximum value in the input vector */ +int16_t maximum( + const float *vec, /* i : input vector */ + const int16_t lvec, /* i : length of input vector */ + float *max_val /* o : maximum value in the input vector */ +); +/*! r: index of the maximum value in the input vector */ +int16_t maximumAbs( + const float *vec, /* i : input vector */ + const int16_t lvec, /* i : length of input vector */ + float *max_val /* o : maximum value in the input vector */ +); + +Word16 maximumAbs_l( + const Word32 *vec, /* i : input vector */ + const Word16 lvec, /* i : length of input vector */ + Word32 *max_val /* o : maximum value in the input vector */ +); + +/*! r: index of the minimum value in the input vector */ +int16_t minimum( + const float *vec, /* i : input vector */ + const int16_t lvec, /* i : length of input vector */ + float *min_val /* o : minimum value in the input vector */ +); + +/*! r: index of the minimum value in the input vector */ +int16_t minimum_s( + const int16_t *vec, /* i : Input vector */ + const int16_t lvec, /* i : Vector length */ + int16_t *min_val /* o : minimum value in the input vector */ +); + +/*! r: return index with max energy value in vector */ +int16_t emaximum( + const float *vec, /* i : input vector */ + const int16_t lvec, /* i : length of input vector */ + float *ener_max /* o : maximum energy value */ +); + +/*! r: vector mean */ +float mean( + const float *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +); + +/*! r: dot product of x[] and y[] */ +float dotp( + const float x[], /* i : vector x[] */ + const float y[], /* i : vector y[] */ + const int16_t n /* i : vector length */ +); + +void v_add( + const float x1[], /* i : Input vector 1 */ + const float x2[], /* i : Input vector 2 */ + float y[], /* o : Output vector that contains vector 1 + vector 2 */ + const int16_t N /* i : Vector length */ +); + +void v_sub( + const float x1[], /* i : Input vector 1 */ + const float x2[], /* i : Input vector 2 */ + float y[], /* o : Output vector that contains vector 1 - vector 2 */ + const int16_t N /* i : Vector length */ +); + +/*! r: dequanzited gain */ +float usdequant( + const int16_t idx, /* i : quantizer index */ + const float qlow, /* i : lowest codebook entry (index 0) */ + const float delta /* i : quantization step */ +); + +void sort( + uint16_t *x, /* i/o: Vector to be sorted */ + uint16_t len /* i/o: vector length */ +); + +void sort_l( + Word32 *x, /* i/o: Vector to be sorted */ + Word16 len /* i/o: vector length */ +); + + +ivas_error push_indice( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + int16_t id, /* i : ID of the indice */ + uint16_t value, /* i : value of the quantized indice */ + int16_t nb_bits /* i : number of bits used to quantize the indice */ +); + +ivas_error push_next_indice( + BSTR_ENC_HANDLE hBstr, + UWord16 value, /* i : value of the quantized indice */ + Word16 nb_bits /* i : number of bits used to quantize the indice */ +); + +ivas_error push_next_bits( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */ + const Word16 nb_bits /* i : number of bits to pack */ +); + +/*! r: maximum number of indices */ +Word16 get_ivas_max_num_indices_fx( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +/*! r: maximum number of indices */ +int16_t get_BWE_max_num_indices( + const int32_t extl_brate /* i : extensiona layer bitrate */ +); + +/*! r: maximum number of indices */ +Word16 get_ivas_max_num_indices_metadata_fx( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); +ivas_error ind_list_realloc( + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ +); + +ivas_error check_ind_list_limits( + BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ +); + +void move_indices( + INDICE_HANDLE old_ind_list, /* i/o: old location of indices */ + INDICE_HANDLE new_ind_list, /* i/o: new location of indices */ + const int16_t nb_indices /* i : number of moved indices */ +); + +/*! r: index of the indice in the list, -1 if not found */ +int16_t find_indice( + BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ + const int16_t id, /* i : ID of the indice */ + uint16_t *value, /* o : value of the quantized indice */ + int16_t *nb_bits /* o : number of bits used to quantize the indice */ +); + +/*! r: number of deleted indices */ +uint16_t delete_indice( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const int16_t id /* i : ID of the indice */ +); + +/*! r: value of the indice */ +uint16_t get_next_indice( + Decoder_State *st, /* i/o: decoder state structure */ + int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +); + +/*! r: value of the indice */ +uint16_t get_next_indice_1( + Decoder_State *st /* i/o: decoder state structure */ +); + +void get_next_indice_tmp( + Decoder_State *st, /* o : decoder state structure */ + int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +); + +/*! r: value of the indice */ +uint16_t get_indice( + Decoder_State *st, /* i/o: decoder state structure */ + int16_t pos, /* i : absolute position in the bitstream */ + int16_t nb_bits /* i : number of bits that were used to quantize the indice */ +); + +void reset_indices_enc( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const int16_t max_num_indices /* i : max number of indices */ +); + +void reset_indices_dec( + Decoder_State *st /* i/o: decoder state structure */ +); + +Word16 rate2EVSmode_float( + const Word32 brate, /* i : bitrate */ + int16_t *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ +); + + +/*! r: 1 = OK, 0 = something wrong */ +ivas_error read_indices( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t bit_stream[], /* i : bitstream buffer */ + UWord16 num_bits, /* i : number of bits in bitstream */ + int16_t *prev_ft_speech, + int16_t *CNG, + int16_t bfi /* i : bad frame indicator */ +); + + +void ivas_set_bitstream_pointers( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +Decoder_State **reset_elements( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void mdct_switching_dec_ivas_fx( + Decoder_State *st /* i/o: decoder state structure */ +); + +int16_t print_disclaimer( + FILE *fPtr ); + +void fft_rel( + float x[], /* i/o: input/output vector */ + const int16_t n, /* i : vector length */ + const int16_t m /* i : log2 of vector length */ +); + +void preemph_ivas_fx( + Word32 *signal, /* i/o: signal Qx*/ + const Word16 mu, /* i : preemphasis factor Q15*/ + const Word16 L, /* i : vector size Q0*/ + Word32 *mem /* i/o: memory (x[-1]) Qx*/ +); + +void create_offset( + UWord32 *offset_scale1, + UWord32 *offset_scale2, + const int16_t mode, + const int16_t prediction_flag ); + +void BASOP_cfft_ivas( + Word32 *re, /* i/o: real part */ + Word32 *im, /* i/o: imag part */ + Word16 s, /* i : stride real and imag part */ + Word16 *scale /* i : scalefactor */ +); + +Word32 ar_div_ivas( + Word32 num, + Word32 denum ); + +Word32 Mult_32_16( + Word32 a, + Word16 b ); + +Word32 Mult_32_32( + Word32 a, + Word32 b ); + + +void bit_allocation_second_fx2( + Word32 *Rk, + Word32 *Rk_sort, + Word16 BANDS, + const Word16 *band_width, + Word16 *k_sort, + Word16 *k_num, + const Word16 *p2a_flags, + const Word16 p2a_bands, + const Word16 *last_bitalloc, + const Word16 input_frame ); + +void bit_allocation_second_fx2( + Word32 *Rk, + Word32 *Rk_sort, + Word16 BANDS, + const Word16 *band_width, + Word16 *k_sort, + Word16 *k_num, + const Word16 *p2a_flags, + const Word16 p2a_bands, + const Word16 *last_bitalloc, + const Word16 input_frame ); + +#ifdef DEBUGGING +void read_next_force( + int16_t *force, /* i/o: force value (0/1, 0 = speech, 1 = music)*/ + FILE *f_force, /* i : force switching profile (0 if N/A) */ + int32_t *force_profile_cnt /* i/o: counter of frames for force switching profile file */ +); +#endif + +ivas_error init_encoder_ivas_fx( + Encoder_State *st, /* i/o: state structure */ + Encoder_Struct *st_ivas, /* i/o: encoder state structure */ + const Word16 idchan, /* i : channel ID */ + const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */ + const Word16 interval_SID, /* i : interval for SID update */ + const Word16 vad_only_flag, /* i : flag to indicate front-VAD structure */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const Word32 element_brate /* i : element bitrate */ +); + +ivas_error acelp_core_enc_ivas_fx( + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 inp[], /* i : input signal of the current frame Q_new*/ + Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes Q12*/ + const Word32 epsP[M + 1], /* i : LP prediction errors Qx*/ + Word16 lsp_new[M], /* i : LSPs at the end of the frame Q15*/ + Word16 lsp_mid[M], /* i : LSPs in the middle of the frame Q15*/ + const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ + const Word16 attack_flag, /* i : attack flag (GSC or TC) Q0*/ + Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation st->prev_Q_bwe_exc*/ + Word16 *voice_factors_fx, /* o : voicing factors Q15*/ + Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE q_old_syn_12k8_16*/ + Word16 *q_old_syn_12k8_16, + Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ + Word16 *unbits, /* o : number of unused bits Q0*/ + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel X2.56*/ + Word16 Q_new ); + +void flip_and_downmix_generic_fx_32( + Word32 input[], /* i : input spectrum Qx*/ + Word32 output[], /* o : output spectrum Qx*/ + const Word16 length, /* i : length of spectra */ + Word32 mem1_ext[HILBERT_ORDER1], /* i/o: memory Qx*/ + Word32 mem2_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ + Word32 mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ + Word16 *phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ +); + +void GenTransition_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal : Q11 */ + const Word32 output_Fs, /* i : output sampling rate : Q0 */ + const Word16 element_mode, /* i : element mode : Q0 */ + const Word16 L_frame, /* i : ACELP frame length : Q0 */ + const Word16 rf_flag, /* i : RF flag : Q0 */ + const Word32 total_brate, /* i : total bitrate : Q0 */ + const Word16 prev_Qx ); + +void GenTransition_WB_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal : Q11 */ + const Word32 output_Fs /* i : output sampling rate */ +); + +Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ + const Word16 pos1, /* i: position of the pulse 1 */ + const Word16 pos2, /* i: position of the pulse 2 */ + const Word16 N /* i: number of bits FOR position */ +); + +void bands_and_bit_alloc_ivas_fx( + const Word16 cor_strong_limit, /* i : HF correlation */ + const Word16 noise_lev, /* i : dwn scaling factor */ + const Word32 core_brate, /* i : core bit rate */ + const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/ + const Word16 bits_used, /* i : Number of bit used before frequency Q */ + Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */ + const Word16 *Ener_per_bd_iQ, /* i/o: Quantized energy vector */ + Word16 *max_ener_band, /* o : Sorted order */ + Word16 *out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */ + Word16 *nb_subbands, /* o : Number of subband allowed */ + const Word16 *exc_diff, /* i : Difference signal to quantize (encoder side only) */ + Word16 *concat_in, /* o : Concatened PVQ's input vector (encoder side only) */ + Word16 *pvq_len, /* o : Number of bin covered with the PVQ */ + const Word16 coder_type, /* i : coding type */ + const Word16 bwidth, /* i : input signal bandwidth */ + const Word16 GSC_noisy_speech, /* i : GSC noisy speech flag */ + const Word16 L_frame, /* i : frame length */ + const Word16 element_mode, /* i : element mode */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ +); + +void ivas_find_wsp_fx( + const Word16 L_frame, /* i : length of the frame Q0*/ + const Word16 L_subfr, /* i : length of subframe Q0*/ + const Word16 nb_subfr, /* i : number of subframes Q0*/ + const Word16 *A_fx, + /* i : A(z) filter coefficients */ // Q12 + Word16 *Aw_fx, + /* o : weighted A(z) filter coefficients */ // Q12 + const Word16 *speech_fx, + /* i : pointer to the denoised speech frame */ // Q_new + const Word16 tilt_fact, + /* i : tilt factor */ // Q15 + Word16 *wsp_fx, + /* o : poitnter to the weighted speech frame */ // Q_new + Word16 *mem_wsp_fx, + /* i/o: W(Z) denominator memory */ // Q_new + const Word16 gamma, + /* i : weighting factor */ // Q15 + const Word16 L_look /* i : look-ahead Q0*/ +); + +Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( + Word16 *x, /* Q0 */ + const Word16 nt, /* Q0 */ + const Word16 target, /* Q0 */ + HANDLE_RC_CONTEXT_MEM hContextMem ); + +Word16 RCcontextMapping_encode2_estimate_bandWise_fx( + Word16 *x, /* Q0 */ + const Word16 start_line, /* Q0 */ + const Word16 end_line, /* Q0 */ + HANDLE_RC_CONTEXT_MEM hContextMem /* Q0 */ +); + + +/*! r: Q15 */ +Word16 expfp_evs_fx( + const Word16 x, /* i : mantissa Q15-e */ + const Word16 x_e /* i : exponent Q0 */ +); + + +void tcx_arith_render_envelope_ivas_fx( + const Word16 A_ind[], /* i : LPC coefficients of signal envelope Q12*/ + const Word16 L_frame, /* i : number of spectral lines Q0*/ + const Word16 L_spec, /* i : length of the coded spectrum Q0*/ + const Word16 preemph_fac, /* i : pre-emphasis factor Q15*/ + const Word16 gamma_w, /* i : A_ind -> weighted envelope factor Q15*/ + const Word16 gamma_uw, /* i : A_ind -> non-weighted envelope factor Q14*/ + Word32 env[] /* o : shaped signal envelope Q16*/ +); + +void tcx_arith_decode_envelope_ivas_fx( + Decoder_State *st, /* i/o: coder state */ + Word32 q_spectrum[], /* o : quantised MDCT coefficients */ + Word16 *q_spectrum_e, /* o : MDCT exponent */ + const Word16 L_frame, /* i : frame or MDCT length */ + Word16 L_spec, /* i : length w/o BW limitation */ + const Word16 A_ind[], /* i : quantised LPC coefficients */ + const Word16 target_bits, /* i : number of available bits */ + Word16 prm[], /* i : bitstream parameters */ + const Word16 use_hm, /* i : use HM in current frame? */ + const Word16 prm_hm[], /* i : HM parameter area */ + Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ + Word16 *arith_bits, /* o : bits used for ari. coding */ + Word16 *signaling_bits, /* o : bits used for signaling */ + const Word16 low_complexity /* i : low-complexity flag */ +); + + +void UnmapIndex_fx( + const Word16 PeriodicityIndex, /* Q0 */ + const Word16 Bandwidth, /* Q0 */ + const Word16 LtpPitchLag, /* Q0 */ + const Word8 SmallerLags, /* Q0 */ + Word16 *FractionalResolution, /* Q0 */ + Word32 *Lag /* Q0 */ +); + +#define GET_ADJ( T, L ) GET_ADJ2( T, L, *FractionalResolution ) +#define GET_ADJ2( T, L, F ) ( ( ( L ) << ( F ) ) - ( T ) ) + + +Word32 tcx_hm_render_fx( + const Word32 lag, /* i: pitch lag Q0 */ + const Word16 fract_res, /* i: fractional resolution of the lag Q0 */ + Word16 p[] /* o: harmonic model Q13 */ +); + + +void tcx_hm_modify_envelope_fx( + const Word16 gain, /* i: HM gain Q11 */ + const Word32 lag, /* i: pitch lag Q0 */ + const Word16 fract_res, /* i: fractional resolution of the lag Q0 */ + const Word16 p[], /* i: harmonic model Q13 */ + Word32 env[], /* i/o: envelope Q16 */ + const Word16 L_frame /* i: number of spectral lines Q0 */ +); + +void tcx_hm_decode( + const Word16 L_frame, /* i : number of spectral lines */ + Word32 env[], /* i/o: envelope shape (Q16) */ + const Word16 targetBits, /* i : target bit budget */ + const Word16 coder_type, /* i : GC/VC coder type */ + const Word16 prm_hm[], /* i : HM parameters */ + const Word16 LtpPitchLag, /* i : LTP pitch lag or -1 if none */ + Word16 *hm_bits /* o : bit consumption */ +); + +void writeTCXMode_fx( + Encoder_State *st, /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + Word16 *nbits_start /* o : nbits start Q0*/ +); + +void writeTCXWindowing_fx( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const Word16 overlap_mode /* i : overlap mode Q0*/ +); + +void writeLPCparam( + Encoder_State *st, /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const int16_t param_lpc[], /* i : LPC parameters to write */ + const int16_t bits_param_lpc[], /* i : bits per LPC parameter */ + const int16_t no_param_lpc, /* i : number of LPC parameters */ + int16_t *nbits_lpc /* o : LPC bits written */ +); + +void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); +void const *GetNumOfTnsFilters_flt( void const *p, const int16_t index, int16_t *pValue ); +void *SetNumOfTnsFilters_flt( void *p, const int16_t index, const int16_t value ); + +int16_t DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ); + +int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +void ResetTnsData_flt( + STnsData *pTnsData ); + +void ClearTnsFilterCoefficients_flt( + STnsFilter *pTnsFilter ); + +void EncodeTnsData( + STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */ + STnsData const *pTnsData, /* i : TNS data struct (quantized param) */ + Word16 *stream, /* o : internal data stream */ + Word16 *pnSize, /* o : number of written parameters */ + Word16 *pnBits /* o : number of written bits */ +); + +Word16 DecodeTnsData_ivas( + STnsConfig const *pTnsConfig, + const Word16 *stream, + Word16 *pnSize, + STnsData *pTnsData ); + +void WriteTnsData( + const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */ + const Word16 *stream, /* i : internal data stream */ + Word16 *pnSize, /* o : number of written parameters */ + BSTR_ENC_HANDLE hBstr, /* o : bitstream */ + Word16 *pnBits /* o : number of written bits */ +); + +void ReadTnsData_ivas( + STnsConfig const *pTnsConfig, + Decoder_State *st, + Word16 *pnBits, + Word16 *stream, + Word16 *pnSize ); + +void analysisCldfbEncoder_ivas_fx( + Encoder_State *st, /* i/o: encoder state structure */ + Word32 *timeIn, /*q11*/ + Word16 timeInq, /*q0*/ + Word16 samplesToProcess, /*q0*/ + Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + Word16 realBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + Word16 imagBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + Word32 *ppBuf_Ener, + Word16 *enerBuffSum_exp, + CLDFB_SCALE_FACTOR *scale ); + +ivas_error openCldfb_ivas( + HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ + CLDFB_TYPE type, /* i : analysis or synthesis */ + const int32_t sampling_rate, /* i : sampling rate */ + CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ +); + +ivas_error openCldfb_ivas_enc( + HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ + CLDFB_TYPE type, /* i : analysis or synthesis */ + const Word32 sampling_rate, /* i : sampling rate */ + CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ +); + +void resampleCldfb_ivas( + HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ + const Word32 newSamplerate /* i : new samplerate to operate */ +); + +ivas_error cldfb_save_memory_ivas( + HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ +); + +void deleteCldfb_ivas( + HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ +); + +/*! r: flag indicating a valid bitrate */ +Word16 is_EVS_bitrate( + const Word32 ivas_total_brate, /* i : EVS total bitrate */ + Word16 *Opt_AMR_WB /* i : AMR-WB IO flag */ +); + +void IGFEncResetTCX10BitCounter_ivas_fx( + const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */ +); + +ivas_error IGF_Reconfig( + IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ + const Word16 igf, /* i : IGF on/off */ + const Word16 reset, /* i : reset flag */ + const Word32 brate, /* i : bitrate for configuration */ + const Word16 bwidth, /* i : signal bandwidth */ + const Word16 element_mode, /* i : IVAS element mode */ + const Word16 rf_mode /* i : flag to signal the RF mode */ +); + +void ordr_esti( + const Word16 k, /* i : sub-vector index */ + Word16 *Mpos, /* i/o: dominant sub-vector position from ACV */ + Word16 svOrder[], /* i/o: AVQ sub-vector order */ + const Word16 Nsv /* i : total sub-vectors in a sub-frames */ +); + +/*===========================================================================================*/ +#endif diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index ed914f2a1..479bc04d9 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -4,7 +4,6 @@ #include #include "options.h" /* Compilation switches */ #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 665dbfae6..32d18d1fe 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" -#include "prot.h" /*--------------------------------------------------------------------* * residu_ivas_fx() diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index bad47f065..172dadf82 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -38,10 +38,9 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "basop_util.h" #include "wmc_auto.h" -#include "prot_fx.h" /* clang-format off */ diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c index 611658884..49f50e162 100644 --- a/lib_com/rom_com_fx.c +++ b/lib_com/rom_com_fx.c @@ -38,7 +38,7 @@ EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 ====================================================================================*/ -#include "prot.h" +#include "prot_fx.h" #include "basop_util.h" #include "wmc_auto.h" #include "rom_com_fx.h" diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 2aa781a43..1f112c911 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -38,7 +38,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 6cdf1185a..7e9471c45 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -7,7 +7,6 @@ #include "options.h" #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" #include "prot_fx.h" #include "basop_util.h" #include "ivas_prot_fx.h" diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index cececd8f5..44ce806f7 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -39,7 +39,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index 4e40e4ab2..c5ff95e04 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -9,7 +9,6 @@ #include "rom_com.h" #include "rom_basop_util.h" #include "basop_util.h" -#include "prot.h" #define inv_int InvIntTable diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 515746bd5..101bc1df8 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -12,7 +12,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "basop_util.h" -#include "prot.h" /*---------------------------------------------------------------------------- * Local constants diff --git a/lib_com/tools.c b/lib_com/tools.c index 4d9f5e956..e4ccd9955 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -37,7 +37,6 @@ #include #include "options.h" #include -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" @@ -136,23 +135,6 @@ int16_t sum_s( return tmp; } -/*! r: sum of all vector elements */ -int32_t sum_l( - const int32_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -) -{ - int16_t i; - int32_t tmpL; - - tmpL = 0; - for ( i = 0; i < lvec; i++ ) - { - tmpL += vec[i]; - } - - return tmpL; -} /*! r: sum of all vector elements */ Word32 sum_l_fx( const Word32 *vec, /* i : input vector */ @@ -171,23 +153,6 @@ Word32 sum_l_fx( return tmpL; } -/*! r: sum of all vector elements */ -float sum_f( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -) -{ - int16_t i; - float tmp; - - tmp = 0.0f; - for ( i = 0; i < lvec; i++ ) - { - tmp += vec[i]; - } - - return tmp; -} /*---------------------------------------------------------------------- * sum2_f() @@ -228,22 +193,6 @@ Word32 sum2_f_16_gb_fx( return tmp; } -float sum2_f( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -) -{ - int16_t i; - float tmp; - - tmp = 0.0f; - for ( i = 0; i < lvec; i++ ) - { - tmp += vec[i] * vec[i]; - } - - return tmp; -} Word32 sum2_16_exp_fx( const Word16 *vec, /* i : input vector Q(15 - exp) */ @@ -532,101 +481,6 @@ void mvs2s( return; } -uint32_t mvr2s( - const float x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -) -{ - int16_t i; - float temp; - uint32_t noClipping = 0; - - if ( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return 0; - } - - if ( (void *) y <= (const void *) x ) - { - for ( i = 0; i < n; i++ ) - { - temp = x[i]; - temp = (float) floor( temp + 0.5f ); - - if ( temp > MAX16B_FLT ) - { - temp = MAX16B_FLT; - noClipping++; - } - else if ( temp < MIN16B_FLT ) - { - temp = MIN16B_FLT; - noClipping++; - } - - y[i] = (int16_t) temp; - } - } - else - { - for ( i = n - 1; i >= 0; i-- ) - { - temp = x[i]; - temp = (float) floor( temp + 0.5f ); - - if ( temp > MAX16B_FLT ) - { - temp = MAX16B_FLT; - noClipping++; - } - else if ( temp < MIN16B_FLT ) - { - temp = MIN16B_FLT; - noClipping++; - } - - y[i] = (int16_t) temp; - } - } - - return noClipping; -} - -void mvs2r( - const int16_t x[], /* i : input vector */ - float y[], /* o : output vector */ - const int16_t n /* i : vector size */ -) -{ - int16_t i; - - if ( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return; - } - - if ( (void *) y < (const void *) x ) - { - for ( i = 0; i < n; i++ ) - { - y[i] = (float) x[i]; - } - } - else - { - for ( i = n - 1; i >= 0; i-- ) - { - y[i] = (float) x[i]; - } - } - - return; -} - - void mvl2l( const int32_t x[], /* i : input vector */ int32_t y[], /* o : output vector */ @@ -659,44 +513,6 @@ void mvl2l( return; } - -/*---------------------------------------------------------------------* - * maximum() - * - * Find index and value of the maximum in a vector - *---------------------------------------------------------------------*/ - -/*! r: index of the maximum value in the input vector */ -int16_t maximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ -) -{ - int16_t j, ind; - float tmp; - - ind = 0; - tmp = vec[0]; - - for ( j = 1; j < lvec; j++ ) - { - if ( vec[j] > tmp ) - { - ind = j; - tmp = vec[j]; - } - } - - if ( max_val != NULL ) - { - *max_val = tmp; - } - - return ind; -} - - /*! r: index of the maximum value in the input vector */ Word16 maximum_s( const Word16 *vec, /* i : input vector */ @@ -766,42 +582,6 @@ Word16 maximum_l( return ind; } -/*---------------------------------------------------------------------* - * maximumAbs() - * - * Find index and value of the maximum in a vector - *---------------------------------------------------------------------*/ - -/*! r: index of the maximum value in the input vector */ -int16_t maximumAbs( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ -) -{ - int16_t j, ind; - float tmp; - - ind = 0; - tmp = (float) fabs( vec[0] ); - - for ( j = 1; j < lvec; j++ ) - { - if ( (float) fabs( vec[j] ) > tmp ) - { - ind = j; - tmp = (float) fabs( vec[j] ); - } - } - - if ( max_val != NULL ) - { - *max_val = tmp; - } - - return ind; -} - /*! r: index of the maximum value in the input vector */ Word16 maximumAbs_l( const Word32 *vec, /* i : input vector */ @@ -835,42 +615,6 @@ Word16 maximumAbs_l( return ind; } -/*---------------------------------------------------------------------* - * minimum() - * - * Find index of a minimum in a vector - *---------------------------------------------------------------------*/ - -/*! r: index of the minimum value in the input vector */ -int16_t minimum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *min_val /* o : minimum value in the input vector */ -) -{ - int16_t j, ind; - float tmp; - - ind = 0; - tmp = vec[0]; - - for ( j = 1; j < lvec; j++ ) - { - if ( vec[j] < tmp ) - { - ind = j; - tmp = vec[j]; - } - } - - if ( min_val != NULL ) - { - *min_val = tmp; - } - - return ind; -} - /*-------------------------------------------------------------------* * minimum_s() * @@ -988,59 +732,6 @@ Word16 minimum_l( return ind; } -/*---------------------------------------------------------------------* - * emaximum() - * - * Find index of a maximum energy in a vector - *---------------------------------------------------------------------*/ - -/*! r: return index with max energy value in vector */ -int16_t emaximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *ener_max /* o : maximum energy value */ -) -{ - int16_t j, ind; - float temp; - - *ener_max = 0.0f; - ind = 0; - - for ( j = 0; j < lvec; j++ ) - { - temp = vec[j] * vec[j]; - - if ( temp > *ener_max ) - { - ind = j; - *ener_max = temp; - } - } - - return ind; -} - - -/*---------------------------------------------------------------------* - * mean() - * - * Find the mean of the vector - *---------------------------------------------------------------------*/ - -/*! r: mean of vector */ -float mean( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -) -{ - float tmp; - - tmp = sum_f( vec, lvec ) / (float) lvec; - - return tmp; -} - /*---------------------------------------------------------------------* * dotp() * @@ -1168,114 +859,6 @@ float inv_sqrt( return (float) ( 1.0 / sqrt( x ) ); } - -/*-------------------------------------------------------------------* - * conv() - * - * Convolution between vectors x[] and h[] written to y[] - * All vectors are of length L. Only the first L samples of the - * convolution are considered. - *-------------------------------------------------------------------*/ - -void conv( - const float x[], /* i : input vector */ - const float h[], /* i : impulse response (or second input vector) */ - float y[], /* o : output vetor (result of convolution) */ - const int16_t L /* i : vector size */ -) -{ - float temp; - int16_t i, n; - for ( n = 0; n < L; n++ ) - { - temp = x[0] * h[n]; - for ( i = 1; i <= n; i++ ) - { - temp += x[i] * h[n - i]; - } - y[n] = temp; - } - - return; -} - -/*-------------------------------------------------------------------* - * fir() - * - * FIR filtering of vector x[] with filter having impulse response h[] - * written to y[] - * The input vector has length L and the FIR filter has an order of K, i.e. - * K+1 coefficients. The memory of the input signal is provided in the vector mem[] - * which has K values - * The maximum length of the input signal is L_FRAME32k and the maximum order - * of the FIR filter is L_FILT_MAX - *-------------------------------------------------------------------*/ - -void fir( - const float x[], /* i : input vector */ - const float h[], /* i : impulse response of the FIR filter */ - float y[], /* o : output vector (result of filtering) */ - float mem[], /* i/o: memory of the input signal (L samples) */ - const int16_t L, /* i : input vector size */ - const int16_t K, /* i : order of the FIR filter (K+1 coefs.) */ - const int16_t upd /* i : 1 = update the memory, 0 = not */ -) -{ - float buf_in[L_FRAME48k + 60], buf_out[L_FRAME48k], s; - int16_t i, j; - - /* prepare the input buffer (copy and update memory) */ - mvr2r( mem, buf_in, K ); - mvr2r( x, buf_in + K, L ); - - if ( upd ) - { - mvr2r( buf_in + L, mem, K ); - } - - /* do the filtering */ - for ( i = 0; i < L; i++ ) - { - s = buf_in[K + i] * h[0]; - - for ( j = 1; j <= K; j++ ) - { - s += h[j] * buf_in[K + i - j]; - } - - buf_out[i] = s; - } - - /* copy to the output buffer */ - mvr2r( buf_out, y, L ); - - return; -} - -/*-------------------------------------------------------------------* - * v_add() - * - * Addition of two vectors sample by sample - *-------------------------------------------------------------------*/ - -void v_add( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 + vector 2 */ - const int16_t N /* i : Vector length */ -) -{ - int16_t i; - - for ( i = 0; i < N; i++ ) - { - y[i] = x1[i] + x2[i]; - } - - return; -} - - /*-------------------------------------------------------------------* * v_add_w64() * @@ -1351,55 +934,9 @@ void v_sub_fixed( } /*-------------------------------------------------------------------* - * v_mult() + * v_multc_fixed() * - * Multiplication of two vectors - *-------------------------------------------------------------------*/ - -void v_mult( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 .* vector 2 */ - const int16_t N /* i : Vector length */ -) -{ - int16_t i; - - for ( i = 0; i < N; i++ ) - { - y[i] = x1[i] * x2[i]; - } - - return; -} - -/*-------------------------------------------------------------------* - * v_multc() - * - * Multiplication of vector by constant - *-------------------------------------------------------------------*/ - -void v_multc( - const float x[], /* i : Input vector */ - const float c, /* i : Constant */ - float y[], /* o : Output vector that contains c*x */ - const int16_t N /* i : Vector length */ -) -{ - int16_t i; - - for ( i = 0; i < N; i++ ) - { - y[i] = c * x[i]; - } - - return; -} - -/*-------------------------------------------------------------------* - * v_multc_fixed() - * - * Multiplication of vector by constant + * Multiplication of vector by constant *-------------------------------------------------------------------*/ void v_multc_fixed( @@ -1456,102 +993,6 @@ void v_multc_fixed_16_16( return; } -/*-------------------------------------------------------------------* - * squant() - * - * Scalar quantizer according to MMSE criterion (nearest neighbour in Euclidean space) - * - * Searches a given codebook to find the nearest neighbour in Euclidean space. - * Index of the winning codeword and the winning codeword itself are returned. - *-------------------------------------------------------------------*/ - -/*! r: index of the winning codeword */ -int16_t squant( - const float x, /* i : scalar value to quantize */ - float *xq, /* o : quantized value */ - const float cb[], /* i : codebook */ - const int16_t cbsize /* i : codebook size */ -) -{ - float dist, mindist, tmp; - int16_t c, idx; - - idx = 0; - mindist = 1e16f; - - for ( c = 0; c < cbsize; c++ ) - { - dist = 0.0f; - tmp = x - cb[c]; - dist += tmp * tmp; - if ( dist < mindist ) - { - mindist = dist; - idx = c; - } - } - - *xq = cb[idx]; - - return idx; -} - -/*! r: index of the winning codeword */ -int16_t squant_int( - uint8_t x, /* i : scalar value to quantize */ - uint8_t *xq, /* o : quantized value */ - const uint8_t *cb, /* i : codebook */ - const int16_t cbsize /* i : codebook size */ -) -{ - int16_t i, idx; - float mindist, d; - - idx = 0; - mindist = 10000000.0f; - for ( i = 0; i < cbsize; i++ ) - { - d = (float) ( x - cb[i] ) * ( x - cb[i] ); - if ( d < mindist ) - { - mindist = d; - idx = i; - } - } - *xq = cb[idx]; - - return idx; -} - - -/*-------------------------------------------------------------------* - * usquant() - * - * Uniform scalar quantizer according to MMSE criterion - * (nearest neighbour in Euclidean space) - * - * Applies quantization based on scale and round operations. - * Index of the winning codeword and the winning codeword itself are returned. - *-------------------------------------------------------------------*/ - -/*! r: index of the winning codeword */ -int16_t usquant( - const float x, /* i : scalar value to quantize */ - float *xq, /* o : quantized value */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta, /* i : quantization step */ - const int16_t cbsize /* i : codebook size */ -) -{ - int16_t idx; - - idx = (int16_t) max( 0.f, min( cbsize - 1, ( ( x - qlow ) / delta + 0.5f ) ) ); - *xq = idx * delta + qlow; - - return idx; -} - - /*-------------------------------------------------------------------* * usdequant() * @@ -1573,219 +1014,6 @@ float usdequant( return ( g ); } - -/*-------------------------------------------------------------------* - * vquant() - * - * Vector quantizer according to MMSE criterion (nearest neighbour in Euclidean space) - * - * Searches a given codebook to find the nearest neighbour in Euclidean space. - * Index of the winning codevector and the winning vector itself are returned. - *-------------------------------------------------------------------*/ - -/*! r: index of the winning codevector */ -int16_t vquant( - float x[], /* i : vector to quantize */ - const float x_mean[], /* i : vector mean to subtract (0 if none) */ - float xq[], /* o : quantized vector */ - const float cb[], /* i : codebook */ - const int16_t dim, /* i : dimension of codebook vectors */ - const int16_t cbsize /* i : codebook size */ -) -{ - float dist, mindist, tmp; - int16_t c, d, idx, j; - - idx = 0; - mindist = 1e16f; - - if ( x_mean != 0 ) - { - for ( d = 0; d < dim; d++ ) - { - x[d] -= x_mean[d]; - } - } - - j = 0; - for ( c = 0; c < cbsize; c++ ) - { - dist = 0.0f; - for ( d = 0; d < dim; d++ ) - { - tmp = x[d] - cb[j++]; - dist += tmp * tmp; - } - - if ( dist < mindist ) - { - mindist = dist; - idx = c; - } - } - - if ( xq == 0 ) - { - return idx; - } - - j = idx * dim; - for ( d = 0; d < dim; d++ ) - { - xq[d] = cb[j++]; - } - - if ( x_mean != 0 ) - { - for ( d = 0; d < dim; d++ ) - { - xq[d] += x_mean[d]; - } - } - - return idx; -} - -/*-------------------------------------------------------------------* - * w_vquant() - * - * Vector quantizer according to MMSE criterion (nearest neighbour in Euclidean space) - * - * Searches a given codebook to find the nearest neighbour in Euclidean space. - * Weights are put on the error for each vector element. - * Index of the winning codevector and the winning vector itself are returned. - *-------------------------------------------------------------------*/ - -/*! r: index of the winning codevector */ -int16_t w_vquant( - float x[], /* i : vector to quantize */ - const float x_mean[], /* i : vector mean to subtract (0 if none) */ - const int16_t weights[], /* i : error weights */ - float xq[], /* o : quantized vector */ - const float cb[], /* i : codebook */ - const int16_t dim, /* i : dimension of codebook vectors */ - const int16_t cbsize, /* i : codebook size */ - const int16_t rev_vect /* i : reverse codebook vectors */ -) -{ - float dist, mindist, tmp; - int16_t c, d, idx, j, k; - - idx = 0; - mindist = 1e16f; - - if ( x_mean != 0 ) - { - for ( d = 0; d < dim; d++ ) - { - x[d] -= x_mean[d]; - } - } - - j = 0; - if ( rev_vect ) - { - k = dim - 1; - for ( c = 0; c < cbsize; c++ ) - { - dist = 0.0f; - - for ( d = k; d >= 0; d-- ) - { - tmp = x[d] - cb[j++]; - dist += weights[d] * ( tmp * tmp ); - } - - if ( dist < mindist ) - { - mindist = dist; - idx = c; - } - } - - if ( xq == 0 ) - { - return idx; - } - - j = idx * dim; - for ( d = k; d >= 0; d-- ) - { - xq[d] = cb[j++]; - } - } - else - { - for ( c = 0; c < cbsize; c++ ) - { - dist = 0.0f; - - for ( d = 0; d < dim; d++ ) - { - tmp = x[d] - cb[j++]; - dist += weights[d] * ( tmp * tmp ); - } - - if ( dist < mindist ) - { - mindist = dist; - idx = c; - } - } - - if ( xq == 0 ) - { - return idx; - } - - j = idx * dim; - for ( d = 0; d < dim; d++ ) - { - xq[d] = cb[j++]; - } - } - - if ( x_mean != 0 ) - { - for ( d = 0; d < dim; d++ ) - { - xq[d] += x_mean[d]; - } - } - - return idx; -} - - -/*----------------------------------------------------------------------------------* - * v_sort() - * - * Sorting of vectors. This is very fast with almost ordered vectors. - *----------------------------------------------------------------------------------*/ - -void v_sort_float( - float *r, /* i/o: Vector to be sorted in place */ - const int16_t lo, /* i : Low limit of sorting range */ - const int16_t up /* I : High limit of sorting range */ -) -{ - int16_t i, j; - float tempr; - - for ( i = up - 1; i >= lo; i-- ) - { - tempr = r[i]; - for ( j = i + 1; j <= up && ( tempr > r[j] ); j++ ) - { - r[j - 1] = r[j]; - } - - r[j - 1] = tempr; - } - - return; -} - void sort( UWord16 *x, /* i/o: Vector to be sorted */ UWord16 len /* i/o: vector length */ @@ -1810,426 +1038,3 @@ void sort( return; } - -/*---------------------------------------------------------------------* - * var() - * - * Calculate the variance of a vector - *---------------------------------------------------------------------*/ - -/*! r: variance of vector */ -float var( - const float *x, /* i : input vector */ - const int16_t len /* i : length of inputvector */ -) -{ - float m; - float v; - int16_t i; - - m = mean( x, len ); - - v = 0.0f; - for ( i = 0; i < len; i++ ) - { - v += ( x[i] - m ) * ( x[i] - m ); - } - v /= len; - - return v; -} - - -/*---------------------------------------------------------------------* - * std_dev() - * - * Calculate the standard deviation of a vector - *---------------------------------------------------------------------*/ - -/*! r: standard deviation */ -float std_dev( - const float *x, /* i : input vector */ - const int16_t len /* i : length of the input vector */ -) -{ - int16_t i; - float std; - - std = 1e-16f; - for ( i = 0; i < len; i++ ) - { - std += x[i] * x[i]; - } - - std = (float) sqrt( std / len ); - - return std; -} - - -/*---------------------------------------------------------------------* - * dot_product_mat() - * - * Calculates dot product of type x'*A*x, where x is column vector of size m, - * and A is square matrix of size m*m - *---------------------------------------------------------------------*/ - -/*! r: the dot product x'*A*x */ -float dot_product_mat( - const float *x, /* i : vector x */ - const float *A, /* i : matrix A */ - const int16_t m /* i : vector & matrix size */ -) -{ - int16_t i, j; - float suma, tmp_sum; - const float *pt_x, *pt_A; - - pt_A = A; - suma = 0; - - for ( i = 0; i < m; i++ ) - { - tmp_sum = 0; - pt_x = x; - for ( j = 0; j < m; j++ ) - { - tmp_sum += *pt_x++ * *pt_A++; - } - - suma += x[i] * tmp_sum; - } - - return suma; -} - - -/*--------------------------------------------------------------------------------* - * polezero_filter() - * - * Y(Z)=X(Z)(b[0]+b[1]z^(-1)+..+b[L]z^(-L))/(a[0]+a[1]z^(-1)+..+a[M]z^(-M)) - * mem[n]=x[n]+cp[0]mem[n-1]+..+cp[M-1]mem[n-M], where cp[i]=-a[i+1]/a[0] - * y[n]=cz[0]mem[n]+cz[1]mem[n-1]+..+cz[L]mem[n-L], where cz[i]=b[i]/a[0] - * mem={mem[n-K] mem[n-K+1] . . . . mem[n-2] mem[n-1]}, where K=max(L,M) - * - * a[0] must be equal to 1.0f! - *---------------------------------------------------------------------------------*/ - -void polezero_filter( - const float *in, /* i : input vector */ - float *out, /* o : output vector */ - const int16_t N, /* i : input vector size */ - const float *b, /* i : numerator coefficients */ - const float *a, /* i : denominator coefficients */ - const int16_t order, /* i : filter order */ - float *mem /* i/o: filter memory */ -) -{ - int16_t i, j, k; - - - for ( i = 0; i < order; i++ ) - { - out[i] = in[i] * b[0]; - for ( j = 0; j < i; j++ ) - { - out[i] += in[i - 1 - j] * b[j + 1] - out[i - 1 - j] * a[j + 1]; - } - - for ( k = order - 1; j < order; j++, k-- ) - { - out[i] += mem[k] * b[j + 1] - mem[k + order] * a[j + 1]; - } - } - - for ( ; i < N; i++ ) - { - out[i] = in[i] * b[0]; - for ( j = 0; j < order; j++ ) - { - out[i] += in[i - 1 - j] * b[j + 1] - out[i - 1 - j] * a[j + 1]; - } - } - - for ( i = 0; i < order; i++ ) - { - mem[i] = in[N - order + i]; - mem[i + order] = out[N - order + i]; - } - - return; -} - -#define WMC_TOOL_SKIP -static float fleft_shift( float input, const int16_t shift ) -{ - return ( input * (float) pow( 2.0, (double) shift ) ); -} - -static float fright_shift( float input, const int16_t shift ) -{ - return ( input * (float) pow( 0.5, (double) shift ) ); -} -#undef WMC_TOOL_SKIP - - -/*--------------------------------------------------------------------------------* - * root_a() - * - * Implements a quadratic approximation to sqrt(a) - * Firstly, a is normalized to lie between 0.25 & 1.0 - * by shifting the input left or right by an even number of - * shifts. Even shifts represent powers of 4 which, after - * the sqrt, can easily be converted to powers of 2 and are - * easily dealt with. - * At the heart of the algorithm is a quadratic - * approximation of the curve sqrt(a) for 0.25 <= a <= 1.0. - * Sqrt(a) approx = 0.27 + 1.0127 * a - 0.2864 * a^2 - * - *---------------------------------------------------------------------------------*/ - -float root_a( - float a ) -{ - int16_t shift_a; - float mod_a; - float approx; - - if ( a <= 0.0f ) - { - return 0.0; - } - -#define WMC_TOOL_SKIP - /* This next piece of code implements a "norm" function */ - /* and returns the shift needed to scale "a" to have a */ - /* 1 in the (MSB-1) position. This is equivalent to */ - /* giving a value between 0.5 & 1.0. */ - mod_a = a; - - shift_a = 0; - while ( mod_a > 1.0 ) - { - mod_a /= 2.0; - shift_a--; - } - - while ( mod_a < 0.5 ) - { - mod_a *= 2.0; - shift_a++; - } -#undef WMC_TOOL_SKIP - - shift_a &= 0xfffe; - mod_a = fleft_shift( a, shift_a ); - - approx = 0.27f + 1.0127f * mod_a - 0.2864f * mod_a * mod_a; - - approx = fright_shift( approx, ( shift_a >> 1 ) ); - - return ( approx ); -} - -/*--------------------------------------------------------------------------------* - * root_a_over_b() - * - * Implements an approximation to sqrt(a/b) - * Firstly a & b are normalized to lie between 0.25 & 1.0 - * by shifting the inputs left or right by an even number - * of shifts. - * Even shifts represent powers of 4 which, after the sqrt, - * become powers of 2 and are easily dealt with. - * At the heart of the algorithm is an approximation of the - * curve sqrt(a/b) for 0.25 <= a <= 1.0 & 0.25 <= b <= 1.0. - * Given the value of b, the 2nd order coefficients p0, p1 - * & p2 can be determined so that... - * Sqrt(a/b) approx = p0 + p1 * a + p2 * a^2 - * where p0 approx = 0.7176 - 0.8815 * b + 0.4429 * b^2 - * p1 approx = 2.6908 - 3.3056 * b + 1.6608 * b^2 - * p2 approx = -0.7609 + 0.9346 * b - 0.4695 * b^2 - * - *---------------------------------------------------------------------------------*/ - -float root_a_over_b( - float a, - float b ) -{ - int16_t shift_a, shift_b, shift; - float mod_a, mod_b; - float p2 = -0.7609f; - float p1 = 2.6908f; - float p0 = 0.7176f; - float b_sqr; - float approx; - - if ( ( a <= 0.0f ) || ( b <= 0.0f ) ) - { - return 0.0; - } -#define WMC_TOOL_SKIP - if ( isinf( a ) ) -#undef WMC_TOOL_SKIP - { - return FLT_MAX; - } -#define WMC_TOOL_SKIP - if ( isinf( b ) ) -#undef WMC_TOOL_SKIP - { - return 0.f; - } - - a += 0x00000001; - b += 0x00000001; - -#define WMC_TOOL_SKIP - /* This next piece of code implements a "norm" function */ - /* and returns the shift needed to scale "a" to have a */ - /* 1 in the (MSB-1) position. This is equivalent to */ - /* giving a value between 0.5 & 1.0. */ - mod_a = a; - - shift_a = 0; - while ( mod_a > 1.0 ) - { - mod_a /= 2.0; - shift_a--; - } - - while ( mod_a < 0.5 ) - { - mod_a *= 2.0; - shift_a++; - } -#undef WMC_TOOL_SKIP - - shift_a &= 0xfffe; - mod_a = fleft_shift( a, shift_a ); - -#define WMC_TOOL_SKIP - /* This next piece of code implements a "norm" function */ - /* and returns the shift needed to scale "b" to have a */ - /* 1 in the (MSB-1) position. This is equivalent to */ - /* giving a value between 0.5 & 1.0. */ - mod_b = b; - - shift_b = 0; - while ( mod_b > 1.0 ) - { - mod_b /= 2.0; - shift_b--; - } - - while ( mod_b < 0.5 ) - { - mod_b *= 2.0; - shift_b++; - } -#undef WMC_TOOL_SKIP - - shift_b &= 0xfffe; - mod_b = fleft_shift( b, shift_b ); - - shift = ( shift_b - shift_a ) >> 1; - - b_sqr = mod_b * mod_b; - - p2 += 0.9346f * mod_b + -0.4695f * b_sqr; - p1 += -3.3056f * mod_b + 1.6608f * b_sqr; - p0 += -0.8815f * mod_b + 0.4429f * b_sqr; - - approx = p0 + p1 * mod_a + p2 * mod_a * mod_a; - - approx = fleft_shift( approx, shift ); - - return ( approx ); -} - -/*--------------------------------------------------------------------------------* - * rint_new() - * - * Round to the nearest integer with mid-point exception - *---------------------------------------------------------------------------------*/ - -double rint_new( - double x ) -{ - int16_t a; - - /* middle value point test */ - if ( ceil( x + 0.5 ) == floor( x + 0.5 ) ) - { - a = (int16_t) ceil( x ); - - if ( a % 2 == 0 ) - { - return ceil( x ); - } - else - { - return floor( x ); - } - } - else - { - return floor( x + 0.5 ); - } -} - - -/*-------------------------------------------------------------------* - * anint() - * - * Round to the nearest integer. - *-------------------------------------------------------------------*/ - -double anint( - double x ) -{ - return ( x ) >= 0 ? (int32_t) ( ( x ) + 0.5 ) : (int32_t) ( (x) -0.5 ); -} - -/*-------------------------------------------------------------------* - * is_numeric_float() - * - * Returns 0 for all NaN and Inf values defined according to IEEE 754 - * floating point number's definition. Returns 1 for numeric values. - *-------------------------------------------------------------------*/ - -int16_t is_numeric_float( - float x ) -{ - union float_int - { - float float_val; - int32_t int_val; - } float_int; - - float_int.float_val = x; - - return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 ); -} - -/*-------------------------------------------------------------------* - * delay_signal_float() - * - * Delay buffer by defined number of samples - *-------------------------------------------------------------------*/ - -void delay_signal_float( - float x[], /* i/o: signal to be delayed */ - const int16_t len, /* i : length of the input signal */ - float mem[], /* i/o: synchronization memory */ - const int16_t delay /* i : delay in samples */ -) -{ - float tmp_buffer[L_FRAME48k]; - - mvr2r( mem, tmp_buffer, delay ); - mvr2r( x + len - delay, mem, delay ); - mvr2r( x, x + delay, len - delay ); - mvr2r( tmp_buffer, x, delay ); - - return; -} diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index efa9d7e5a..1aa0bb84a 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -50,7 +50,6 @@ #include "basop32.h" #include "wmc_auto.h" #include "prot_fx_enc.h" -#include "prot.h" #include "ivas_prot_fx.h" #define INV_BANDS10 3277 /* 1/10 in Q15 */ diff --git a/lib_com/wtda.c b/lib_com/wtda.c index a7ea5314c..3fb408138 100644 --- a/lib_com/wtda.c +++ b/lib_com/wtda.c @@ -37,11 +37,10 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include #include "wmc_auto.h" -#include "prot_fx.h" void wtda_fx32( diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 9597a97ae..11379a62d 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -39,7 +39,6 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_prot.h" diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index f1772b9a7..fc8aba043 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index da7722325..ef4fb62d5 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -40,10 +40,9 @@ #include "cnst.h" #include "stl.h" #include "basop_util.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" Word16 DecodeIndex_fx( diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index e5a1220e0..60a59c4da 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -10,7 +10,6 @@ #include "prot_fx.h" #include "basop_util.h" #include "basop_proto_func.h" -#include "prot.h" /* Returns: number of bits consumed */ static Word16 tcx_arith_decode_fx( diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index 3bf7e3eb6..a8ba2bfc3 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -7,7 +7,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ /*-------------------------------------------------------------------* diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index e3401739e..ab349773e 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -6,7 +6,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_cnst.h" diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 8fefa3bb2..dd268fe08 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -7,7 +7,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "basop_util.h" #include "rom_com.h" diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index c7d2c5265..2fd3f1d2e 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -8,7 +8,6 @@ #include "basop_util.h" #include "prot_fx.h" #include "rom_com.h" -#include "prot.h" void mode_switch_decoder_LPD_fx( Decoder_State *st, /* i/o: decoder state structure */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index e71157a1e..20f7a0adf 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -9,7 +9,6 @@ #include "basop_util.h" #include "stl.h" #include "options.h" -#include "prot.h" #include "math.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c index 385339664..6c63377fd 100644 --- a/lib_dec/gs_dec_fx.c +++ b/lib_dec/gs_dec_fx.c @@ -6,7 +6,6 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_cnst.h" /*=========================================================================*/ diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index c61bf95ce..ee7a7eca6 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -7,7 +7,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "basop32.h" -#include "prot.h" /*---------------------------------------------------------------------* * Local constants diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 626f25ef4..86cf9784a 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -6,7 +6,6 @@ #include "cnst.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------------- * hq_core_dec() diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 4f74c31ca..907a4a350 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -8,10 +8,9 @@ #include #include "options.h" #include "stl.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "cnst.h" #include "stat_dec.h" #include "basop_util.h" diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 4f1db90ff..3865cd61c 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -8,7 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "stl.h" /* required for wmc_tool */ #include "basop_util.h" -#include "prot.h" #include "ivas_prot_fx.h" /*----------------------------------------------------------------------* diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c index f5418abc6..e73d89158 100644 --- a/lib_dec/ivas_agc_dec_fx.c +++ b/lib_dec/ivas_agc_dec_fx.c @@ -34,7 +34,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index a6e03eee3..3fe40c1f3 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -33,7 +33,7 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "cnst.h" @@ -43,7 +43,6 @@ #include "ivas_rom_com.h" #include "ivas_rom_binauralRenderer.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" #include "debug.h" diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 261a3c74e..5bb4736e9 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -36,12 +36,11 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 89ca9a5ba..697f9d715 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -35,7 +35,6 @@ #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" -#include "prot.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index c22c617c0..9bf53f1de 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -36,10 +36,9 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include diff --git a/lib_dec/ivas_decision_matrix_dec_fx.c b/lib_dec/ivas_decision_matrix_dec_fx.c index a8c151edb..f7fd5e8e2 100644 --- a/lib_dec/ivas_decision_matrix_dec_fx.c +++ b/lib_dec/ivas_decision_matrix_dec_fx.c @@ -35,11 +35,10 @@ #include "stat_dec.h" #include "rom_com.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-----------------------------------------------------------------* * ivas_decision_matrix_dec() diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 2cefb0e93..63ee40e2a 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" @@ -43,7 +43,6 @@ #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" /* Function prototypes */ #include "ivas_rom_com_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index afbde5a60..e03913f8a 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -40,7 +40,7 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" @@ -48,7 +48,6 @@ #include "ivas_rom_dec.h" #include "wmc_auto.h" #include "rom_dec.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_entropy_decoder_fx.c b/lib_dec/ivas_entropy_decoder_fx.c index 0c489fb04..e637a6a93 100644 --- a/lib_dec/ivas_entropy_decoder_fx.c +++ b/lib_dec/ivas_entropy_decoder_fx.c @@ -32,13 +32,12 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 037ef4eb9..8db782c4e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -40,9 +40,8 @@ #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 14e83fe83..664e3eeac 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -32,13 +32,12 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_dtx_dec_fx.c b/lib_dec/ivas_ism_dtx_dec_fx.c index 0365005be..cbf088597 100644 --- a/lib_dec/ivas_ism_dtx_dec_fx.c +++ b/lib_dec/ivas_ism_dtx_dec_fx.c @@ -35,10 +35,9 @@ #include "options.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* * ivas_ism_dtx_dec_fx() diff --git a/lib_dec/ivas_ism_metadata_dec_fx.c b/lib_dec/ivas_ism_metadata_dec_fx.c index 833ed5e16..a6f5e47b6 100644 --- a/lib_dec/ivas_ism_metadata_dec_fx.c +++ b/lib_dec/ivas_ism_metadata_dec_fx.c @@ -37,7 +37,6 @@ #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_stat_enc.h" #include diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index 424e6fb86..9040a8a71 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -36,13 +36,12 @@ #include "options.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "debug.h" #include "ivas_rom_com_fx.h" diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 738e5a598..a19ba70ec 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 3b66d3107..f632d86c8 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -35,7 +35,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" @@ -46,7 +46,6 @@ #ifdef DEBUGGING #include "debug.h" #endif -#include "prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 616b15c6e..e68c0142d 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index f5e7816ad..a8b54d3fb 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_ls_custom_dec_fx.c b/lib_dec/ivas_ls_custom_dec_fx.c index eabee357b..45f59d82f 100644 --- a/lib_dec/ivas_ls_custom_dec_fx.c +++ b/lib_dec/ivas_ls_custom_dec_fx.c @@ -32,10 +32,9 @@ #include #include "options.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 4ca5c05b0..806785c15 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -40,7 +40,6 @@ #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 4c1d5d190..897fd4433 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -36,7 +36,7 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" @@ -45,7 +45,6 @@ #include "math.h" #include "wmc_auto.h" #include "rom_dec.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #define INV_EPSILON_MANT 214748365 diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index be53d79c8..e03b385b7 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_prot.h" diff --git a/lib_dec/ivas_mcmasa_dec_fx.c b/lib_dec/ivas_mcmasa_dec_fx.c index 687efb3ce..c2228b610 100644 --- a/lib_dec/ivas_mcmasa_dec_fx.c +++ b/lib_dec/ivas_mcmasa_dec_fx.c @@ -35,7 +35,7 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mct_core_dec_fx.c b/lib_dec/ivas_mct_core_dec_fx.c index 824370bb8..be457da47 100644 --- a/lib_dec/ivas_mct_core_dec_fx.c +++ b/lib_dec/ivas_mct_core_dec_fx.c @@ -33,7 +33,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" #include "cnst.h" @@ -42,7 +42,6 @@ #include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index c95a5285a..081eca88d 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -38,7 +38,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "prot.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 331bdc253..69f601724 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -34,11 +34,10 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include #include "stat_enc.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*----------------------------------------------------------* diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 190cc6b14..7f079277a 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -33,7 +33,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" @@ -44,7 +44,6 @@ #include "ivas_stat_dec.h" #include "ivas_stat_com.h" #include -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index 231aee8aa..bb5dead22 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 3a6480386..391a27522 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -32,14 +32,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "debug.h" diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 0fb4163be..bf7fba094 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -35,12 +35,11 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index a5285b5cb..07ea14ea2 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -34,12 +34,11 @@ #include #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 02f37672d..4811911fd 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -34,13 +34,12 @@ #include "options.h" #include #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "debug.h" diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index 4a0c62e8d..08ac17799 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -32,12 +32,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include #include "ivas_cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "math.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_post_proc_fx.c b/lib_dec/ivas_post_proc_fx.c index 853aa365f..397f26bbc 100644 --- a/lib_dec/ivas_post_proc_fx.c +++ b/lib_dec/ivas_post_proc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index c225f126a..4bebcda5c 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -39,9 +39,8 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "wmc_auto.h" -#include "prot.h" - #include "prot_fx.h" + #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_dec/ivas_qspherical_dec_fx.c b/lib_dec/ivas_qspherical_dec_fx.c index 43ac60305..d34b5402a 100644 --- a/lib_dec/ivas_qspherical_dec_fx.c +++ b/lib_dec/ivas_qspherical_dec_fx.c @@ -37,7 +37,7 @@ #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_rom_com_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_range_uni_dec_fx.c b/lib_dec/ivas_range_uni_dec_fx.c index 6d6631f73..e629111ce 100644 --- a/lib_dec/ivas_range_uni_dec_fx.c +++ b/lib_dec/ivas_range_uni_dec_fx.c @@ -38,10 +38,9 @@ #include "rom_com.h" #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /* diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 417079541..efd766f76 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" @@ -44,7 +44,6 @@ #include #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* * ivas_sba_set_cna_cng_flag() * diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index 434fdf5fa..a42c67389 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -32,7 +32,7 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" @@ -40,7 +40,6 @@ #include #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #ifdef DEBUGGING #include "debug.h" #endif diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index ce4992046..89581565c 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 37489e58f..170256181 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -32,14 +32,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index cddbf8cdf..812027468 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -35,7 +35,7 @@ #include #include "options.h" #include "ivas_stat_dec.h" -#include "prot.h" +#include "prot_fx.h" #include "string.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" @@ -45,7 +45,6 @@ #include "ivas_stat_com.h" #include "stat_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index 3ad16b981..2b6b145f9 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -33,13 +33,12 @@ #include #include "options.h" #include "math.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" #include "ivas_stat_dec.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_dec/ivas_stereo_adapt_GR_dec_fx.c b/lib_dec/ivas_stereo_adapt_GR_dec_fx.c index c67a52b6c..8446af47d 100644 --- a/lib_dec/ivas_stereo_adapt_GR_dec_fx.c +++ b/lib_dec/ivas_stereo_adapt_GR_dec_fx.c @@ -32,12 +32,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "rom_dec.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*---------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index b3bddae59..15885a661 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -34,13 +34,12 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" /*------------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index b0100063a..166ac72e5 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "rom_com.h" #include "rom_dec.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c index 0db9ab09f..0781d49a6 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" @@ -43,7 +43,6 @@ #include "rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 7c1c892aa..c806f358a 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "rom_com.h" #include "rom_dec.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 9e6878faf..d3415a8eb 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_prot.h" diff --git a/lib_dec/ivas_stereo_eclvq_dec_fx.c b/lib_dec/ivas_stereo_eclvq_dec_fx.c index ed26543d3..693df8c77 100644 --- a/lib_dec/ivas_stereo_eclvq_dec_fx.c +++ b/lib_dec/ivas_stereo_eclvq_dec_fx.c @@ -37,7 +37,7 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index 08ac60ffc..b49ab5399 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -36,12 +36,11 @@ #include #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "basop32.h" #include "ivas_stat_dec.h" diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index b634d4557..22a8c4a90 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index bf343da7f..04781a9cb 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -34,13 +34,12 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "stat_com.h" #include "ivas_prot.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 20fa578f8..69083a078 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -36,10 +36,9 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index c8a59cd6a..2dd2a30c3 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -34,7 +34,7 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" @@ -42,7 +42,6 @@ #include "wmc_auto.h" #include #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_td_dec_fx.c b/lib_dec/ivas_stereo_td_dec_fx.c index e31c9f6bc..8ab7da035 100644 --- a/lib_dec/ivas_stereo_td_dec_fx.c +++ b/lib_dec/ivas_stereo_td_dec_fx.c @@ -35,7 +35,6 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index a22502188..bb73fe7f0 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -32,13 +32,12 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 37ffc5128..c908e4dc3 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -34,14 +34,13 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "stat_dec.h" #include "wmc_auto.h" #include "basop_proto_func.h" #include "stat_com.h" #include "ivas_prot.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------* diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index a4380bd4e..63819b056 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -37,7 +37,6 @@ #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" diff --git a/lib_dec/jbm_jb4_circularbuffer.c b/lib_dec/jbm_jb4_circularbuffer.c index cdabe4700..f9d6d1ca1 100644 --- a/lib_dec/jbm_jb4_circularbuffer.c +++ b/lib_dec/jbm_jb4_circularbuffer.c @@ -38,7 +38,7 @@ #include #include "options.h" #include "string.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /* local includes */ #include "jbm_jb4_circularbuffer.h" diff --git a/lib_dec/jbm_jb4_circularbuffer.h b/lib_dec/jbm_jb4_circularbuffer.h index de614eeea..9e3102feb 100644 --- a/lib_dec/jbm_jb4_circularbuffer.h +++ b/lib_dec/jbm_jb4_circularbuffer.h @@ -37,7 +37,7 @@ #ifndef JBM_JB4_CIRCULARBUFFER_H #define JBM_JB4_CIRCULARBUFFER_H JBM_JB4_CIRCULARBUFFER_H -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" /** handle for circular buffer (FIFO) with fixed capacity */ diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index 55113ee13..5497a4371 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -39,7 +39,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "string.h" #include "jbm_jb4_inputbuffer.h" #include "wmc_auto.h" diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 940df5ecb..5ab8242c7 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -42,7 +42,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /* local includes */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 4878b7d64..002b4bc10 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -48,7 +48,6 @@ #include "jbm_jb4_inputbuffer.h" #include "jbm_jb4_jmf.h" #include "jbm_jb4sb.h" -#include "prot.h" #include "prot_fx.h" #define WMC_TOOL_SKIP diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 10b91a60c..ac6a28b86 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -44,7 +44,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" /* local headers */ #include "jbm_pcmdsp_apa.h" @@ -54,7 +54,6 @@ #include "rom_dec.h" -#include "prot_fx.h" #define INV_100_Q15 328 #define INV_400_Q15 82 #define INV_80_Q15 410 diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 2cc4c6387..66109b555 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -37,9 +37,8 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#include "prot.h" -#include "ivas_prot_fx.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" @@ -3398,7 +3397,7 @@ static ivas_error evs_dec_main_fx( move32(); hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, 0x0290 /*Q0*/ ) ); // Q0 move16(); - mdct_switching_dec( hCoreCoder[0] ); + mdct_switching_dec_ivas_fx( hCoreCoder[0] ); FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) { diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index bc8ef03cb..cc9b681fb 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -7,7 +7,6 @@ #include "options.h" #include "rom_com.h" #include "prot_fx.h" -#include "prot.h" #include "rom_dec.h" #include "stl.h" diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 3cf5f51f3..36cadf6ff 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -14,7 +14,6 @@ #include "cnst.h" #include "prot_fx.h" #include "stat_com.h" -#include "prot.h" #include "ivas_prot_fx.h" #define CROSSFADE_THRESHOLD ( 32762 ) // close to 1.0f in Q15 such that (x == 1.0f) is true diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 203f39707..1e8bef488 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -7,7 +7,6 @@ #include "options.h" #include "basop_util.h" #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" #include "rom_com.h" diff --git a/lib_enc/FEC_enc_fx.c b/lib_enc/FEC_enc_fx.c index 9106e23e7..87243e8d2 100644 --- a/lib_enc/FEC_enc_fx.c +++ b/lib_enc/FEC_enc_fx.c @@ -9,7 +9,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/SNR_calc_fx.c b/lib_enc/SNR_calc_fx.c index f44530c84..09acfd5dc 100644 --- a/lib_enc/SNR_calc_fx.c +++ b/lib_enc/SNR_calc_fx.c @@ -10,7 +10,6 @@ #include "prot_fx_enc.h" /* Function prototypes */ #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 94d7f0471..0f58bcdad 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -6,7 +6,6 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "stat_enc.h" #include "rom_com.h" diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 8268d48b1..90768aca1 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -11,7 +11,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ -#include "prot.h" /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c index a94f45528..76d48ccf4 100644 --- a/lib_enc/ari_hm_enc_fx.c +++ b/lib_enc/ari_hm_enc_fx.c @@ -10,9 +10,7 @@ #include "basop_util.h" #include "rom_com.h" #include "rom_enc.h" -#include "prot.h" -//#include "prot_fx.h" -#include "prot_fx.h" /* Function prototypes */ +#include "prot_fx.h" #include "prot_fx_enc.h" /* Function prototypes */ /*-------------------------------------------------------------------* diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 202d60e51..93a0146f3 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -5,9 +5,7 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" -#include /* Compilation switches */ -#include "prot.h" /* Function prototypes */ -//#include "prot_fx.h" /* Function prototypes */ +#include /* Compilation switches */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 1721476b4..e1b5ca562 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2,12 +2,10 @@ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -#include "rom_enc.h" /* Encoder static table prototypes */ -#include "rom_com.h" /* Static table prototypes */ -//#include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_enc.h" /* Encoder static table prototypes */ +#include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ //#include "basop_mpy.h" diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index c9bbe5f30..a948a4656 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -5,7 +5,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/cod4t64_fast.c b/lib_enc/cod4t64_fast.c index 16651b8f2..a901690e3 100644 --- a/lib_enc/cod4t64_fast.c +++ b/lib_enc/cod4t64_fast.c @@ -34,7 +34,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index 44cde6f27..99b794b42 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -5,10 +5,9 @@ #include "options.h" /* VMR-WB compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_enc.h" /* Encoder static table prototypes */ -#include "prot.h" /* Function prototypes */ +#include "prot_fx.h" /* Function prototypes */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index de9763df0..c54e8ccf4 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -16,11 +16,9 @@ #include "prot_fx_enc.h" #ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include -#include "prot.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" -#include "prot.h" #endif #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index c2b1c22e1..a2995245d 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -13,7 +13,6 @@ #include "ivas_cnst.h" #include #include "rom_com.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 82bb5fca9..f3b4aea6b 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -4,14 +4,11 @@ #include #include #include "options.h" -#include "prot.h" -//#include "prot_fx.h" -//#include "basop_mpy.h" +#include "prot_fx.h" #include "cnst.h" /* Common constants */ #include "ivas_cnst.h" #include "rom_com_fx.h" #include "rom_com.h" /* Common constants */ -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index a6b9e0aa4..6e4d2a043 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -10,7 +10,6 @@ #include #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot.h" /*-------------------------------------------------------------------* * Local constants diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 1053f8b00..06c49a8d3 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -4,10 +4,9 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ +#include "prot_fx.h" /* Function prototypes */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ /*======================================================================*/ diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index a01550978..64a11be5b 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -4,10 +4,9 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ +#include "prot_fx.h" /* Function prototypes */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" #include "prot_fx_enc.h" /*---------------------------------------------------------------------* diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 18948a93f..3ed50017c 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -6,7 +6,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index da2ea5863..ecd4e2f01 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -11,8 +11,7 @@ #include "rom_com_fx.h" #include "rom_com.h" #include "stl.h" -#include "prot.h" -#include "prot_fx.h" /* Function prototypes */ +#include "prot_fx.h" #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index bf04daff5..5b9f67503 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -7,7 +7,6 @@ // #include "prot_fx.h" /* Function prototypes */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 2a621f1d5..cd23c1a6f 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -5,9 +5,8 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ +#include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ /*-------------------------------------------------------------------* diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index e49463a5c..75e82409e 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -6,7 +6,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index 6970597c8..c86b7e061 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -5,10 +5,9 @@ #include #include #include "options.h" /* Compilation switches */ -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Common constants */ -#include "prot_fx.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ #include "prot_fx_enc.h" #ifdef DEBUGGING diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 9cb2cd8e0..307d42078 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -11,7 +11,6 @@ #include "rom_com_fx.h" #include "rom_com.h" #include "rom_enc.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/find_wsp_fx.c b/lib_enc/find_wsp_fx.c index d08922a2a..155e49904 100644 --- a/lib_enc/find_wsp_fx.c +++ b/lib_enc/find_wsp_fx.c @@ -6,8 +6,7 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" -#include "prot_fx.h" /* Function prototypes */ +#include "prot_fx.h" #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index 6af068bae..0321cd763 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -7,7 +7,6 @@ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ //#include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index a7d60642b..f943b104d 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -7,7 +7,6 @@ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "rom_enc.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ //#include "basop_mpy.h" diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 8ed7e9d6c..375d4c2cf 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -6,8 +6,6 @@ #include "cnst.h" #include "rom_com_fx.h" #include "rom_com.h" -//#include "prot_fx.h" -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 53ad3dbb2..944cb2649 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -8,7 +8,6 @@ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ /*-----------------------------------------------------------------* diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 11583ea11..f22218d13 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -2,12 +2,10 @@ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -#include "rom_com_fx.h" /* Static table prototypes */ -#include "rom_com.h" /* Static table prototypes */ -//#include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_com_fx.h" /* Static table prototypes */ +#include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/hq_env_enc_fx.c b/lib_enc/hq_env_enc_fx.c index b0875968e..5d47710ed 100644 --- a/lib_enc/hq_env_enc_fx.c +++ b/lib_enc/hq_env_enc_fx.c @@ -10,7 +10,6 @@ #include "stl.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ /*--------------------------------------------------------------------------------------* * encode_envelope_indices_fx() diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index 4d4742cc1..1cd516b43 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -7,7 +7,6 @@ //#include "prot_fx.h" /* Function prototypes */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "ivas_prot_fx.h" #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index 424689804..9aca0f646 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -12,7 +12,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ -#include "prot.h" /*--------------------------------------------------------------------------* * Local function prototypes diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index 54bc4fb58..b06a1734d 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -8,7 +8,6 @@ //#include "prot_fx.h" #include "rom_com.h" #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #define HVQ_ENC_NOISE_DELTA ( (Word16) 3277 ) /* 0.1 in Q15 */ diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index 6ac6e6811..f6adb0f31 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -38,13 +38,12 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "cnst.h" #include "stat_enc.h" #include "wmc_auto.h" #include "prot_fx_enc.h" -#include "prot_fx.h" #define INV_Log2_10_Q15 9864 /*1/log2(10) in Q15*/ @@ -2535,41 +2534,6 @@ void IGFEncResetTCX10BitCounter_ivas_fx( } -/*-------------------------------------------------------------------* - * IGFEncWriteConcatenatedBitstream() - * - * - *-------------------------------------------------------------------*/ - -/*! r: total number of bits written */ -Word16 IGFEncWriteConcatenatedBitstream( - const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -) -{ - IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData; - Word16 i; - Word16 bitsLeft; - UWord8 *pBitstream; - - hPrivateData = &hIGFEnc->igfData; - pBitstream = hPrivateData->igfBitstream; - - for ( i = 0; i < ( hPrivateData->igfBitstreamBits >> 3 ); i++ ) - { - push_next_indice( hBstr, pBitstream[i], 8 ); - } - - bitsLeft = hPrivateData->igfBitstreamBits & 0x7; - if ( bitsLeft > 0 ) - { - push_next_indice( hBstr, shr( pBitstream[i], sub( 8, bitsLeft ) ), bitsLeft ); - } - - return hIGFEnc->infoTotalBitsWritten; -} - - /*-------------------------------------------------------------------* * IGFEncApplyMono() * diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index ca1759c89..cc4840876 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -8,8 +8,7 @@ #include "options.h" #include "cnst.h" #include "stl.h" -#include "prot.h" -#include "prot_fx.h" /* Function prototypes */ +#include "prot_fx.h" #include "prot_fx_enc.h" /* Function prototypes */ #include "stat_enc.h" #include "basop_util.h" diff --git a/lib_enc/igf_scf_enc.c b/lib_enc/igf_scf_enc.c index 192d7e597..2921b5886 100644 --- a/lib_enc/igf_scf_enc.c +++ b/lib_enc/igf_scf_enc.c @@ -36,12 +36,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "stat_enc.h" #include "stat_com.h" #include "cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 5de4e8e92..615ca1b33 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -10,7 +10,6 @@ #include "stl.h" #include "ivas_cnst.h" #include "ivas_error.h" -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_prot_fx.h" diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 7bb13239f..46bec5f4d 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -10,7 +10,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index 649c5bae5..37d25c508 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -36,10 +36,9 @@ #include #include "options.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "basop_util.h" diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 303adecfd..5f318e959 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -34,12 +34,11 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_prot.h" #include "wmc_auto.h" #include -#include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index f963b55a4..f41eb7f9c 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot.h" @@ -50,7 +49,6 @@ #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*---------------------------------------------------------------* * Local constants diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 1234a6876..a9da7f342 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -37,9 +37,8 @@ #include "ivas_prot.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" #include "basop_util.h" diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 1b4d5da4a..32e3e7107 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot.h" diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 3fd9c2d7a..811e53d12 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -36,7 +36,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "prot_fx_enc.h" #include "ivas_rom_com.h" @@ -45,7 +45,6 @@ #endif #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_enc.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index a3194a9d0..1158f72fa 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -35,11 +35,10 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index ec55850fd..7bfa9f268 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 95a114b67..576bbb2c6 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -32,11 +32,10 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*------------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index 2bab65c42..0a2d976e1 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -36,14 +36,13 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_entropy_coder_fx.c b/lib_enc/ivas_entropy_coder_fx.c index eb82aa78a..a95f2884c 100644 --- a/lib_enc/ivas_entropy_coder_fx.c +++ b/lib_enc/ivas_entropy_coder_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 3844598c6..f1aeb5398 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -36,14 +36,13 @@ #include "ivas_cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "prot_fx_enc.h" #include #include "wmc_auto.h" #include #include "prot_fx_enc.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 9d31297bd..3eeb45d14 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -34,7 +34,7 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_enc.h" @@ -42,7 +42,6 @@ #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 615660761..64b8991d6 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -34,10 +34,9 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 51af4e5a9..22bf88df8 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -33,12 +33,11 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "prot_fx_enc.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index a5a1286a2..a36ee78e2 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -38,10 +38,9 @@ #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_ism_param_enc_fx.c b/lib_enc/ivas_ism_param_enc_fx.c index bef6912bd..e6b23fcfc 100644 --- a/lib_enc/ivas_ism_param_enc_fx.c +++ b/lib_enc/ivas_ism_param_enc_fx.c @@ -36,7 +36,6 @@ #include "options.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" #include "prot_fx.h" #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index fee34abd8..86237fb31 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -33,12 +33,11 @@ #include #include "options.h" #include "math.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index f4fe68c59..21c23c34a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -38,7 +38,6 @@ #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 36324ae0f..2797fa5e4 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "ivas_rom_enc.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" @@ -46,7 +45,6 @@ #include "wmc_auto.h" #include "prot_fx_enc.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- * Local function prototypes diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index 392f1d9ab..9060c786b 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -36,10 +36,9 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "basop_util.h" #include "ivas_rom_com_fx.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index b3f99e27c..bb6ef0d01 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -38,7 +38,6 @@ #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index d11447c03..439c227ae 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -34,14 +34,12 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index dbced19fd..55da30e73 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -36,10 +36,9 @@ #include #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" #include "rom_com.h" diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 7e8547841..88d773b53 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index edfc607ed..403d379fa 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -36,13 +36,12 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "prot_fx_enc.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index f09d4513d..7c8b78ffb 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 5eee0975a..648dcdb73 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -36,12 +36,11 @@ #include #include "ivas_cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_enc/ivas_pca_enc_fx.c b/lib_enc/ivas_pca_enc_fx.c index 8b61cb6c8..410d5dd52 100644 --- a/lib_enc/ivas_pca_enc_fx.c +++ b/lib_enc/ivas_pca_enc_fx.c @@ -32,14 +32,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include #include #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 3f0218e97..7a2a28767 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -35,15 +35,13 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" -#include "prot.h" -#include "prot_fx.h" #include "basop_util.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_qspherical_enc_fx.c b/lib_enc/ivas_qspherical_enc_fx.c index eb60d4849..a6f40c8f0 100644 --- a/lib_enc/ivas_qspherical_enc_fx.c +++ b/lib_enc/ivas_qspherical_enc_fx.c @@ -39,7 +39,6 @@ #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_range_uni_enc_fx.c b/lib_enc/ivas_range_uni_enc_fx.c index 35ecad69c..cf32c644d 100644 --- a/lib_enc/ivas_range_uni_enc_fx.c +++ b/lib_enc/ivas_range_uni_enc_fx.c @@ -39,7 +39,7 @@ #include "rom_com.h" #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_sba_enc_fx.c b/lib_enc/ivas_sba_enc_fx.c index b247900a0..86427eb2d 100644 --- a/lib_enc/ivas_sba_enc_fx.c +++ b/lib_enc/ivas_sba_enc_fx.c @@ -37,13 +37,12 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 9f63c4fc7..8c2c945d6 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot.h" diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 8f93c4d76..e6038186e 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -35,10 +35,9 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index a0c5be842..674a80549 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -38,7 +38,6 @@ #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_stat_com.h" -#include "prot.h" #include "math.h" #include "wmc_auto.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 8b23eca5f..925f4e702 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -33,7 +33,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" @@ -42,7 +41,6 @@ #include "ivas_rom_com_fx.h" #include #include "wmc_auto.h" -#include "prot_fx.h" /*------------------------------------------------------------------------------------------* * PreProcessor diff --git a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c index 62fed34f7..70c2165f8 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c @@ -34,7 +34,7 @@ #include "options.h" #include "cnst.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "stat_enc.h" #include "wmc_auto.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 0c90d5fdc..bfe683d6b 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -38,13 +38,12 @@ #endif #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "ivas_cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_cng_enc_fx.c b/lib_enc/ivas_stereo_cng_enc_fx.c index 4727cd188..255b6e938 100644 --- a/lib_enc/ivas_stereo_cng_enc_fx.c +++ b/lib_enc/ivas_stereo_cng_enc_fx.c @@ -36,12 +36,11 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 8578a46ae..3f7237ce5 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -37,10 +37,9 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index 70a467232..7900033f4 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "rom_enc.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index dd7f575b7..58e66a01a 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "ivas_prot.h" #include "ivas_rom_com.h" @@ -43,7 +43,6 @@ #include "ivas_cnst.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 7b0e7df62..a3388db61 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "rom_com.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" @@ -45,7 +44,6 @@ #include "ivas_rom_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_eclvq_enc_fx.c b/lib_enc/ivas_stereo_eclvq_enc_fx.c index cd0e6fe2d..f4962c802 100644 --- a/lib_enc/ivas_stereo_eclvq_enc_fx.c +++ b/lib_enc/ivas_stereo_eclvq_enc_fx.c @@ -39,7 +39,6 @@ #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" /* used only for norm_s in the code_length_from_count function */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index e0a8a8ed4..351b87cd0 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -36,12 +36,11 @@ #include #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 8c2d136b7..78891c5f7 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -35,12 +35,11 @@ #include #include "cnst.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 2a87ea4f9..28b0e41b9 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "rom_com.h" diff --git a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c index 38be1a6a4..57bb18e80 100644 --- a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include -#include "prot.h" #include "prot_fx.h" #include "cnst.h" #include "stat_enc.h" diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index 9c729709d..b1213a750 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -38,7 +38,6 @@ #include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" -#include "prot.h" #include "prot_fx_enc.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 190adbf1c..f3ceb2757 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -34,14 +34,13 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com_fx.h" #include "ivas_rom_com.h" #include "assert.h" #include "wmc_auto.h" #include "prot_fx_enc.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 79e05bf09..efae1e80d 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -35,14 +35,13 @@ #include #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "rom_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 304754fc3..f8d600276 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include "cnst.h" #include "rom_com.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" @@ -44,7 +44,6 @@ #endif #include "prot_fx_enc.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 84bffa87c..28044b45d 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -35,13 +35,12 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "rom_com.h" #include "basop_proto_func.h" #include "wmc_auto.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "prot_fx_enc.h" #include "rom_com_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index 4d6a908b3..34215025f 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "ivas_prot.h" diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 1f2fee684..211c53f8c 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -41,7 +41,6 @@ #include "lib_enc.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" #include "prot_fx.h" #include "prot_fx_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 709bb47e0..a61b2ebff 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -8,7 +8,6 @@ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ //#include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 830f1ecd6..7f58a9501 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -38,7 +38,6 @@ #include "options.h" #include "cnst.h" #include "ivas_prot.h" -#include "prot.h" #include "prot_fx.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c index 265fce7f2..eec85c254 100644 --- a/lib_enc/mdct_classifier_fx.c +++ b/lib_enc/mdct_classifier_fx.c @@ -9,7 +9,6 @@ #include "rom_com.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/mslvq_enc_fx.c b/lib_enc/mslvq_enc_fx.c index d8a78c525..771ef480b 100644 --- a/lib_enc/mslvq_enc_fx.c +++ b/lib_enc/mslvq_enc_fx.c @@ -6,9 +6,8 @@ #include "rom_com_fx.h" #include "rom_com.h" #include "stl.h" -#include "prot.h" /* Function prototypes */ -#include "basop32.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ +#include "basop32.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index 3bd8e340d..a7588283a 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "rom_com.h" diff --git a/lib_enc/peak_vq_enc_fx.c b/lib_enc/peak_vq_enc_fx.c index 9ea1af949..aa4763aa6 100644 --- a/lib_enc/peak_vq_enc_fx.c +++ b/lib_enc/peak_vq_enc_fx.c @@ -11,7 +11,6 @@ #include "rom_com_fx.h" #include "rom_com.h" #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ /*-------------------------------------------------------------------------- diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index d53e2eb6e..bcf7d33bb 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -10,7 +10,6 @@ #include "rom_com.h" /* Static table prototypes */ //#include "prot_fx.h" /* Function prototypes */ #include "rom_basop_util.h" -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/range_enc_fx.c b/lib_enc/range_enc_fx.c index 05916e801..689b313d8 100644 --- a/lib_enc/range_enc_fx.c +++ b/lib_enc/range_enc_fx.c @@ -10,7 +10,6 @@ #include "rom_com.h" /* Static table prototypes */ //#include "prot_fx.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index a735c498d..353de8ec9 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -19,7 +19,6 @@ #include #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" /*---------------------------------------------------------------------* diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index 91dca8d63..0a20db8ed 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -11,7 +11,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot.h" /*======================================================================*/ /* FUNCTION : stat_noise_uv_enc_fx */ diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 3ca3f3f3f..2ca0b6d74 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -4,12 +4,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "cnst.h" #include "rom_com_fx.h" #include "rom_com.h" #include "stl.h" -#include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ /*---------------------------------------------------------------------* diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index acd984509..1a397c514 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -36,7 +36,6 @@ #include "prot_fx_enc.h" /* Function prototypes */ #include "rom_com.h" #include "stl.h" -#include "prot.h" /*--------------------------------------------------------------------------* * GetSubbandCorrIndex2_har() diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c deleted file mode 100644 index db4e51127..000000000 --- a/lib_enc/swb_tbe_enc.c +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -/*==================================================================================== - EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 - ====================================================================================*/ - -#include -#include "options.h" -#include -#include "cnst.h" -#include "prot.h" -#include "prot_fx.h" -#include "rom_com.h" -#include "rom_enc.h" -#include "wmc_auto.h" -#include "ivas_prot.h" diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index a5e4e902b..61ca9b101 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -8,7 +8,6 @@ #include "cnst.h" #include "rom_com_fx.h" #include "rom_com.h" -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_prot.h" /* Function prototypes */ diff --git a/lib_enc/tcq_core_enc_fx.c b/lib_enc/tcq_core_enc_fx.c index fbd9775c4..82088be50 100644 --- a/lib_enc/tcq_core_enc_fx.c +++ b/lib_enc/tcq_core_enc_fx.c @@ -10,7 +10,6 @@ #include "ivas_error.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "prot.h" #define IVAS_FLOAT ivas_error tcq_core_LR_enc_fx( diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index f1881a427..cf6e5dd64 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -12,7 +12,6 @@ #include #include "rom_com_fx.h" #include "rom_com.h" -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 0089fc745..9911d766a 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com_fx.h" /* Static table prototypes */ #include "rom_com.h" /* Static table prototypes */ -#include "prot.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 4a4c1ff89..008e27d6c 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index 67d47e89d..81437c49d 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -33,7 +33,7 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" @@ -41,7 +41,6 @@ #include "ivas_rom_binaural_crend_head.h" #include "ivas_stat_rend.h" #include "lib_rend.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "wmc_auto.h" #ifdef DEBUGGING diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 06744dc6e..9cc764afb 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -35,11 +35,10 @@ #include "ivas_cnst.h" #include "ivas_prot_rend.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e2ab6cd3e..7e41581f4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include #include -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 01fd1e610..4ea5c5e96 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -35,13 +35,12 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_dirac_onsets_dec_fx.c b/lib_rend/ivas_dirac_onsets_dec_fx.c index c6119cc34..4eae9c286 100644 --- a/lib_rend/ivas_dirac_onsets_dec_fx.c +++ b/lib_rend/ivas_dirac_onsets_dec_fx.c @@ -34,14 +34,13 @@ #include #include "options.h" #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "wmc_auto.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- * ivas_dirac_dec_onset_detection_open() diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 0624d3910..983343bba 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -35,7 +35,7 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" @@ -43,7 +43,6 @@ #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "wmc_auto.h" -#include "prot_fx.h" /* Function prototypes */ #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index f5e050db1..45ab2e68a 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -35,13 +35,12 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_rom_binaural_crend_head.h" diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 8947809d1..52ca3e6f9 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -35,7 +35,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" diff --git a/lib_rend/ivas_hrtf_fx.c b/lib_rend/ivas_hrtf_fx.c index 506d76efd..5d53d2ae3 100644 --- a/lib_rend/ivas_hrtf_fx.c +++ b/lib_rend/ivas_hrtf_fx.c @@ -32,7 +32,7 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_error.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_limiter_fx.c b/lib_rend/ivas_limiter_fx.c index 595573016..b66127e09 100644 --- a/lib_rend/ivas_limiter_fx.c +++ b/lib_rend/ivas_limiter_fx.c @@ -33,7 +33,7 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index e8d06d0bb..8b7e6575d 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -36,9 +36,8 @@ #include "ivas_prot_rend.h" #include "ivas_prot.h" #include "ivas_cnst.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 0b0c8ffeb..25fddaa80 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -37,12 +37,11 @@ #include "options.h" #include "ivas_prot_rend.h" #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "ivas_rom_com_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 8b689b94b..93fe67436 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -33,14 +33,13 @@ #include "ivas_stat_rend.h" #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" #include "debug.h" #include "ivas_rom_com_fx.h" #define float_to_fixed( n, factor ) ( round( n * ( 1 << factor ) ) ) diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index ab09a82b5..a7f46b2a4 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -33,13 +33,12 @@ #include #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "ivas_cnst.h" #include "wmc_auto.h" -#include "prot_fx.h" /*---------------------------------------------------------------------* * Local function prototypes diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index a328a51bf..7ee6c828b 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -32,14 +32,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_TdBinauralRenderer.h" #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_rom_rend.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*-------------------------------------------------------------------* * Local constants diff --git a/lib_rend/ivas_objectRenderer_sfx_fx.c b/lib_rend/ivas_objectRenderer_sfx_fx.c index caa393355..971e2c2d1 100644 --- a/lib_rend/ivas_objectRenderer_sfx_fx.c +++ b/lib_rend/ivas_objectRenderer_sfx_fx.c @@ -35,9 +35,8 @@ #include #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index af60f7746..307d38351 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -33,11 +33,10 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#include "prot_fx.h" /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_objectRenderer_vec_fx.c b/lib_rend/ivas_objectRenderer_vec_fx.c index c8efd80ad..4d259a68e 100644 --- a/lib_rend/ivas_objectRenderer_vec_fx.c +++ b/lib_rend/ivas_objectRenderer_vec_fx.c @@ -33,10 +33,9 @@ #include #include "options.h" #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 7d6129d20..d7387ecd4 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -37,11 +37,10 @@ #include "ivas_prot_rend.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 980e5ca17..054e5e981 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -33,7 +33,7 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_rend/ivas_reflections_fx.c b/lib_rend/ivas_reflections_fx.c index e5e8cdb56..a02a29d0d 100644 --- a/lib_rend/ivas_reflections_fx.c +++ b/lib_rend/ivas_reflections_fx.c @@ -33,7 +33,7 @@ #include "options.h" #include #include -#include "prot.h" +#include "prot_fx.h" #include "rom_dec.h" #include "lib_rend.h" #include "ivas_prot_rend.h" @@ -42,7 +42,6 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "debug.h" #include "ivas_rom_com_fx.h" diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index 792b485a7..b730b1510 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -32,12 +32,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "ivas_rom_TdBinauralRenderer.h" #include "wmc_auto.h" -#include "prot_fx.h" /*-----------------------------------------------------------------------* * Local constants diff --git a/lib_rend/ivas_reverb_delay_line_fx.c b/lib_rend/ivas_reverb_delay_line_fx.c index 3eeb4ede4..44550803a 100644 --- a/lib_rend/ivas_reverb_delay_line_fx.c +++ b/lib_rend/ivas_reverb_delay_line_fx.c @@ -34,9 +34,8 @@ #include "options.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#include "prot.h" -#include "wmc_auto.h" #include "prot_fx.h" +#include "wmc_auto.h" #include "debug.h" /*-----------------------------------------------------------------------------------------* * Function ivas_rev_delay_line_init() diff --git a/lib_rend/ivas_reverb_fft_filter_fx.c b/lib_rend/ivas_reverb_fft_filter_fx.c index 3befcde91..2d0722ceb 100644 --- a/lib_rend/ivas_reverb_fft_filter_fx.c +++ b/lib_rend/ivas_reverb_fft_filter_fx.c @@ -32,11 +32,10 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "debug.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) diff --git a/lib_rend/ivas_reverb_filter_design_fx.c b/lib_rend/ivas_reverb_filter_design_fx.c index 428cf3353..652fc898f 100644 --- a/lib_rend/ivas_reverb_filter_design_fx.c +++ b/lib_rend/ivas_reverb_filter_design_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_rend.h" #include diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 9e621ce83..6b41815c4 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -32,14 +32,13 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "math.h" #include "ivas_rom_rend.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "debug.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define float_to_fixQ31( n ) ( round( n * 0x7fffffff ) ) diff --git a/lib_rend/ivas_reverb_iir_filter_fx.c b/lib_rend/ivas_reverb_iir_filter_fx.c index 217e16dd8..98b66e0c7 100644 --- a/lib_rend/ivas_reverb_iir_filter_fx.c +++ b/lib_rend/ivas_reverb_iir_filter_fx.c @@ -32,10 +32,9 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "debug.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) diff --git a/lib_rend/ivas_reverb_utils_fx.c b/lib_rend/ivas_reverb_utils_fx.c index 46ef576a8..ee2bada9d 100644 --- a/lib_rend/ivas_reverb_utils_fx.c +++ b/lib_rend/ivas_reverb_utils_fx.c @@ -32,12 +32,11 @@ #include #include "options.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include #include "wmc_auto.h" -#include "prot_fx.h" #include "options_warnings.h" /*-----------------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index 39720469b..7ad4c4ccb 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -37,11 +37,10 @@ #include "options.h" #include #include "cnst.h" -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" #include -#include "prot_fx.h" #include "ivas_prot_fx.h" #include "debug.h" #include "ivas_rom_binaural_crend_head.h" diff --git a/lib_rend/ivas_sba_rendering_fx.c b/lib_rend/ivas_sba_rendering_fx.c index 7c7a20223..4323fc96f 100644 --- a/lib_rend/ivas_sba_rendering_fx.c +++ b/lib_rend/ivas_sba_rendering_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" diff --git a/lib_rend/ivas_shoebox_fx.c b/lib_rend/ivas_shoebox_fx.c index 9ed0d8d33..7c930104a 100644 --- a/lib_rend/ivas_shoebox_fx.c +++ b/lib_rend/ivas_shoebox_fx.c @@ -36,7 +36,6 @@ #include "ivas_prot_rend.h" #include "ivas_stat_rend.h" #include "ivas_cnst.h" -#include "prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_td_decorr_fx.c b/lib_rend/ivas_td_decorr_fx.c index af51a7820..6d5b23f12 100644 --- a/lib_rend/ivas_td_decorr_fx.c +++ b/lib_rend/ivas_td_decorr_fx.c @@ -33,7 +33,6 @@ #include #include #include "options.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot_fx.h" #include "ivas_prot.h" diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index e1a6868d8..06cbd83a6 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -34,12 +34,11 @@ #include "options.h" #include #include -#include "prot.h" +#include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" -#include "prot_fx.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d9bb5cd41..ef5d5602c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -32,7 +32,6 @@ #include "basop_util.h" #include "options.h" #include "lib_rend.h" -#include "prot.h" #include "prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 8920e6780..930bb79dc 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -32,9 +32,8 @@ #include "hrtf_file_reader.h" #include -#include "prot.h" -#include "ivas_prot_rend.h" #include "prot_fx.h" +#include "ivas_prot_rend.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 01d1f0307..90d47b7c9 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -34,7 +34,7 @@ #include #include #include "ivas_prot.h" -#include "prot.h" +#include "prot_fx.h" struct LsCustomFileReader diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 782f818d0..2976e1895 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -32,7 +32,7 @@ #include "mime_io.h" #include "mime.h" -#include "prot.h" +#include "prot_fx.h" #include "string.h" #include #include diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index b6122ec0f..e099842be 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -37,7 +37,7 @@ #include #include #include "cmdl_tools.h" -#include "prot.h" +#include "prot_fx.h" /*------------------------------------------------------------------------------------------* diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index 468f80765..2299f3265 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -34,7 +34,6 @@ #include #include #include -#include "prot.h" #include "prot_fx.h" diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index ec14ebc71..5745e9595 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -35,7 +35,6 @@ #include #include #include -#include "prot.h" #include "options.h" /* only included to get access to the feature-defines */ #include "prot_fx.h" #include "ivas_prot_fx.h" -- GitLab From b93d15320328b41c43e6212734fd40a672c8f264 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 10:13:00 +0530 Subject: [PATCH 058/358] Fix for 3GPP issue 1140: Missing conversion of some flt. pt. functions in the BASOP code Link #1140 --- lib_com/float_to_fix_ops.c | 8 ++--- lib_com/ivas_spar_com_fx.c | 39 ++++++++++++++++--------- lib_dec/dec_tcx_fx.c | 19 ++++++------ lib_dec/ivas_lfe_plc_fx.c | 12 ++++---- lib_dec/ivas_mc_paramupmix_dec_fx.c | 6 ++-- lib_dec/ivas_qmetadata_dec_fx.c | 3 +- lib_dec/ivas_spar_md_dec_fx.c | 7 +++-- lib_dec/ivas_stereo_cng_dec.c | 6 ++-- lib_dec/ivas_stereo_dft_dec_fx.c | 38 +++++++++++++++--------- lib_enc/ACcontextMapping_enc_fx.c | 7 +++-- lib_enc/fd_cng_enc_fx.c | 2 +- lib_enc/ivas_agc_enc_fx.c | 2 +- lib_enc/ivas_core_pre_proc_fx.c | 2 +- lib_enc/ivas_cpe_enc_fx.c | 2 +- lib_enc/ivas_init_enc_fx.c | 2 +- lib_enc/ivas_lfe_enc_fx.c | 20 ++++++------- lib_enc/ivas_mc_paramupmix_enc_fx.c | 10 +++---- lib_enc/ivas_osba_enc_fx.c | 2 +- lib_enc/ivas_qmetadata_enc_fx.c | 3 +- lib_enc/ivas_sba_enc_fx.c | 2 +- lib_enc/ivas_stereo_dft_enc_itd_fx.c | 9 ++++-- lib_enc/ivas_stereo_dmx_evs_fx.c | 6 ++-- lib_enc/ivas_stereo_ica_enc_fx.c | 4 +-- lib_enc/ivas_stereo_switching_enc_fx.c | 2 +- lib_rend/ivas_dirac_decorr_dec_fx.c | 4 +-- lib_rend/ivas_dirac_rend_fx.c | 2 +- lib_rend/ivas_reverb_filter_design_fx.c | 6 ++-- lib_rend/ivas_rotation_fx.c | 2 +- lib_rend/lib_rend.c | 12 ++++---- 29 files changed, 137 insertions(+), 102 deletions(-) diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 1f7c28fd8..8b69e05e8 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -183,14 +183,14 @@ Word16 Q_factor( float x ) { Word16 Q = 15; if ( x >= 1 || x <= -1 ) - Q = norm_s( (Word16) abs( (Word32) x ) ); + Q = norm_s( (Word16) L_abs( (Word32) x ) ); return Q; } Word16 Q_factor_L( float x ) { Word16 Q = 31; if ( x >= 1 || x <= -1 ) - Q = norm_l( abs( (Word32) x ) ); + Q = norm_l( L_abs( (Word32) x ) ); return Q; } Word16 Q_factor_L_32( Word32 x ) @@ -206,7 +206,7 @@ Word16 Q_factor_arr( float *x, Word16 l ) for ( int i = 0; i < l; i++ ) { if ( x[i] >= 1 || x[i] <= -1 ) - Q = s_min( Q, norm_s( (Word16) abs( (Word32) x[i] ) ) ); + Q = s_min( Q, norm_s( (Word16) L_abs( (Word32) x[i] ) ) ); } return Q; } @@ -216,7 +216,7 @@ Word16 Q_factor_arrL( float *x, Word16 l ) for ( int i = 0; i < l; i++ ) { if ( x[i] >= 1 || x[i] <= -1 ) - Q = s_min( Q, norm_l( (Word32) abs( (Word32) x[i] ) ) ); + Q = s_min( Q, norm_l( (Word32) L_abs( (Word32) x[i] ) ) ); } return Q; } diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index fc6e60310..6c80c1898 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -4004,7 +4004,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( move16(); P_norm_fx[0] = 0; move32(); - FOR( i = 0; i < max( 0, sub( foa_ch, ndm ) ); i++ ) + Word16 len = s_max( 0, sub( foa_ch, ndm ) ); + FOR( i = 0; i < len; i++ ) { P_norm_fx[0] = L_add( P_norm_fx[0], Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ) ); // 2*q_P_re - 31 move32(); @@ -4014,7 +4015,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( P_norm_fx[1] = 0; move32(); - FOR( ; i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ); i++ ) + len = s_max( 0, sub( s_min( num_ch, hoa2_ch ), ndm ) ); + FOR( ; i < len; i++ ) // max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ) { P_norm_fx[1] = L_add( P_norm_fx[1], Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ) ); // 2*q_P_re - 31 move32(); @@ -4031,8 +4033,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( } P_norm_fx[2] = Mpy_32_32( L_shl( P_norm_fx[2], 3 ), diff_norm_order3_table[min( diff_norm_order3_fx, max( 0, ( num_ch - ndm ) ) )] ); // 2*q_P_re - 31 move32(); - - FOR( i = 0; i < max( 0, ( foa_ch - ndm ) ); i++ ) + len = s_max( 0, sub( foa_ch, ndm ) ); + FOR( i = 0; i < len; i++ ) // i < max( 0, ( foa_ch - ndm ) ) { idx = sub( remix_order[i + ndm], ndm ); P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); // 2*q_P_re - 31 @@ -4045,7 +4047,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } - FOR( ; i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ); i++ ) + len = s_max( 0, sub( s_min( num_ch, hoa2_ch ), ndm ) ); + FOR( ; i < len; i++ ) // i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ) { idx = sub( remix_order[i + ndm], ndm ); P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); // 2*q_P_re - 31 @@ -4057,6 +4060,7 @@ void ivas_get_spar_md_from_dirac_enc_fx( move32(); } } + FOR( ; i < ( num_ch - ndm ); i++ ) { idx = sub( remix_order[i + ndm], ndm ); @@ -4222,7 +4226,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( /*normalize 2nd order*/ norm_fx = 0; move32(); - FOR( ch = foa_ch; ch < min( hoa2_ch_order, num_ch_order ); ch++ ) + 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 } @@ -4243,7 +4248,8 @@ void ivas_get_spar_md_from_dirac_enc_fx( move16(); } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - FOR( ch = foa_ch; ch < min( hoa2_ch_order, num_ch_order ); ch++ ) + 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 ) ) { @@ -4557,7 +4563,8 @@ void ivas_get_spar_md_from_dirac_fx( move16(); P_norm_fx[0] = 0; move32(); - FOR( i = 0; i < max( 0, sub( foa_ch, ndm ) ); i++ ) + Word16 len = s_max( 0, sub( foa_ch, ndm ) ); + FOR( i = 0; i < len; i++ ) // i < max( 0, sub( foa_ch, ndm ) ) { P_norm_fx[0] = L_add( P_norm_fx[0], Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ) ); // 2*q_P_re - 31 move32(); @@ -4567,7 +4574,8 @@ void ivas_get_spar_md_from_dirac_fx( P_norm_fx[1] = 0; move32(); - FOR( ; i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ); i++ ) + len = s_max( 0, sub( s_min( num_ch, hoa2_ch ), ndm ) ); + FOR( ; i < len; i++ ) // i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ) { P_norm_fx[1] = L_add( P_norm_fx[1], Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ) ); // 2*q_P_re - 31 move32(); @@ -4584,8 +4592,8 @@ void ivas_get_spar_md_from_dirac_fx( } P_norm_fx[2] = Mpy_32_32( L_shl( P_norm_fx[2], 3 ), diff_norm_order3_table[min( diff_norm_order3_fx, max( 0, ( num_ch - ndm ) ) )] ); // 2*q_P_re - 31 move32(); - - FOR( i = 0; i < max( 0, ( foa_ch - ndm ) ); i++ ) + len = s_max( 0, sub( foa_ch, ndm ) ); + FOR( i = 0; i < len; i++ ) // i < max( 0, ( foa_ch - ndm ) ) { idx = sub( remix_order[i + ndm], ndm ); P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); // 2*q_P_re - 31 @@ -4598,7 +4606,8 @@ void ivas_get_spar_md_from_dirac_fx( move32(); } } - FOR( ; i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ); i++ ) + len = s_max( 0, sub( s_min( num_ch, hoa2_ch ), ndm ) ); + FOR( ; i < len; i++ ) // i < max( 0, ( min( num_ch, hoa2_ch ) - ndm ) ) { idx = sub( remix_order[i + ndm], ndm ); P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); // 2*q_P_re - 31 @@ -4775,7 +4784,8 @@ void ivas_get_spar_md_from_dirac_fx( /*normalize 2nd order*/ norm_fx = 0; move32(); - FOR( ch = foa_ch; ch < min( hoa2_ch_order, num_ch_order ); ch++ ) + 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 } @@ -4796,7 +4806,8 @@ void ivas_get_spar_md_from_dirac_fx( move16(); } norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30 - FOR( ch = foa_ch; ch < min( hoa2_ch_order, num_ch_order ); ch++ ) + 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 ) ) { diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 20f7a0adf..00f372154 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3807,7 +3807,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, (Word16) abs( tmp32 ) * i * 2, &Overflow ); + *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } @@ -3875,7 +3875,8 @@ void decoder_tcx_invQ_fx( test(); IF( !st->tcxonly || ( hTcxCfg->resq && hTcxDec->tcx_lpc_shaped_ari ) ) { - FOR( i = 0; i < max( L_spec, L_frameTCX ); i++ ) + Word16 len = s_max( L_spec, L_frameTCX ); + FOR( i = 0; i < len; i++ ) { xn_buf[i] = ONE_IN_Q14; move16(); @@ -4891,11 +4892,11 @@ void decoder_tcx_tns_fx( move16(); test(); - IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) ) + IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && st->tcxonly != 0 ) { test(); test(); - IF( NE_16( frame_cnt, 0 ) && EQ_16( bfi, 0 ) && NE_16( st->last_core, ACELP_CORE ) ) + IF( frame_cnt != 0 && bfi == 0 && st->last_core != ACELP_CORE ) { /* fix sub-window overlap */ hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; @@ -4940,14 +4941,14 @@ void decoder_tcx_tns_fx( test(); test(); test(); - IF( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns, 0 ) && NE_16( bfi, 1 ) && EQ_16( tnsData->tnsOnWhitenedSpectra, whitenedDomain ) ) + IF( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && fUseTns != 0 && NE_16( bfi, 1 ) && EQ_16( tnsData->tnsOnWhitenedSpectra, whitenedDomain ) ) { /* Apply TNS to get the reconstructed signal */ SetTnsConfig( hTcxCfg, L_frame_glob == st->L_frame, ( st->last_core == ACELP_CORE ) && ( frame_cnt == 0 ) ); test(); test(); - IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && NE_16( isTCX5, 0 ) ) + IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && st->tcxonly != 0 && isTCX5 != 0 ) { tcx5TnsGrouping_fx( shr( L, 1 ), shr( hTcxCfg->tnsConfig[0][0].iFilterBorders[0], 1 ), x_fx ); } @@ -4956,10 +4957,10 @@ void decoder_tcx_tns_fx( test(); test(); - IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && NE_16( isTCX5, 0 ) ) + IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && st->tcxonly != 0 && isTCX5 != 0 ) { test(); - IF( EQ_16( st->element_mode, EVS_MONO ) || LT_16( L_spec, L_frameTCX ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ + IF( st->element_mode == EVS_MONO || LT_16( L_spec, L_frameTCX ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ { tcx5TnsUngrouping_fx( shr( L_frameTCX, 1 ), shr( hTcxCfg->tnsConfig[0][0].iFilterBorders[0], 1 ), x_fx, DEC ); tmp = L_frameTCX; @@ -5232,7 +5233,7 @@ void decoder_tcx_imdct_fx( { IMDCT_ivas_fx( x_tmp_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, - kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win ); + kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win ); } ELSE { diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index a8b54d3fb..018f99fe7 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -396,7 +396,7 @@ static Word16 lfeplc_lev_dur_fx( IF( LT_16( rc_q_fx[i - 1], 31 ) ) { - IF( GT_32( abs( rc_fx[i - 1] ), L_shr( 2146302532, sub( 31, rc_q_fx[i - 1] ) ) ) ) // 2146302532 = 0.99945f in Q31 + IF( GT_32( L_abs( rc_fx[i - 1] ), L_shr( 2146302532, sub( 31, rc_q_fx[i - 1] ) ) ) ) // 2146302532 = 0.99945f in Q31 { return 1; } @@ -413,7 +413,7 @@ static Word16 lfeplc_lev_dur_fx( } ELSE { - IF( GT_32( abs( L_shr( rc_fx[i - 1], sub( rc_q_fx[i - 1], 31 ) ) ), 2146302532 ) ) // 2146302532 = 0.00045f in Q31 + IF( GT_32( L_abs( L_shr( rc_fx[i - 1], sub( rc_q_fx[i - 1], 31 ) ) ), 2146302532 ) ) // 2146302532 = 0.00045f in Q31 { return 1; } @@ -465,7 +465,7 @@ static Word16 d_a2rc_fx( move32(); km_q_fx = ff_q_fx[m]; move16(); - IF( GE_64( W_shr( abs( km_fx ), sub( ff_q_fx[m], Q30 ) ), W_deposit32_l( ONE_IN_Q30 ) ) ) + IF( GE_64( W_shr( L_abs( km_fx ), sub( ff_q_fx[m], Q30 ) ), W_deposit32_l( ONE_IN_Q30 ) ) ) { FOR( j = 0; j < lpcorder; j++ ) { @@ -826,7 +826,7 @@ static Word32 find_max_delta_fx( IF( !stable ) { - temp = abs( eps_fx ); + temp = L_abs( eps_fx ); IF( GT_32( L_shr( temp, sub( eps_q_fx, 31 ) ), EPS_STOP_Q31 ) ) { exp1 = norm_l( -temp ); @@ -836,12 +836,12 @@ static Word32 find_max_delta_fx( } ELSE { - eps_fx = L_negate( abs( eps_fx ) ); + eps_fx = L_negate( L_abs( eps_fx ) ); } } ELSE { - temp = abs( eps_fx ); + temp = L_abs( eps_fx ); if ( LT_32( L_shr( temp, sub( eps_q_fx, 31 ) ), EPS_STOP_Q31 ) ) { BREAK; diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index e03b385b7..9ea666237 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -132,7 +132,8 @@ void ivas_mc_paramupmix_dec_read_BS( nb_bits_read_orig = 0; move16(); last_bit_pos = sub( last_bit_pos, nb_bits_read_orig ); /* reverse the bitstream for easier reading of indices */ - FOR( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) + Word16 len = s_min( MAX_BITS_METADATA, last_bit_pos ); + FOR( i = 0; i < len; i++ ) { bstr_meta[i] = st_ivas->bit_stream[last_bit_pos - i]; move16(); @@ -269,7 +270,8 @@ void ivas_mc_paramupmix_dec_render( ivas_mc_paramupmix_dec_sf( st_ivas, output_local_fx ); - FOR( ch = 0; ch < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); ch++ ) + Word16 num_ch = s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); + FOR( ch = 0; ch < num_ch; ch++ ) { output_local_fx[ch] += n_samples_sf; } diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index 4bebcda5c..81768af44 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -3257,7 +3257,8 @@ static Word16 read_truncGR_azimuth_fx( move16(); IF( LE_16( allowed_bits, add( no_subframes, 1 ) ) ) { - FOR( i = 0; i < min( allowed_bits, no_subframes ); i++ ) + Word16 len = s_min( allowed_bits, no_subframes ); + FOR( i = 0; i < len; i++ ) { IF( bitstream[( *pbit_pos )--] == 0 ) { diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index 2b6b145f9..d1efbbd2c 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -936,9 +936,10 @@ Word16 ivas_spar_chk_zero_coefs_fx( ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; /*Q0*/ move16(); - FOR( b = 0; b < min( hMdDec->spar_md.num_bands, SPAR_DIRAC_SPLIT_START_BAND ); b++ ) + Word16 min_bands = s_min( hMdDec->spar_md.num_bands, SPAR_DIRAC_SPLIT_START_BAND ); + FOR( b = 0; b < min_bands; b++ ) { - FOR( j = 0; j < sub( add( ndm, ndec ), 1 ); j++ ) + FOR( j = 0; j < ( ( ndm + ndec ) - 1 ); j++ ) { if ( hMdDec->spar_md.band_coeffs[b].pred_re_fx[j] != 0 ) { @@ -948,7 +949,7 @@ Word16 ivas_spar_chk_zero_coefs_fx( } FOR( j = 0; j < ndec; j++ ) { - FOR( k = 0; k < sub( ndm, 1 ); k++ ) + FOR( k = 0; k < ( ndm - 1 ); k++ ) { if ( hMdDec->spar_md.band_coeffs[b].C_re_fx[j][k] != 0 ) { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 15885a661..4d50ba350 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -585,7 +585,8 @@ static void stereo_dft_generate_comfort_noise_fx( ptr_r = DFT[chan] + add( hFdCngCom->stopFFTbin, i_mult( k, STEREO_DFT32MS_N_MAX ) ); /* q_dft */ ptr_i = ptr_r + 1; - FOR( i = 0; i < ( min( output_frame, hFdCngCom->regularStopBand * 16 ) - hFdCngCom->stopFFTbin ) / 2; i++ ) + Word16 len = shr( ( sub( s_min( output_frame, i_mult( hFdCngCom->regularStopBand, 16 ) ), hFdCngCom->stopFFTbin ) ), 1 ); + FOR( i = 0; i < len; i++ ) { /* Real part in FFT bins */ rand_gauss_fx( ptr_r, &st->hTdCngDec->cng_seed, q_dft ); @@ -622,7 +623,8 @@ static void stereo_dft_generate_comfort_noise_fx( ptr_r = DFT[chan] + add( hFdCngCom->stopFFTbin, i_mult( k, STEREO_DFT32MS_N_MAX ) ); /* q_dft */ ptr_i = ptr_r + 1; - FOR( i = 0; i < ( min( output_frame, hFdCngCom->regularStopBand * 16 ) - hFdCngCom->stopFFTbin ) / 2; i++ ) + tmp = shr( sub( s_min( output_frame, i_mult( hFdCngCom->regularStopBand, 16 ) ), hFdCngCom->stopFFTbin ), 1 ); + FOR( i = 0; i < tmp; i++ ) { ( *ptr_r ) = L_shl( Mpy_32_32( ( *ptr_r ), tmp32_1 ), q_shift ); /* q_dft + q_shift */ move32(); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index c806f358a..8dcc7ada9 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -1522,6 +1522,7 @@ void stereo_dft_dec_fx( Word16 q_samp_ratio = Q15; move16(); #endif /* OPT_STEREO_32KBPS_V1 */ + Word16 len; output_frame = (Word16) Mpy_32_32( L_add( st0->output_Fs, FRAMES_PER_SEC_BY_2 ), ONE_BY_FRAMES_PER_SEC_Q31 ); /* Q0 */ @@ -1890,7 +1891,8 @@ void stereo_dft_dec_fx( DFT_R[2 * i + 1] = L_sub( DFT_W, DFT_Y ); /* qDFT */ move32(); } - FOR( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + len = s_min( stop, hStereoDft->band_limits[b + 1] ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { DFT_W = Madd_32_32( Mpy_32_32( hStereoDft->mixer_mat_smooth_fx[0][0][b + k * IVAS_MAX_NUM_BANDS], pDFT_DMX[2 * i] ), L_add( hStereoDft->mixer_mat_smooth_fx[0][1][b + k * IVAS_MAX_NUM_BANDS], @@ -1997,7 +1999,8 @@ void stereo_dft_dec_fx( } ELSE { - FOR( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + len = s_min( stop, hStereoDft->band_limits[b + 1] ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { tmp = L_add( Madd_32_16( pDFT_RES[2 * i], pDFT_DMX[2 * i], g ), DFT_PRED_RES[2 * i] ); /* qDFT */ @@ -2218,8 +2221,8 @@ void stereo_dft_dec_fx( gamma = 0; move16(); } - - FOR( i = max( hFdCngDec->cna_band_limits[b], ( hFdCngCom->startBand / 2 ) ); i < min( hFdCngDec->cna_band_limits[b + 1], ( L_FRAME16k ) >> 1 ); i++ ) + len = s_min( hFdCngDec->cna_band_limits[b + 1], ( L_FRAME16k ) >> 1 ); + FOR( i = s_max( hFdCngDec->cna_band_limits[b], ( hFdCngCom->startBand >> 1 ) ); i < len; i++ ) // i < min( hFdCngDec->cna_band_limits[b + 1], ( L_FRAME16k ) >> 1 ); { Word32 l_tmp; lev1 = *ptr_per++; @@ -2597,6 +2600,7 @@ void stereo_dft_generate_res_pred_fx( q_norm_fac = 0; move16(); #endif /* OPT_STEREO_32KBPS_V1 */ + Word16 len; push_wmops( "gen_respred" ); /* smoothing and limiting parameters */ @@ -2665,7 +2669,8 @@ void stereo_dft_generate_res_pred_fx( move64(); /* calculate band energies (low band only in case of ACELP) */ - FOR( i = hStereoDft->band_limits[b]; i < min( hStereoDft->band_limits[b + 1], bin0 ); i++ ) + len = s_min( hStereoDft->band_limits[b + 1], bin0 ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { #ifdef OPT_STEREO_32KBPS_V1 dmx_nrg_64bit = W_mac_32_32( W_mac_32_32( dmx_nrg_64bit, pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), @@ -2847,7 +2852,8 @@ void stereo_dft_generate_res_pred_fx( } #endif /* OPT_STEREO_32KBPS_V1 */ - FOR( i = hStereoDft->band_limits[b]; i < min( hStereoDft->band_limits[b + 1], bin0 ); i++ ) + len = s_min( hStereoDft->band_limits[b + 1], bin0 ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { #ifdef OPT_STEREO_32KBPS_V1 DFT_PRED_RES[2 * i] = L_shl( Mpy_32_32( Mpy_32_16_1( pPredGain[b], norm_fac ), ap_filt_DMX[2 * i] ), 1 ); /* q_dft */ @@ -2969,7 +2975,8 @@ void stereo_dft_generate_res_pred_fx( move32(); dmx_nrg = EPSILON_FIX; move32(); - FOR( i = hStereoDft->band_limits[b]; i < min( bin0, hStereoDft->band_limits[b + 1] ); i++ ) + len = s_min( bin0, hStereoDft->band_limits[b + 1] ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { dmx_nrg = Madd_32_32( Madd_32_32( dmx_nrg, pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), pDFT_DMX[2 * i + 1], pDFT_DMX[2 * i + 1] ); /* 2 * q_dft - 31 */ @@ -3010,8 +3017,8 @@ void stereo_dft_generate_res_pred_fx( q_sqrt = 0; move16(); } - - FOR( i = hStereoDft->band_limits[b]; i < min( bin0, hStereoDft->band_limits[b + 1] ); i++ ) + len = s_min( bin0, hStereoDft->band_limits[b + 1] ); + FOR( i = hStereoDft->band_limits[b]; i < len; i++ ) { DFT_PRED_RES[2 * i] = L_shl( Mpy_32_32( g2, DFT_PRED_RES[2 * i] ), q_sqrt ); /* q_dft */ move32(); @@ -3068,7 +3075,8 @@ void stereo_dft_generate_res_pred_fx( // past_dmx_nrg = EPSILON_FIX; past_dmx_nrg = 0; move32(); - FOR( i = bin0; i < min( ( hStereoDft->NFFT / 2 ), ( STEREO_DFT32MS_N_32k / 2 ) ); i++ ) + len = s_min( shr( hStereoDft->NFFT, 1 ), ( STEREO_DFT32MS_N_32k >> 1 ) ); + FOR( i = bin0; i < len; i++ ) // i < min( ( hStereoDft->NFFT / 2 ), ( hStereoDft->NFFT / 2 ) ) { past_dmx_nrg = L_add( past_dmx_nrg, Madd_32_32( Mpy_32_32( hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i], hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i] ), hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1], hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1] ) ); /* 2 * hStereoDft->q_DFT_past_DMX_fx[d_short_ind] - 31 */ } @@ -3129,7 +3137,8 @@ void stereo_dft_generate_res_pred_fx( } q_shift = sub( hStereoDft->q_dft, hStereoDft->q_DFT_past_DMX_fx[d_short_ind] ); move16(); - FOR( i = max( hStereoDft->band_limits[b], bin0 ); i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ); i++ ) + len = s_min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k >> 1 ); + FOR( i = s_max( hStereoDft->band_limits[b], bin0 ); i < len; i++ ) // i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ) { DFT_PRED_RES[2 * i] = L_shl( Mpy_32_32( g2, hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i] ), q_shift ); /* q_dft */ move32(); @@ -3243,7 +3252,8 @@ void stereo_dft_generate_res_pred_fx( move32(); dmx_nrg = EPSILON_FIX; move32(); - FOR( i = max( hStereoDft->band_limits[b], bin0 ); i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ); i++ ) + len = s_min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k >> 1 ); + FOR( i = s_max( hStereoDft->band_limits[b], bin0 ); i < len; i++ ) // i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ) { dmx_nrg = L_add( dmx_nrg, L_shr( Madd_32_32( Mpy_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), pDFT_DMX[2 * i + 1], pDFT_DMX[2 * i + 1] ), 1 ) ); /* 2 * q_dft - 31 - 1 */ @@ -3269,8 +3279,8 @@ void stereo_dft_generate_res_pred_fx( g2 = L_min( Mpy_32_16_1( pred_gain_avg, STEREO_DFT_STEFFI_GAIN_AMP_FX ), Madd_32_16( Mpy_32_16_1( pred_gain_avg, sub( (Word16) ( 0x7FFF ), STEREO_DFT_STEFFI_GAIN_REST_AMT_FX ) ), g2, STEREO_DFT_STEFFI_GAIN_REST_AMT_FX ) ); /* Q31 */ - - FOR( i = max( hStereoDft->band_limits[b], bin0 ); i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ); i++ ) + len = s_min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k >> 1 ); + FOR( i = s_max( hStereoDft->band_limits[b], bin0 ); i < len; i++ ) // i < min( hStereoDft->band_limits[b + 1], STEREO_DFT32MS_N_32k / 2 ) { DFT_PRED_RES[2 * i] = Mpy_32_32( g2, DFT_PRED_RES[2 * i] ); /* Q31 */ move32(); diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 1e8bef488..44439540f 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1341,8 +1341,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /* Init current 2-tuple encoding */ - a1 = (Word16) abs( x[a1_i] ); - b1 = (Word16) abs( x[b1_i] ); + a1 = abs_s( x[a1_i] ); + b1 = abs_s( x[b1_i] ); lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); @@ -1731,7 +1731,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( /* Main Loop through the 2-tuples */ /*hContextMem->nt_half = end_line >> 1;*/ - FOR( k = start_line; k < min( hContextMem->lastnz, end_line ); k += 2 ) + Word16 len = s_min( hContextMem->lastnz, end_line ); + FOR( k = start_line; k < len; k += 2 ) { a1_i = k; /* Q0 */ move16(); diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 307d42078..2db8b956b 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -3039,7 +3039,7 @@ void FdCngEncodeMDCTStereoSID_fx( /* quantize channel coherence */ coh_idx = mult_r( sts[0]->hFdCngEnc->hFdCngCom->coherence_fx, 15 ); - coh_idx = max( 0, min( coh_idx, 15 ) ); + coh_idx = s_max( 0, s_min( coh_idx, 15 ) ); /* ---- Write SID bitstream ---- */ diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index 37d25c508..104eeb998 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -623,7 +623,7 @@ void ivas_agc_enc_process_fx( temp_16 = BASOP_Util_Divide3232_Scale( temp1, temp2, &div_e ); /* exp(div_e) */ IF( div_e < 0 ) { - temp_16 = shr( temp_16, (Word16) abs( div_e ) ); + temp_16 = shr( temp_16, abs_s( div_e ) ); div_e = 0; move16(); } diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index a9da7f342..73403a848 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -184,7 +184,7 @@ ivas_error pre_proc_ivas_fx( } IF( st->hFdCngEnc != NULL && NE_16( st->element_mode, IVAS_CPE_MDCT ) && ( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->input_bwidth ) ) ) ) { - configureFdCngEnc_ivas_fx( st->hFdCngEnc, max( st->input_bwidth, WB ), flag_1 ); + configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), flag_1 ); } if ( st->ini_frame == 0 ) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 811e53d12..a9d62a2b0 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -856,7 +856,7 @@ ivas_error ivas_cpe_enc_fx( } ELSE { - internal_Fs = max( INT_FS_16k, sts[0]->sr_core ); + internal_Fs = L_max( INT_FS_16k, sts[0]->sr_core ); } /* iDFT at input sampling rate */ diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 3eeb45d14..c65c85356 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -493,7 +493,7 @@ ivas_error ivas_init_encoder( if ( NE_32( ivas_format, MONO_FORMAT ) ) { /* In IVAS, ensure that minimum coded bandwidth is WB */ - hEncoderConfig->max_bwidth = max( hEncoderConfig->max_bwidth, WB ); /* Q0 */ + hEncoderConfig->max_bwidth = s_max( hEncoderConfig->max_bwidth, WB ); /* Q0 */ move16(); } st_ivas->ism_mode = ISM_MODE_NONE; diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index 86237fb31..11056b535 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -170,17 +170,17 @@ static void ivas_lfe_enc_quant_fx( { temp_lfe_dct[4 * i] = pLfe_dct[2 * i]; move32(); - lfe_abs_sum = W_add( lfe_abs_sum, abs( temp_lfe_dct[4 * i] ) ); + lfe_abs_sum = W_add( lfe_abs_sum, L_abs( temp_lfe_dct[4 * i] ) ); temp_lfe_dct[4 * i + 1] = pLfe_dct[2 * i + 1]; move32(); - lfe_abs_sum = W_add( lfe_abs_sum, abs( temp_lfe_dct[4 * i + 1] ) ); + lfe_abs_sum = W_add( lfe_abs_sum, L_abs( temp_lfe_dct[4 * i + 1] ) ); temp_lfe_dct[4 * i + 2] = pLfe_dct[2 * i + num_dct_pass_bins]; move32(); - lfe_abs_sum = W_add( lfe_abs_sum, abs( temp_lfe_dct[4 * i + 2] ) ); + lfe_abs_sum = W_add( lfe_abs_sum, L_abs( temp_lfe_dct[4 * i + 2] ) ); temp_lfe_dct[4 * i + 3] = pLfe_dct[2 * i + num_dct_pass_bins + 1]; move32(); - lfe_abs_sum = W_add( lfe_abs_sum, abs( temp_lfe_dct[4 * i + 3] ) ); + lfe_abs_sum = W_add( lfe_abs_sum, L_abs( temp_lfe_dct[4 * i + 3] ) ); } IF( LE_64( lfe_abs_sum, W_shr( IVAS_LFE_ABS_SUM_FLT_THR_Q42, sub( 42, q_pLfe_dct ) ) ) ) @@ -250,9 +250,9 @@ static void ivas_lfe_enc_quant_fx( move16(); } - IF( LT_32( max_of_vals, abs( values[i] ) ) ) + IF( LT_32( max_of_vals, abs_s( values[i] ) ) ) { - max_of_vals = (Word16) abs( values[i] ); + max_of_vals = abs_s( values[i] ); move16(); } } @@ -475,8 +475,8 @@ void ivas_lfe_enc_fx( IF( GT_16( q_out1, q_out2 ) ) { - Scale_sig32( lfe_dct_fx + num_dct_pass_bins, num_dct_pass_bins, min( q_tmp2, sub( q_out1, q_out2 ) ) ); - q_out2 = add( q_out2, min( q_tmp2, sub( q_out1, q_out2 ) ) ); + Scale_sig32( lfe_dct_fx + num_dct_pass_bins, num_dct_pass_bins, s_min( q_tmp2, sub( q_out1, q_out2 ) ) ); + q_out2 = add( q_out2, s_min( q_tmp2, sub( q_out1, q_out2 ) ) ); IF( GT_16( q_out1, q_out2 ) ) { Scale_sig32( lfe_dct_fx, num_dct_pass_bins, sub( q_out2, q_out1 ) ); // q_out2 @@ -486,8 +486,8 @@ void ivas_lfe_enc_fx( } ELSE IF( LT_16( q_out1, q_out2 ) ) { - Scale_sig32( lfe_dct_fx, num_dct_pass_bins, min( q_tmp1, sub( q_out2, q_out1 ) ) ); - q_out1 = add( q_out1, min( q_tmp1, sub( q_out2, q_out1 ) ) ); + Scale_sig32( lfe_dct_fx, num_dct_pass_bins, s_min( q_tmp1, sub( q_out2, q_out1 ) ) ); + q_out1 = add( q_out1, s_min( q_tmp1, sub( q_out2, q_out1 ) ) ); IF( LT_16( q_out1, q_out2 ) ) { Scale_sig32( lfe_dct_fx + num_dct_pass_bins, num_dct_pass_bins, sub( q_out1, q_out2 ) ); // q_out1 diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index 9060c786b..abd09cbbd 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -201,7 +201,7 @@ ivas_error ivas_mc_paramupmix_enc_open_fx( /* still 1.5ms off, since MCT delay is not large enough */ /* param at end of frame */ fb_cfg->prior_input_length = (Word16) ( NS2SA_FX2( input_Fs, 12000000L ) + NS2SA_FX2( input_Fs, DELAY_FB_4_NS / 2 ) - input_frame / 2 - NS2SA_FX2( input_Fs, DELAY_FB_1_NS / 2 ) ); - fb_cfg->prior_input_length = (Word16) max( fb_cfg->prior_input_length, input_frame / MAX_PARAM_SPATIAL_SUBFRAMES ); + fb_cfg->prior_input_length = s_max( fb_cfg->prior_input_length, (Word16) input_frame / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Allocate and initialize FB mixer handle */ IF( NE_32( ( error = ivas_FB_mixer_open_fx( &( hMCParamUpmix->hFbMixer ), input_Fs, fb_cfg, 0 ) ), IVAS_ERR_OK ) ) @@ -496,12 +496,12 @@ static void quantize_pars_fx( Word16 exp_var1 = 0; move16(); Word32 var1 = BASOP_Util_Add_Mant32Exp( v_fx[iv], exp_v, L_negate( data_fx[iq0] ), 31 - Q28, &exp_var1 ); - var1 = abs( var1 ); + var1 = L_abs( var1 ); Word16 exp_var2 = 0; move16(); Word32 var2 = BASOP_Util_Add_Mant32Exp( v_fx[iv], exp_v, L_negate( data_fx[iq1] ), 31 - Q28, &exp_var2 ); - var2 = abs( var2 ); + var2 = L_abs( var2 ); Word16 cmp_2 = BASOP_Util_Cmp_Mant32Exp( var1, exp_var1, var2, exp_var2 ); @@ -591,12 +591,12 @@ static void quantize_beta_fx( Word16 exp_var1 = 0; move16(); Word32 var1 = BASOP_Util_Add_Mant32Exp( beta_fx[iv], exp_beta, L_negate( quant_table_fx.data[iq0] ), 31 - Q28, &exp_var1 ); - var1 = abs( var1 ); + var1 = L_abs( var1 ); Word16 exp_var2 = 0; move16(); Word32 var2 = BASOP_Util_Add_Mant32Exp( beta_fx[iv], exp_beta, L_negate( quant_table_fx.data[iq1] ), 31 - Q28, &exp_var2 ); - var2 = abs( var2 ); + var2 = L_abs( var2 ); Word16 cmp_2 = BASOP_Util_Cmp_Mant32Exp( var1, exp_var1, var2, exp_var2 ); diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 648dcdb73..1229624de 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -300,7 +300,7 @@ ivas_error ivas_osba_enc_reconfig( } } - ivas_spar_config_fx( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); + ivas_spar_config_fx( ivas_total_brate, s_min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); hSpar = st_ivas->hSpar; diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 7a2a28767..3416ab279 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -4089,7 +4089,8 @@ static ivas_error requantize_direction_EC_3_fx( IF( LE_16( allowed_bits, add( no_subframes, 1 ) ) ) { - FOR( k = 0; k < min( no_subframes, allowed_bits ); k++ ) + Word16 len = s_min( no_subframes, allowed_bits ); + FOR( k = 0; k < len; k++ ) { push_next_indice( hMetaData, q_direction->band_data[j].azimuth_index[k], 1 ); } diff --git a/lib_enc/ivas_sba_enc_fx.c b/lib_enc/ivas_sba_enc_fx.c index 86427eb2d..8fdca5815 100644 --- a/lib_enc/ivas_sba_enc_fx.c +++ b/lib_enc/ivas_sba_enc_fx.c @@ -199,7 +199,7 @@ ivas_error ivas_sba_enc_reconfigure_fx( } } - ivas_spar_config_fx( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); + ivas_spar_config_fx( ivas_total_brate, s_min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); hSpar = st_ivas->hSpar; diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index 7900033f4..862102d3b 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -547,7 +547,8 @@ static Word32 calc_mean_E_ratio_fx( sum_nrg_R_e = 0; move16(); - FOR( i = band_limits[b]; i < min( band_limits[b + 1], STEREO_DFT_N_32k_ENC / 2 ); i++ ) + Word16 len = s_min( band_limits[b + 1], STEREO_DFT_N_32k_ENC >> 1 ); + FOR( i = band_limits[b]; i < len; i++ ) { // sum_xcorr[0] += hItd->xcorr_smooth[2 * i]; sum_xcorr[0] = BASOP_Util_Add_Mant32Exp( sum_xcorr[0], sum_xcorr_e[0], hItd->xcorr_smooth_fx[2 * i], hItd->xcorr_smooth_fx_e[2 * i], &sum_xcorr_e[0] ); @@ -2568,7 +2569,11 @@ void stereo_dft_enc_compute_itd_fx( prev_itd_max = hItd->hybrid_itd_max; move16(); /* enable hybrid ITD handling for very large ITDs*/ - hItd->hybrid_itd_max = ( abs( itd ) > STEREO_DFT_ITD_MAX && abs( itd ) < STEREO_DFT_ITD_MAX_ANA && !hCPE->hCoreCoder[0]->sp_aud_decision0 && hCPE->element_brate < IVAS_32k ); + // hItd->hybrid_itd_max = ( abs_s( itd ) > STEREO_DFT_ITD_MAX && abs_s( itd ) < STEREO_DFT_ITD_MAX_ANA && !hCPE->hCoreCoder[0]->sp_aud_decision0 && hCPE->element_brate < IVAS_32k ); + test(); + test(); + test(); + hItd->hybrid_itd_max = ( GT_16( abs_s( itd ), STEREO_DFT_ITD_MAX ) && LT_16( abs_s( itd ), STEREO_DFT_ITD_MAX_ANA ) && !hCPE->hCoreCoder[0]->sp_aud_decision0 && LT_32( hCPE->element_brate, IVAS_32k ) ); move16(); /* Update memory */ hItd->prev_itd = itd; diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index a3388db61..c3cb68719 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -1203,7 +1203,7 @@ static Word32 find_poc_peak_fx( /*compute peak_range*/ tmp1 = idiv1616( hPOC->shift_limit, STEREO_DMX_EVS_FIND_POC_PEAK_TAU ); - peak_range = idiv1616( add( extract_l( abs( itd_cand[n] ) ), tmp1 ), STEREO_DMX_EVS_FIND_POC_PEAK_TAU2 ); // Q0 + peak_range = idiv1616( add( extract_l( abs_s( itd_cand[n] ) ), tmp1 ), STEREO_DMX_EVS_FIND_POC_PEAK_TAU2 ); // Q0 FOR( i = 1; i <= peak_range; i++ ) { @@ -1250,7 +1250,7 @@ static Word32 find_poc_peak_fx( IF( on[n] ) /*if channel n was active (likely to be preceding) in the previous frame*/ { tmp13_e = 0, tmp15_e = 0; - tmp13 = BASOP_Util_Divide1616_Scale( (Word16) abs( itd_cand[n] ), hPOC->shift_limit, &tmp13_e ); + tmp13 = BASOP_Util_Divide1616_Scale( abs_s( itd_cand[n] ), hPOC->shift_limit, &tmp13_e ); tmp14 = L_mult( 6554 /*0.2f Q15*/, tmp13 ); // tmp13_e tmp15 = BASOP_Util_Add_Mant32Exp( 644245120 /*0.75f in Q31*/, 0, L_negate( tmp14 ), tmp13_e, &tmp15_e ); tmp15 = Mpy_32_32( tmp15, peakQ_fx[n] ); // tmp15_e + peakQ_e[n] @@ -1299,7 +1299,7 @@ static Word32 find_poc_peak_fx( tmp13_e = 0, tmp15_e = 0; move16(); move16(); - tmp13 = BASOP_Util_Divide1616_Scale( (Word16) abs( itd_cand[n] ), hPOC->shift_limit, &tmp13_e ); + tmp13 = BASOP_Util_Divide1616_Scale( abs_s( itd_cand[n] ), hPOC->shift_limit, &tmp13_e ); tmp14 = L_mult( 6554 /*0.2f Q15*/, tmp13 ); // tmp13_e tmp15 = BASOP_Util_Add_Mant32Exp( 1610612736 /*0.75f in Q31*/, 0, L_negate( tmp14 ), tmp13_e, &tmp15_e ); diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 351b87cd0..78c324cce 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1737,7 +1737,7 @@ void stereo_tca_enc_fx( prev_ICA_flag = 0; move16(); test(); - if ( hCPE->hStereoTD->prev_fr_LRTD_TD_dec && abs( hStereoTCA->prevCorrLagStats[2] ) != 0 ) + if ( hCPE->hStereoTD->prev_fr_LRTD_TD_dec && abs_s( hStereoTCA->prevCorrLagStats[2] ) != 0 ) { prev_ICA_flag = 1; move16(); @@ -1924,7 +1924,7 @@ void stereo_tca_enc_fx( /* Note!! : Always keep the assert (prevNCShift>>1) below according to the equation used here to get tempS */ tempS = shr( currentNCShift, 1 ); /* Q0 */ - IF( LE_32( abs( sub( currentNCShift, prevNCShift ) ), L_min( N_MAX_SHIFT_CHANGE, Mpy_32_32( imult3216( input_Fs, N_MAX_SHIFT_CHANGE ), 67109 /* 1/32000.0f in Q31*/ ) ) ) ) + IF( LE_32( abs_s( sub( currentNCShift, prevNCShift ) ), L_min( N_MAX_SHIFT_CHANGE, Mpy_32_32( imult3216( input_Fs, N_MAX_SHIFT_CHANGE ), 67109 /* 1/32000.0f in Q31*/ ) ) ) ) { adjustTargetSignal_fx( ( target_fx - tempS ), prevNCShift, currentNCShift, L_shift_adapt, 0 ); } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index f3ceb2757..6513a3fa7 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -241,7 +241,7 @@ ivas_error stereo_memory_enc_fx( IF( hCPE->hStereoTCA != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { #ifdef FIX_1132_STACK_CORRUPTION - Word16 tmp = extract_h( abs( hCPE->hStereoDft->hItd->itd_fx[1] ) ); + Word16 tmp = extract_h( L_abs( hCPE->hStereoDft->hItd->itd_fx[1] ) ); if ( hCPE->hStereoDft->hItd->itd_fx[1] < 0 ) { tmp = negate( tmp ); diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 4ea5c5e96..32803f6c3 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -949,8 +949,8 @@ void ivas_dirac_dec_decorr_process_fx( h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = add( h_freq_domain_decorr_ap_state->q_reverb_energy_smooth, q_shift ); move16(); } - h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); - h_freq_domain_decorr_ap_state->q_direct_energy_smooth = min( MAX_Q_FX, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); + 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 ); #endif e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 45ab2e68a..e01b27767 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -4331,7 +4331,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->num_protos_diff, hDirACRend->proto_index_diff, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport ), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * s_min( 4, nchan_transport ), &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, onset_filter_fx, hDirACRend->h_freq_domain_decorr_ap_params, diff --git a/lib_rend/ivas_reverb_filter_design_fx.c b/lib_rend/ivas_reverb_filter_design_fx.c index 652fc898f..45e492fc8 100644 --- a/lib_rend/ivas_reverb_filter_design_fx.c +++ b/lib_rend/ivas_reverb_filter_design_fx.c @@ -740,7 +740,7 @@ void ivas_reverb_calc_color_levels_fx( Word16 temp = 0, result_e = 0; move16(); move16(); - cos_w = getCosWord16R2( (Word16) abs( L_shl( Mpy_32_32( pFc[freq_idx], fs_inverted ), 3 ) ) ); // q = 15 + cos_w = getCosWord16R2( (Word16) L_abs( L_shl( Mpy_32_32( pFc[freq_idx], fs_inverted ), 3 ) ) ); // q = 15 H_filter = L_add( L_shr( L_add( L_shr( Mpy_32_32( coefB[0], coefB[0] ), 1 ), L_shr( Mpy_32_32( coefB[1], coefB[1] ), 1 ) ), 2 ), L_shr( Mpy_32_32( coefB[0], Mpy_32_32( coefB[1], L_shl( cos_w, 15 ) ) ), 1 ) ); // q = 28 H_filter = BASOP_Util_Divide3232_Scale_cadence( H_filter, L_add( ONE_IN_Q28, L_shr( L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) ), 1 ) ), &temp ); H_filter = Sqrt32( H_filter, &temp ); @@ -1155,9 +1155,9 @@ void ivas_reverb_get_hrtf_set_properties_fx( IA_coherence[freq_idx] = L_shl( IA_coherence[freq_idx], sub( 27, sub( 15, temp ) ) ); // q = 27 move32(); /* Limiting to (0...1) range in case of small numerical errors or negative values */ - IA_coherence[freq_idx] = min( IA_coherence[freq_idx], ONE_IN_Q27 ); // Q27 + IA_coherence[freq_idx] = L_min( IA_coherence[freq_idx], ONE_IN_Q27 ); // Q27 move32(); - IA_coherence[freq_idx] = max( IA_coherence[freq_idx], 0 ); // Q27 + IA_coherence[freq_idx] = L_max( IA_coherence[freq_idx], 0 ); // Q27 move32(); } diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index 7ad4c4ccb..8b352218b 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -399,7 +399,7 @@ void rotateAziEle_fx( angle = extract_l( L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), 24 ) ); // Q0 } - *azi = s_max( -180, min( 180, angle ) ); + *azi = s_max( -180, s_min( 180, angle ) ); move16(); IF( isPlanar == 0 ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ef5d5602c..ac856e90c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1177,8 +1177,8 @@ static Word8 checkObjectPositionChanged_fx( IVAS_ISM_METADATA *previousPos ) { test(); - return !( LT_32( abs( L_sub( currentPos->azimuth_fx, previousPos->azimuth_fx ) ), EPSILLON_FX ) && - LT_32( abs( L_sub( currentPos->elevation_fx, previousPos->elevation_fx ) ), EPSILLON_FX ) ); + return !( LT_32( L_abs( L_sub( currentPos->azimuth_fx, previousPos->azimuth_fx ) ), EPSILLON_FX ) && + LT_32( L_abs( L_sub( currentPos->elevation_fx, previousPos->elevation_fx ) ), EPSILLON_FX ) ); } static rendering_context getRendCtx( @@ -2018,7 +2018,7 @@ static ivas_error updateMcPanGainsForAmbiOut( Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); - IF( GE_32( abs( temp ), ONE_IN_Q29 ) ) + IF( GE_32( L_abs( temp ), ONE_IN_Q29 ) ) { IF( temp > 0 ) { @@ -2066,7 +2066,7 @@ static ivas_error updateMcPanGainsForAmbiOut( { Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); - IF( GE_32( abs( temp ), ONE_IN_Q29 ) ) + IF( GE_32( L_abs( temp ), ONE_IN_Q29 ) ) { IF( temp > 0 ) { @@ -4537,7 +4537,7 @@ static void renderBufferChannelLerp_fx( /* Process current output channel only if applying non-zero gains */ test(); test(); - IF( GT_32( abs( currentGain ), EPSILON_FX ) || ( gainsPrev != NULL && GT_32( abs( previousGain ), EPSILON_FX ) ) ) + IF( GT_32( L_abs( currentGain ), EPSILON_FX ) || ( gainsPrev != NULL && GT_32( L_abs( previousGain ), EPSILON_FX ) ) ) { /* Reset input pointer to the beginning of input channel */ inSmpl = getSmplPtr_fx( inAudio, inChannelIdx, 0 ); @@ -4546,7 +4546,7 @@ static void renderBufferChannelLerp_fx( outSmpl = getSmplPtr_fx( outAudio, outChnlIdx, 0 ); test(); - IF( gainsPrev == NULL || LE_32( abs( L_sub( L_shr( previousGain, 1 ), L_shr( currentGain, 1 ) ) ), EPSILON_FX ) ) + IF( gainsPrev == NULL || LE_32( L_abs( L_sub( L_shr( previousGain, 1 ), L_shr( currentGain, 1 ) ) ), EPSILON_FX ) ) { /* If no interpolation from previous frame, apply current gain */ DO -- GitLab From b256bc0a153fda00da0b897433978c75e8b05616 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 10:45:15 +0530 Subject: [PATCH 059/358] Fix for 3GPP issue 1347: Saturation of energies memory for dtx path Link #1347 --- lib_enc/ivas_core_pre_proc_front_fx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index f41eb7f9c..46de4e232 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1016,14 +1016,14 @@ ivas_error pre_proc_front_ivas_fx( Word16 msNoiseEst_Q = Q31; move16(); move16(); - zero_flag = get_zero_flag( st->hFdCngEnc->msNoiseEst_fx, NPART ); + zero_flag = get_zero_flag( st->hFdCngEnc->msNoiseEst_old_fx, NPART ); IF( zero_flag ) { - msNoiseEst_Q = getScaleFactor32( st->hFdCngEnc->msNoiseEst_fx, NPART ); + msNoiseEst_Q = getScaleFactor32( st->hFdCngEnc->msNoiseEst_old_fx, NPART ); + scale_sig32( st->hFdCngEnc->msNoiseEst_old_fx, NPART, msNoiseEst_Q ); /* exp(st->hFdCngEnc->msNoiseEst_old_fx_exp - msNoiseEst_Q) */ + st->hFdCngEnc->msNoiseEst_old_fx_exp = sub( st->hFdCngEnc->msNoiseEst_old_fx_exp, msNoiseEst_Q ); + move16(); } - Scale_sig32( st->hFdCngEnc->msNoiseEst_old_fx, NPART, msNoiseEst_Q ); /* exp(st->hFdCngEnc->msNoiseEst_old_fx_exp - msNoiseEst_Q) */ - st->hFdCngEnc->msNoiseEst_fx_exp = sub( st->hFdCngEnc->msNoiseEst_old_fx_exp, msNoiseEst_Q ); - move16(); perform_noise_estimation_enc_ivas_fx( band_energies_LR_fx, sub( Q31, band_energies_LR_fx_q ), enerBuffer_fx, *enerBuffer_fx_exp, st->hFdCngEnc, input_Fs, hCPE ); } ELSE @@ -1049,14 +1049,14 @@ ivas_error pre_proc_front_ivas_fx( move16(); Word16 msNoiseEst_Q = Q31; move16(); - zero_flag = get_zero_flag( st->hFdCngEnc->msNoiseEst_fx, NPART ); /* Q0 */ + zero_flag = get_zero_flag( st->hFdCngEnc->msNoiseEst_old_fx, NPART ); /* Q0 */ IF( zero_flag ) { - msNoiseEst_Q = getScaleFactor32( st->hFdCngEnc->msNoiseEst_fx, NPART ); + msNoiseEst_Q = getScaleFactor32( st->hFdCngEnc->msNoiseEst_old_fx, NPART ); + scale_sig32( st->hFdCngEnc->msNoiseEst_old_fx, NPART, msNoiseEst_Q ); /* exp(st->hFdCngEnc->msNoiseEst_old_fx_exp - msNoiseEst_Q) */ + st->hFdCngEnc->msNoiseEst_old_fx_exp = sub( st->hFdCngEnc->msNoiseEst_old_fx_exp, msNoiseEst_Q ); + move16(); } - Scale_sig32( st->hFdCngEnc->msNoiseEst_old_fx, NPART, msNoiseEst_Q ); /* exp(st->hFdCngEnc->msNoiseEst_old_fx_exp - msNoiseEst_Q) */ - st->hFdCngEnc->msNoiseEst_fx_exp = sub( st->hFdCngEnc->msNoiseEst_old_fx_exp, msNoiseEst_Q ); - move16(); zero_flag = get_zero_flag( st->hFdCngEnc->hFdCngCom->periodog, PERIODOGLEN ); /* Q0 */ Word16 normmsperiodog = 31; move16(); -- GitLab From 7f96d717a09ef05b48d3a5634b87f05a77a275a9 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 11:49:53 +0530 Subject: [PATCH 060/358] ASAN issue fix for decoder --- lib_dec/evs_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index aa997d4c0..f20ff77f3 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -36,7 +36,7 @@ ivas_error evs_dec_fx( Word16 exp, fra; Word16 tmp_buffer_fx[L_FRAME48k]; Word16 tmp16, tmp16_2; - Word16 synth_fx[L_FRAME48k]; + Word16 synth_fx[L_FRAME48k + HQ_DELTA_MAX * HQ_DELAY_COMP]; Word16 fb_exc_fx[L_FRAME16k]; Word16 pitch_buf_fx[NB_SUBFR16k] = { 0 }; Word16 Q_fb_exc; -- GitLab From 3dbd470196b657f34d7819c75903e28c051dfd83 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 14:58:16 +0530 Subject: [PATCH 061/358] Fix for LTV crash issue Fix for LTV crash : 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM IR out, random FER at 5% --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 00f372154..191065855 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3807,7 +3807,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 + *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } -- GitLab From c57cb88294ea3b9fcb94bc3e574592e903c4a79e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 10 Mar 2025 08:43:15 +0100 Subject: [PATCH 062/358] use long testvectors for USAN tests too --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 58547f2ab..cb532dd7d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1307,7 +1307,7 @@ ivas-pytest-enc-usan: before_script: - CLANG_NUM=3 - DUT_DECODER_PATH=./$REF_DECODER_PATH - - TEST_SUITE=$SHORT_TEST_SUITE_ENCODER + - TEST_SUITE=$LONG_TEST_SUITE_ENCODER <<: *ivas-pytest-sanitizers-anchor ### jobs that test flt encoder -> fx decoder @@ -1397,7 +1397,7 @@ ivas-pytest-dec-usan: before_script: - CLANG_NUM=3 - DUT_ENCODER_PATH=./$REF_ENCODER_PATH - - TEST_SUITE=$SHORT_TEST_SUITE + - TEST_SUITE=$LONG_TEST_SUITE_NO_RENDERER <<: *ivas-pytest-sanitizers-anchor # --------------------------------------------------------------- -- GitLab From f3550e69001068f3187efececff2be68d883b353 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 12 Mar 2025 10:45:04 +0100 Subject: [PATCH 063/358] Fix issue 1378 (invalid read access) --- lib_com/options.h | 1 + lib_dec/dec_acelp_fx.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index d03261715..5d1d0d6e1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,5 +171,6 @@ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ +#define FIX_1378_ACELP_OUT_OF_BOUNDS /* Avoid index -1 in array read access */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ #endif diff --git a/lib_dec/dec_acelp_fx.c b/lib_dec/dec_acelp_fx.c index 07750469f..51cbef624 100644 --- a/lib_dec/dec_acelp_fx.c +++ b/lib_dec/dec_acelp_fx.c @@ -169,6 +169,7 @@ void D_ACELP_indexing_fx( pulses = pulsestrack[0]; move16(); +#ifndef FIX_1378_ACELP_OUT_OF_BOUNDS /* safety check in case of bit errors */ IF( GE_64( s, pulsestostates[16][pulses - 1] ) ) { @@ -177,9 +178,20 @@ void D_ACELP_indexing_fx( move16(); return; } +#endif IF( pulses ) { +#ifdef FIX_1378_ACELP_OUT_OF_BOUNDS + /* safety check in case of bit errors */ + IF( GE_64( s, pulsestostates[16][pulses - 1] ) ) + { + set16_fx( code, 0, L_SUBFR ); + *BER_detect = 1; + move16(); + return; + } +#endif D_ACELP_decode_arithtrack_fx( code, s, pulses, num_tracks, 16 ); } ELSE -- GitLab From 6d695dc9fe2671871299db840c95b1b32a326336 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 11:15:44 +0100 Subject: [PATCH 064/358] preparation for the cleanup. --- lib_enc/ivas_sns_enc_fx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 3ae1ea424..808de8cfd 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -204,7 +204,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -236,11 +236,15 @@ static Word16 sns_1st_cod_fx_q15( { Word32 tmp; Word32 dist; + Word16 tmp2; + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 dist = L_sub( snsq_fx[j], tmp ); - dist = L_shr( dist, 4 ); // TODO: Magic shift. - dist = L_mult( extract_l( dist ), extract_l( dist ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + + tmp2 = extract_l( dist ); + dist = L_mult( tmp2, tmp2 ); + dist = L_shr( dist, 4 ); // make sure that the sum does not overflow dist_fx = L_add( dist_fx, dist ); } @@ -256,7 +260,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 j = j0; j < j1; ++j ) { Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( *cdbk_ptr++ , cdbk_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } -- GitLab From d2f9e30ea388691d3fa7cd5a5965df84900ef8a0 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 11:53:54 +0100 Subject: [PATCH 065/358] merge candiate. --- lib_enc/ivas_sns_enc_fx.c | 376 +++++++++++++++++++------------------- 1 file changed, 184 insertions(+), 192 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 808de8cfd..15768d392 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -60,221 +60,214 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - Word16 index, i; - const Word16 split_len = M / 2; - move16(); - const Word16 *means; - const Word16 means_fix = 2; // Q15 - move16(); - /* remove means */ - means = NULL; - SWITCH( L_frame ) + IF( exp_sns == Q15) { - case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; - break; - case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; - break; - case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; - break; - default: - assert( !"illegal frame length in sns_1st_cod" ); - } - Word16 exp_snsq_buffer[M] = { 0 }, exp_snsq = 0; - move16(); - move16(); - FOR( i = 0; i < M; ++i ) - { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 - exp_snsq_buffer[i] = 0; + Word16 index; + const Word16 split_len = M / 2; move16(); - snsq_fx[i] = BASOP_Util_Add_Mant32Exp( sns_fx[i], exp_sns, L_negate( tmp ), 15, &exp_snsq_buffer[i] ); - move32(); - } - FOR( i = 0; i < M; i++ ) - { - exp_snsq = s_max( exp_snsq_buffer[i], exp_snsq ); - } - FOR( i = 0; i < M; i++ ) - { - snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); - move32(); - } - - index = 0; - move16(); - FOR( Word16 split = 0; split < 2; ++split ) - { - const Word16 *cdbk_ptr; - Word16 j0, j1, index_split; - Word32 dist_min_fx; - const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + const Word16 *means; + const Word16 means_fix = 2; // Q15 move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - - j0 = imult1616( split, split_len ); - j1 = add( j0, split_len ); - - cdbk_ptr = cdbk; - dist_min_fx = MAXVAL_WORD32; - Word16 exp_dist_min = 31; - index_split = 0; - FOR( i = 0; i < 32; ++i ) + /* remove means */ + means = NULL; + SWITCH( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + FOR( Word16 i = 0; i < M; ++i ) { - Word32 dist_fx = 0; + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); - Word16 exp_dist = 0; + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1; + Word16 dist_split; + Word32 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); - FOR( Word16 j = j0; j < j1; ++j ) + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = MAXVAL_WORD32; + dist_split = 0; + move32(); + move16(); + FOR( Word16 i = 0; i < 32; ++i ) { - Word32 tmp_fx; - Word16 exp_tmp = 0; - move16(); - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - tmp_fx = BASOP_Util_Add_Mant32Exp( snsq_fx[j], exp_snsq, L_negate( tmp_1 ), 15, &exp_tmp ); - Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 - dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 + Word32 dist_fx = 0; + move32(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp; + Word32 dist; + Word16 tmp2; + + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + dist = L_sub( snsq_fx[j], tmp ); + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + + tmp2 = extract_l( dist ); + dist = L_mult( tmp2, tmp2 ); + dist = L_shr( dist, 4 ); // make sure that the sum does not overflow + dist_fx = L_add( dist_fx, dist ); + } + + IF( LT_32( dist_fx, dist_min_fx ) ) + { + dist_min_fx = dist_fx; + dist_split = i; + } } - - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + FOR( Word16 j = j0; j < j1; ++j ) { - dist_min_fx = dist_fx; + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); - exp_dist_min = exp_dist; - move16(); - index_split = i; - move16(); } + + /* for second split shift by five bits to store both indices as one 10 bit value */ + if ( EQ_16( split, 1 ) ) + { + dist_split = shl( dist_split, 5 ); + } + + index = add( index, dist_split ); } - - /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; - FOR( Word16 j = j0; j < j1; ++j ) + return index; + } ELSE { + Word16 index, i; + const Word16 split_len = M / 2; + move16(); + const Word16 *means; + const Word16 means_fix = 2; // Q15 + move16(); + /* remove means */ + means = NULL; + SWITCH( L_frame ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + Word16 exp_snsq_buffer[M] = { 0 }, exp_snsq = 0; + move16(); + move16(); + FOR( i = 0; i < M; ++i ) + { + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + exp_snsq_buffer[i] = 0; + move16(); + snsq_fx[i] = BASOP_Util_Add_Mant32Exp( sns_fx[i], exp_sns, L_negate( tmp ), 15, &exp_snsq_buffer[i] ); move32(); } - - /* for second split shift by five bits to store both indices as one 10 bit value */ - IF( EQ_16( split, 1 ) ) + FOR( i = 0; i < M; i++ ) { - index_split = shl( index_split, 5 ); + exp_snsq = s_max( exp_snsq_buffer[i], exp_snsq ); } - - index = add( index, index_split ); - } - - return index; -} - -static Word16 sns_1st_cod_fx_q15( - const Word32 *sns_fx, /* i : vector to quantize */ - const Word16 L_frame, - const Word16 core, - Word32 *snsq_fx /* o : quantized sns Q16 */ -) -{ - Word16 index; - const Word16 split_len = M / 2; - move16(); - const Word16 *means; - const Word16 means_fix = 2; // Q15 - push_wmops( "sns_1st_cod_fx_q15" ); - move16(); - /* remove means */ - means = NULL; - SWITCH( L_frame ) - { - case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; - break; - case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; - break; - case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; - break; - default: - assert( !"illegal frame length in sns_1st_cod" ); - } - FOR( Word16 i = 0; i < M; ++i ) - { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 - move32(); - } - - index = 0; - move16(); - FOR( Word16 split = 0; split < 2; ++split ) - { - const Word16 *cdbk_ptr; - Word16 j0, j1; - Word16 dist_split; - Word32 dist_min_fx; - const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 - move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - - j0 = imult1616( split, split_len ); - j1 = add( j0, split_len ); - - cdbk_ptr = cdbk; - dist_min_fx = MAXVAL_WORD32; - dist_split = 0; - move32(); - move16(); - FOR( Word16 i = 0; i < 32; ++i ) + FOR( i = 0; i < M; i++ ) { - Word32 dist_fx = 0; + snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); move32(); + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1, index_split; + Word32 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + move16(); + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = MAXVAL_WORD32; + Word16 exp_dist_min = 31; + index_split = 0; + FOR( i = 0; i < 32; ++i ) + { + Word32 dist_fx = 0; + move32(); + Word16 exp_dist = 0; + move16(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp_fx; + Word16 exp_tmp = 0; + move16(); + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + tmp_fx = BASOP_Util_Add_Mant32Exp( snsq_fx[j], exp_snsq, L_negate( tmp_1 ), 15, &exp_tmp ); + Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 + dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 + } + + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) + { + dist_min_fx = dist_fx; + move32(); + exp_dist_min = exp_dist; + move16(); + index_split = i; + move16(); + } + } + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp; - Word32 dist; - Word16 tmp2; - - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - - tmp2 = extract_l( dist ); - dist = L_mult( tmp2, tmp2 ); - dist = L_shr( dist, 4 ); // make sure that the sum does not overflow - dist_fx = L_add( dist_fx, dist ); + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + move32(); } - - IF( LT_32( dist_fx, dist_min_fx ) ) + + /* for second split shift by five bits to store both indices as one 10 bit value */ + IF( EQ_16( split, 1 ) ) { - dist_min_fx = dist_fx; - dist_split = i; + index_split = shl( index_split, 5 ); } + + index = add( index, index_split ); } - - /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; - FOR( Word16 j = j0; j < j1; ++j ) - { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 - move32(); - } - - /* for second split shift by five bits to store both indices as one 10 bit value */ - if ( EQ_16( split, 1 ) ) - { - dist_split = shl( dist_split, 5 ); - } - - index = add( index, dist_split ); + + return index; } - pop_wmops(); - return index; } /*------------------------------------------------------------------- @@ -382,7 +375,7 @@ void sns_avq_cod_fx( Word16 indxt[256], nbits, nbt, nit; Word32 snsmid_q0_fx[M]; - index[0] = sns_1st_cod_fx_q15( sns_fx, L_frame, core, sns_q_fx ); + index[0] = sns_1st_cod_fx( sns_fx, exp_sns, L_frame, core, sns_q_fx ); move16(); nit = 1 + 2; move16(); @@ -409,8 +402,7 @@ void sns_avq_cod_fx( { index++; - index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); - // index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From 662acc0a60da5e09d9250445e76ef9fe3be8a655 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 12:01:43 +0100 Subject: [PATCH 066/358] applied the clang patch. --- lib_enc/ivas_sns_enc_fx.c | 48 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 0fccc8ec8..a7435fb0d 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == Q15) + IF( exp_sns == Q15 ) { Word16 index; const Word16 split_len = M / 2; @@ -86,10 +86,10 @@ static Word16 sns_1st_cod_fx( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } - + index = 0; move16(); FOR( Word16 split = 0; split < 2; ++split ) @@ -101,10 +101,10 @@ static Word16 sns_1st_cod_fx( const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - + j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); - + cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; dist_split = 0; @@ -119,44 +119,46 @@ static Word16 sns_1st_cod_fx( Word32 tmp; Word32 dist; Word16 tmp2; - + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); + dist = L_sub( snsq_fx[j], tmp ); dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - + tmp2 = extract_l( dist ); dist = L_mult( tmp2, tmp2 ); dist = L_shr( dist, 4 ); // make sure that the sum does not overflow dist_fx = L_add( dist_fx, dist ); } - + IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; dist_split = i; } } - + /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } - + /* for second split shift by five bits to store both indices as one 10 bit value */ if ( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } - + index = add( index, dist_split ); } return index; - } ELSE { + } + ELSE + { Word16 index, i; const Word16 split_len = M / 2; move16(); @@ -199,7 +201,7 @@ static Word16 sns_1st_cod_fx( snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); move32(); } - + index = 0; move16(); FOR( Word16 split = 0; split < 2; ++split ) @@ -210,10 +212,10 @@ static Word16 sns_1st_cod_fx( const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - + j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); - + cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; Word16 exp_dist_min = 31; @@ -234,7 +236,7 @@ static Word16 sns_1st_cod_fx( Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 } - + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) { dist_min_fx = dist_fx; @@ -245,7 +247,7 @@ static Word16 sns_1st_cod_fx( move16(); } } - + /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) @@ -255,16 +257,16 @@ static Word16 sns_1st_cod_fx( snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } - + /* for second split shift by five bits to store both indices as one 10 bit value */ IF( EQ_16( split, 1 ) ) { index_split = shl( index_split, 5 ); } - + index = add( index, index_split ); } - + return index; } } -- GitLab From fd36d42e8e350de67c728f270289f0d2f6599be2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 10:13:00 +0530 Subject: [PATCH 067/358] Fix for 3GPP issue 1140: Missing conversion of some flt. pt. functions in the BASOP code Link #1140 --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 191065855..00f372154 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3807,7 +3807,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 + *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } -- GitLab From 8fb270faafd8c23f732c12345f308bf57e478807 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 14:58:16 +0530 Subject: [PATCH 068/358] Fix for LTV crash issue Fix for LTV crash : 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM IR out, random FER at 5% --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 00f372154..191065855 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3807,7 +3807,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 + *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } -- GitLab From 3e71800d6b502833d646d3214ebfe8a1a66efa39 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 09:48:48 +0530 Subject: [PATCH 069/358] Fix for 3GPP issue 1037: Wrong variable type used in the fixed-point code - 1 Link #1037 --- lib_com/cng_exc_fx.c | 2 +- lib_com/cnst.h | 6 +- lib_com/common_api_types.h | 50 +- lib_com/fft_evs.c | 2 +- lib_com/ivas_cnst.h | 10 +- lib_com/ivas_rom_com_fx.c | 24 +- lib_com/ivas_spar_com_fx.c | 8 +- lib_com/ivas_stat_com.h | 250 +++---- lib_com/ivas_tools_fx.c | 6 +- lib_com/longarith.c | 44 +- lib_com/lsf_dec_bfi_fx.c | 2 +- lib_com/mslvq_com.c | 6 +- lib_com/parameter_bitmaping_fx.c | 26 +- lib_com/prot_fx.h | 6 +- lib_com/rom_basop_util.c | 2 +- lib_com/rom_com.h | 2 +- lib_com/stat_com.h | 13 +- lib_dec/FEC_clas_estim_fx.c | 2 +- lib_dec/acelp_core_switch_dec_fx.c | 1 - lib_dec/core_switching_dec_fx.c | 2 +- lib_dec/dec_uv_fx.c | 22 +- lib_dec/er_dec_acelp_fx.c | 2 +- lib_dec/ivas_binRenderer_internal_fx.c | 4 +- lib_dec/ivas_dirac_dec_fx.c | 2 +- lib_dec/ivas_ism_param_dec_fx.c | 6 +- lib_dec/ivas_jbm_dec_fx.c | 26 +- lib_dec/ivas_mc_param_dec_fx.c | 10 +- lib_dec/ivas_rom_dec.c | 44 +- lib_dec/ivas_rom_dec.h | 16 +- lib_dec/ivas_spar_md_dec_fx.c | 10 +- lib_dec/ivas_stat_dec.h | 524 +++++++-------- lib_dec/ivas_stereo_switching_dec_fx.c | 8 +- lib_dec/ivas_svd_dec_fx.c | 1 - lib_dec/jbm_jb4sb.h | 2 +- lib_dec/jbm_pcmdsp_apa.h | 8 +- lib_dec/jbm_pcmdsp_window.h | 2 +- lib_enc/amr_wb_enc_fx.c | 2 +- lib_enc/avq_cod_fx.c | 12 +- lib_enc/core_enc_init_fx.c | 8 +- lib_enc/core_enc_reconf_fx.c | 2 +- lib_enc/enc_acelp_fx.c | 4 +- lib_enc/ivas_ism_metadata_enc_fx.c | 2 +- lib_enc/ivas_mcmasa_enc_fx.c | 2 +- lib_enc/ivas_mct_enc_fx.c | 2 +- lib_enc/ivas_mdct_core_enc_fx.c | 2 +- lib_enc/ivas_qmetadata_enc_fx.c | 6 +- lib_enc/ivas_sns_enc_fx.c | 10 +- lib_enc/ivas_spar_md_enc_fx.c | 2 +- lib_enc/ivas_stereo_dft_enc_fx.c | 6 +- lib_enc/ivas_stereo_td_enc_fx.c | 3 +- lib_enc/lib_enc.c | 64 +- lib_enc/lib_enc.h | 64 +- lib_enc/lsf_enc_fx.c | 4 +- lib_enc/lsf_msvq_ma_enc.c | 2 +- lib_enc/prot_fx_enc.h | 24 +- lib_enc/stat_enc.h | 624 +++++++++--------- lib_enc/swb_bwe_enc_fx.c | 2 +- lib_enc/swb_pre_proc_fx.c | 2 +- lib_enc/tcx_utils_enc_fx.c | 6 +- lib_enc/transient_detection_fx.c | 6 +- .../ivas_dirac_dec_binaural_functions_fx.c | 22 +- lib_rend/ivas_dirac_decorr_dec_fx.c | 4 +- lib_rend/ivas_reverb_fx.c | 32 +- lib_rend/ivas_rom_binaural_crend_head.h | 180 ++--- lib_rend/ivas_rom_binaural_crend_head_fx.c | 180 ++--- lib_rend/ivas_rom_rend_fx.c | 20 +- lib_rend/lib_rend.h | 2 +- 67 files changed, 1215 insertions(+), 1237 deletions(-) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 3eab0b1f5..4153afa32 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -47,7 +47,7 @@ void CNG_exc_fx( Word16 *cng_ener_seed1, Word16 exc3[], /*Q_exc*/ Word16 Opt_AMR_WB, - const int16_t element_mode /* i : IVAS Element mode */ + const Word16 element_mode /* i : IVAS Element mode */ ) { Word16 i, tmp, tmp2, exp, exp2, Q_ener; diff --git a/lib_com/cnst.h b/lib_com/cnst.h index bc2ae8403..4e14b310d 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -239,7 +239,7 @@ enum{ #define L_FRAME48k_EXT 1200 /* Extended MDCT frame size in samples at 48kHz */ /* Conversion of ns to samples for a given sampling frequency */ -#define NS2SA( fs, x ) ( int16_t )( ( ( ( int32_t )( fs ) / 100L ) * ( ( x ) / 100L ) ) / 100000L ) +#define NS2SA( fs, x ) ( Word16 )( ( ( ( Word32 )( fs ) / 100L ) * ( ( x ) / 100L ) ) / 100000L ) #define NRG_CHANGE_E 8 #define AVG_FLAT_E 8 #define ACTIVE_FRAME 0xFF @@ -1175,7 +1175,6 @@ enum #define NBITS_NOISE_FILL_LEVEL 3 /* Number of bits used for coding noise filling level for each range */ #define NF_GAIN_BITS ( NBITS_TCX_GAIN + NOISE_FILL_RANGES * NBITS_NOISE_FILL_LEVEL ) #define MIN_NOISE_FILLING_HOLE 8 -#define HOLE_SIZE_FROM_LTP_FLT( gain ) ( 4 + ( int16_t )( 2.0f * gain * ( 4.0f / 0.625f ) ) ) #define HOLE_SIZE_FROM_LTP( gain ) (add(4, extract_h(L_shr(L_mult0(gain, 0x6666), 10)))) /* gain (Q15), 0x6666 = 2.0*(4.0/0.625) (4Q11) */ #define HOLE_SIZE_FROM_LTP32( gain ) (add(4, extract_h(L_shr(Mpy_32_32(gain, 0x66666667), 11)))) /* gain (Q31), 0x66666667 = 2.0*(4.0/0.625) (4Q27) */ @@ -1472,7 +1471,7 @@ enum #define cbitsnew 16 #define stat_bitsnew 14 -#define ari_q4new ( ( (int32_t) 1 << cbitsnew ) - 1 ) +#define ari_q4new ( ( (Word32) 1 << cbitsnew ) - 1 ) #define ari_q1new ( ari_q4new / 4 + 1 ) #define ari_q2new ( 2 * ari_q1new ) #define ari_q3new ( 3 * ari_q1new ) @@ -1954,7 +1953,6 @@ typedef enum _DCTTYPE #define N_SMC_MIXTURES 6 /* number of mixtures */ #define N_PCA_COEF 12 /* number of PCA components */ #define HALF_N_PCA_COEF_LOG_P12_Q18 2890731 //Q18 of (0.5f * N_PCA_COEF *logf( PI2 )) -#define SMC_ST_MEAN_FACT 0.5 /* forgetting factor of short-term IIR mean filter */ #define SMC_ST_MEAN_RSHIFT_FACT_FX 1 /* SMC_ST_MEAN_FACT equivalent right shift factor */ #define M_LSP_SPMUS 6 /* number of LSPs used in speech/music classifier */ diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 553a34f56..bc6fd4f1a 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -108,9 +108,9 @@ typedef enum _IVAS_ENC_FEC_INDICATOR typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG { - int16_t channelAwareModeEnabled; + Word16 channelAwareModeEnabled; IVAS_ENC_FEC_INDICATOR fec_indicator; - int16_t fec_offset; + Word16 fec_offset; } IVAS_ENC_CHANNEL_AWARE_CONFIG; @@ -130,7 +130,7 @@ typedef struct _IVAS_ISM_METADATA float gainFactor; float yaw; float pitch; - int16_t non_diegetic_flag; + Word16 non_diegetic_flag; } IVAS_ISM_METADATA; @@ -183,29 +183,29 @@ typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; typedef struct _IVAS_LS_CUSTOM_LAYOUT { - int16_t num_spk; + Word16 num_spk; float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; float elevation[IVAS_MAX_OUTPUT_CHANNELS]; Word32 azimuth_fx[IVAS_MAX_OUTPUT_CHANNELS]; // Q22 Word32 elevation_fx[IVAS_MAX_OUTPUT_CHANNELS]; // Q22 - int16_t num_lfe; - int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; + Word16 num_lfe; + Word16 lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; } IVAS_CUSTOM_LS_DATA; typedef struct _IVAS_JBM_TRACE_DATA { - uint32_t systemTimestamp_ms; - uint16_t extBufferedSamples; - uint16_t lastDecodedWasActive; - int32_t output_Fs; - int16_t dataUnit_flag; - uint16_t sequenceNumber; - uint32_t timeStamp; - uint32_t rcvTime; - - int16_t partial_frame; - int16_t partialCopyOffset; + UWord32 systemTimestamp_ms; + UWord16 extBufferedSamples; + UWord16 lastDecodedWasActive; + Word32 output_Fs; + Word16 dataUnit_flag; + UWord16 sequenceNumber; + UWord32 timeStamp; + UWord32 rcvTime; + + Word16 partial_frame; + Word16 partialCopyOffset; } IVAS_JBM_TRACE_DATA; @@ -217,8 +217,8 @@ typedef struct _IVAS_JBM_TRACE_DATA typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { - int16_t override; - int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ + Word16 override; + Word16 nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ @@ -231,12 +231,12 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG Word32 inputPreDelay_fx; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ /* Assumed Q-27*/ /* early reflections */ - int16_t use_er; /* ER activation flag */ - int32_t lowComplexity; /* Low complexity ER flag */ - IVAS_VECTOR3 dimensions; /* Room dimensions [m] */ - float AbsCoeff[IVAS_ROOM_ABS_COEFF]; /* Absorption coeffs */ - IVAS_VECTOR3 ListenerOrigin; /* Listener origin */ - int32_t AbsCoeff_fx[IVAS_ROOM_ABS_COEFF]; /* Absorption coeffs */ + Word16 use_er; /* ER activation flag */ + Word32 lowComplexity; /* Low complexity ER flag */ + IVAS_VECTOR3 dimensions; /* Room dimensions [m] */ + float AbsCoeff[IVAS_ROOM_ABS_COEFF]; /* Absorption coeffs */ + IVAS_VECTOR3 ListenerOrigin; /* Listener origin */ + Word32 AbsCoeff_fx[IVAS_ROOM_ABS_COEFF]; /* Absorption coeffs */ } IVAS_ROOM_ACOUSTICS_CONFIG_DATA; diff --git a/lib_com/fft_evs.c b/lib_com/fft_evs.c index e53404f0b..94c2dea8f 100644 --- a/lib_com/fft_evs.c +++ b/lib_com/fft_evs.c @@ -505,7 +505,7 @@ static void fft15_with_cmplx_data( cmplx *inp_data /*Qx*/ ) */ void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ) { - int i; + Word16 i; if ( s == 2 ) { fft16_with_cmplx_data( (cmplx *) re, bScale ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 6612fac1f..2abb790f1 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1440,12 +1440,12 @@ typedef enum _COV_SMOOTHING_TYPE } COV_SMOOTHING_TYPE; typedef struct { - const int32_t *value; - const uint16_t *length; + const Word32 *value; + const UWord16 *length; } HUFF_TAB; typedef struct { - int32_t value[81]; + Word32 value[81]; unsigned short length[81]; } HUFF_ELEMENTS; @@ -1467,8 +1467,8 @@ typedef struct { typedef struct { - const int16_t (*alpha)[2]; - const int16_t (*beta)[2]; + const Word16 (*alpha)[2]; + const Word16 (*beta)[2]; } HUFF_NODE_TABLE; /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 8ea2b91e4..a7a8bdcbf 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1617,23 +1617,23 @@ const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBAND }; /* Multi-channel input and output setups */ -const int16_t ls_azimuth_CICP2_idx[2] = { 1, 2 }; -const int16_t ls_elevation_CICP2_idx[2] = { 0, 0 }; +const Word16 ls_azimuth_CICP2_idx[2] = { 1, 2 }; +const Word16 ls_elevation_CICP2_idx[2] = { 0, 0 }; -const int16_t ls_azimuth_CICP6_idx[5] = { 1, 2, 0, 7, 8 }; -const int16_t ls_elevation_CICP6_idx[5] = { 0, 0, 0, 0, 0 }; +const Word16 ls_azimuth_CICP6_idx[5] = { 1, 2, 0, 7, 8 }; +const Word16 ls_elevation_CICP6_idx[5] = { 0, 0, 0, 0, 0 }; -const int16_t ls_azimuth_CICP12_idx[7] = { 1, 2, 0, 7, 8, 9, 10 }; -const int16_t ls_elevation_CICP12_idx[7] = { 0, 0, 0, 0, 0, 0, 0 }; +const Word16 ls_azimuth_CICP12_idx[7] = { 1, 2, 0, 7, 8, 9, 10 }; +const Word16 ls_elevation_CICP12_idx[7] = { 0, 0, 0, 0, 0, 0, 0 }; -const int16_t ls_azimuth_CICP14_idx[7] = { 1, 2, 0, 7, 8, 1, 2 }; -const int16_t ls_elevation_CICP14_idx[7] = { 0, 0, 0, 0, 0, 3, 4 }; +const Word16 ls_azimuth_CICP14_idx[7] = { 1, 2, 0, 7, 8, 1, 2 }; +const Word16 ls_elevation_CICP14_idx[7] = { 0, 0, 0, 0, 0, 3, 4 }; -const int16_t ls_azimuth_CICP16_idx[9] = { 1, 2, 0, 7, 8, 1, 2, 7, 8 }; -const int16_t ls_elevation_CICP16_idx[9] = { 0, 0, 0, 0, 0, 3, 3, 3, 3 }; +const Word16 ls_azimuth_CICP16_idx[9] = { 1, 2, 0, 7, 8, 1, 2, 7, 8 }; +const Word16 ls_elevation_CICP16_idx[9] = { 0, 0, 0, 0, 0, 3, 3, 3, 3 }; -const int16_t ls_azimuth_CICP19_idx[11] = { 1, 2, 0, 9, 10, 5, 6, 1, 2, 9, 10 }; -const int16_t ls_elevation_CICP19_idx[11] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3 }; +const Word16 ls_azimuth_CICP19_idx[11] = { 1, 2, 0, 9, 10, 5, 6, 1, 2, 9, 10 }; +const Word16 ls_elevation_CICP19_idx[11] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3 }; const Word32 shoebox_sin_cos_tbl_fx[11][2] = { { 0, 1073741824 }, // 0 { 536870912, 929887680 }, diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 6c80c1898..96df64aa5 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -3807,7 +3807,7 @@ void ivas_compute_spar_params_fx( { Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - Word16 b, i, ndm; + Word16 b, i, ndm, j; Word16 q_pred_coeffs; ivas_get_pred_coeffs_fx( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, active_w_vlbr, dtx_vad, from_dirac, dyn_active_w_flag, hSparMd->res_ind, &q_pred_coeffs, q_dm_fv_re ); @@ -3869,7 +3869,7 @@ void ivas_compute_spar_params_fx( #ifdef MSAN_FIX FOR( i = 0; i < ( num_ch - ndm ); i++ ) { - FOR( Word16 j = 0; j < sub( ndm, 1 ); j++ ) + FOR( j = 0; j < sub( ndm, 1 ); j++ ) { hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].C_re_fx[i][j], sub( q_tmp, 22 ) ); // q22 move32(); @@ -3878,7 +3878,7 @@ void ivas_compute_spar_params_fx( #else for ( i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++ ) { - for ( int j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++ ) + for ( j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++ ) { hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub( q_tmp, 22 ) ); } @@ -3891,7 +3891,7 @@ void ivas_compute_spar_params_fx( q_tmp = hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].q_P_re_fx; move16(); - FOR( Word16 j = 0; j < sub( IVAS_SPAR_MAX_CH, 1 ); j++ ) + FOR( j = 0; j < sub( IVAS_SPAR_MAX_CH, 1 ); j++ ) { hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].P_re_fx[j] = L_shr( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].P_re_fx[j], sub( q_tmp, 22 ) ); // q22 move32(); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 249d1e963..fb11d3934 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -46,18 +46,18 @@ typedef struct { - int16_t last_angle1_idx; /* last frame index of coded azimuth/yaw */ - int16_t angle1_diff_cnt; /* FEC counter of consecutive differentially azimuth/yaw coded frames */ - int16_t last_angle2_idx; /* last frame index of coded elevation/pitch */ - int16_t angle2_diff_cnt; /* FEC counter of consecutive differentially elevation/pitch coded frames */ + Word16 last_angle1_idx; /* last frame index of coded azimuth/yaw */ + Word16 angle1_diff_cnt; /* FEC counter of consecutive differentially azimuth/yaw coded frames */ + Word16 last_angle2_idx; /* last frame index of coded elevation/pitch */ + Word16 angle2_diff_cnt; /* FEC counter of consecutive differentially elevation/pitch coded frames */ } ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { - int16_t ism_metadata_flag; /* flag whether metadata are coded in particular frame of particular object */ - int16_t last_ism_metadata_flag; /* last frame ism_metadata_flag */ + Word16 ism_metadata_flag; /* flag whether metadata are coded in particular frame of particular object */ + Word16 last_ism_metadata_flag; /* last frame ism_metadata_flag */ Word32 azimuth_fx; /* azimuth value read from the input metadata file */ /* Q22 */ Word32 elevation_fx; /* elevation value read from the input metadata file */ /* Q22 */ @@ -65,25 +65,25 @@ typedef struct Word32 yaw_fx; /* yaw value read from the input metadata file */ /* Q22 */ Word32 pitch_fx; /* pitch value read from the input metadata file */ /* Q22 */ - int16_t non_diegetic_flag; /* Non-diegetic (non-headtracked) object flag */ + Word16 non_diegetic_flag; /* Non-diegetic (non-headtracked) object flag */ ISM_METADATA_ANGLE position_angle; /* Angle structs for azimuth and elevation */ ISM_METADATA_ANGLE orientation_angle; /* Angle structs for yaw and pitch */ - int16_t last_radius_idx; /* last frame index of coded radius */ - int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ + Word16 last_radius_idx; /* last frame index of coded radius */ + Word16 radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ Word32 last_azimuth_fx; /* MD smoothing in DTX- last Q azimuth value */ /* Q22 */ Word32 last_elevation_fx; /* MD smoothing in DTX - last Q elevation value */ /* Q22 */ Word32 last_true_azimuth_fx; /* MD smoothing in DTX- last true Q azimuth value */ /* Q22 */ Word32 last_true_elevation_fx; /* MD smoothing in DTX- last true Q elevation value */ /* Q22 */ - int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ - int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ - Word16 last_true_radius_fx; /* last true Q radius value */ + Word16 ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ + Word16 ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ + Word16 last_true_radius_fx; /* last true Q radius value */ - int16_t ism_imp; /* ISM importance flag */ - int16_t ism_md_null_flag; - int16_t ism_md_lowrate_flag; + Word16 ism_imp; /* ISM importance flag */ + Word16 ism_md_null_flag; + Word16 ism_md_lowrate_flag; Word32 q_azimuth_old_fx; Word32 q_elevation_old_fx; @@ -96,15 +96,15 @@ typedef struct typedef struct stereo_dft_config_data_struct { - int16_t dmx_active; - int16_t band_res; - int16_t prm_res; /* Send prm every # DFT frames */ - int16_t res_pred_mode; /* mode : from 0 (off) to 1 (on) */ - int16_t res_cod_mode; /* mode : from 0 (off) to 3 */ - int16_t hybrid_itd_flag; - int16_t ada_wb_res_cod_mode; /* res_cod_mode for adaptive wide band residual coding */ + Word16 dmx_active; + Word16 band_res; + Word16 prm_res; /* Send prm every # DFT frames */ + Word16 res_pred_mode; /* mode : from 0 (off) to 1 (on) */ + Word16 res_cod_mode; /* mode : from 0 (off) to 3 */ + Word16 hybrid_itd_flag; + Word16 ada_wb_res_cod_mode; /* res_cod_mode for adaptive wide band residual coding */ - int16_t force_mono_transmission; + Word16 force_mono_transmission; } STEREO_DFT_CONFIG_DATA, *STEREO_DFT_CONFIG_DATA_HANDLE; @@ -115,20 +115,20 @@ typedef struct stereo_dft_config_data_struct typedef struct { - uint8_t const bandLengthsTCX20[SMDCT_MAX_STEREO_BANDS_TCX20]; /* Length of a band in number of bins. Range is 4..160 */ - const int16_t bdnCnt_TCX20[4]; /* uppermost band for FB,SWB,WB,NB */ - uint8_t const bandLengthsTCX10[SMDCT_MAX_STEREO_BANDS_TCX10]; /* Length of a band in number of bins. Range is 2..80, always divisible by 2 */ - const int16_t bndCnt_TCX10[4]; /* uppermost band for FB,SWB,WB,NB */ + UWord8 const bandLengthsTCX20[SMDCT_MAX_STEREO_BANDS_TCX20]; /* Length of a band in number of bins. Range is 4..160 */ + const Word16 bdnCnt_TCX20[4]; /* uppermost band for FB,SWB,WB,NB */ + UWord8 const bandLengthsTCX10[SMDCT_MAX_STEREO_BANDS_TCX10]; /* Length of a band in number of bins. Range is 2..80, always divisible by 2 */ + const Word16 bndCnt_TCX10[4]; /* uppermost band for FB,SWB,WB,NB */ } MDCTStereoBands_config; /* MDCT stereo frequency band structure */ typedef struct stereo_mdct_dec_band_parameters_struct { - int16_t sfbOffset[MAX_SFB + 1]; /* stereo frequency band start offsets */ - int16_t sfbCnt; /* number of stereo frequency bands */ - int16_t nBandsStereoCore; /* number of stereo frequency bands in the core */ - int16_t sfbIgfStart; /*index for first IGF band*/ + Word16 sfbOffset[MAX_SFB + 1]; /* stereo frequency band start offsets */ + Word16 sfbCnt; /* number of stereo frequency bands */ + Word16 nBandsStereoCore; /* number of stereo frequency bands in the core */ + Word16 sfbIgfStart; /*index for first IGF band*/ } STEREO_MDCT_BAND_PARAMETERS; @@ -139,9 +139,9 @@ typedef struct stereo_mdct_dec_band_parameters_struct typedef struct { - int16_t config_index; - int16_t encoding_active; /* internal state specifying if actual encoding is active or only length evaluation is active */ - int32_t bit_count_estimate; /* uses 22Q10 fixed-point representation */ + Word16 config_index; + Word16 encoding_active; /* internal state specifying if actual encoding is active or only length evaluation is active */ + Word32 bit_count_estimate; /* uses 22Q10 fixed-point representation */ void *ac_handle; } ECSQ_instance; @@ -153,9 +153,9 @@ typedef struct typedef struct ivas_dirac_config_data_struct { - int16_t enc_param_start_band; - int16_t dec_param_estim; - int16_t nbands; + Word16 enc_param_start_band; + Word16 dec_param_estim; + Word16 nbands; } DIRAC_CONFIG_DATA, *DIRAC_CONFIG_DATA_HANDLE; @@ -180,9 +180,9 @@ typedef struct ivas_band_coeffs_t typedef struct ivas_band_coeffs_ind_t { - int16_t pred_index_re[IVAS_SPAR_MAX_CH - 1]; - int16_t drct_index_re[IVAS_SPAR_MAX_C_COEFF]; - int16_t decd_index_re[IVAS_SPAR_MAX_CH - 1]; + Word16 pred_index_re[IVAS_SPAR_MAX_CH - 1]; + Word16 drct_index_re[IVAS_SPAR_MAX_C_COEFF]; + Word16 decd_index_re[IVAS_SPAR_MAX_CH - 1]; } ivas_band_coeffs_ind_t; @@ -192,7 +192,7 @@ typedef struct ivas_spar_md_t ivas_band_coeffs_ind_t band_coeffs_idx[IVAS_MAX_NUM_BANDS]; Word16 num_bands; Word32 min_max_fx[2]; /*q28*/ - int16_t dtx_vad; + Word16 dtx_vad; Word32 en_ratio_slow_fx[IVAS_MAX_NUM_BANDS]; Word32 ref_pow_slow_fx[IVAS_MAX_NUM_BANDS]; Word16 res_ind; @@ -210,7 +210,7 @@ typedef struct ivas_quant_coeffs_t { Word32 min_fx; /* Q28 */ Word32 max_fx; /* Q28 */ - int16_t q_levels[2]; + Word16 q_levels[2]; } ivas_quant_coeffs_t; typedef struct ivas_quant_strat_t @@ -224,23 +224,23 @@ typedef struct ivas_quant_strat_t typedef struct ivas_spar_md_com_cfg { - int16_t max_freq_per_chan[IVAS_SPAR_MAX_CH]; - int16_t num_dmx_chans_per_band[IVAS_MAX_NUM_BANDS]; - int16_t num_decorr_per_band[IVAS_MAX_NUM_BANDS]; - int16_t active_w; - int16_t remix_unmix_order; + Word16 max_freq_per_chan[IVAS_SPAR_MAX_CH]; + Word16 num_dmx_chans_per_band[IVAS_MAX_NUM_BANDS]; + Word16 num_decorr_per_band[IVAS_MAX_NUM_BANDS]; + Word16 active_w; + Word16 remix_unmix_order; ivas_quant_strat_t quant_strat[MAX_QUANT_STRATS]; - int16_t quant_strat_bits; - int16_t nchan_transport; - int16_t num_quant_strats; - int16_t prior_strat; - int16_t tgt_bits_per_blk; - int16_t max_bits_per_blk; - int16_t prev_quant_idx; - int16_t agc_bits_ch_idx; - int16_t planarCP; - int16_t num_umx_chs; - int16_t max_md_bits_spar; + Word16 quant_strat_bits; + Word16 nchan_transport; + Word16 num_quant_strats; + Word16 prior_strat; + Word16 tgt_bits_per_blk; + Word16 max_bits_per_blk; + Word16 prev_quant_idx; + Word16 agc_bits_ch_idx; + Word16 planarCP; + Word16 num_umx_chs; + Word16 max_md_bits_spar; } ivas_spar_md_com_cfg; @@ -248,26 +248,26 @@ typedef struct ivas_spar_md_com_cfg /* arithmetic coder structures */ typedef struct ivas_cell_dim_t { - int16_t dim1; - int16_t dim2; + Word16 dim1; + Word16 dim2; } ivas_cell_dim_t; typedef struct ivas_freq_models_t { - int16_t freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; - int16_t diff_freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; - int16_t vals[IVAS_MAX_QUANT_LEVELS]; - int16_t diff_vals[IVAS_MAX_QUANT_LEVELS]; - int16_t num_models; - int16_t diff_num_models; + Word16 freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; + Word16 diff_freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; + Word16 vals[IVAS_MAX_QUANT_LEVELS]; + Word16 diff_vals[IVAS_MAX_QUANT_LEVELS]; + Word16 num_models; + Word16 diff_num_models; } ivas_freq_models_t; typedef struct ivas_huff_models_t { - int16_t code_book[IVAS_MAX_QUANT_LEVELS][3]; - int16_t diff_code_book[IVAS_MAX_QUANT_LEVELS][3]; + Word16 code_book[IVAS_MAX_QUANT_LEVELS][3]; + Word16 diff_code_book[IVAS_MAX_QUANT_LEVELS][3]; } ivas_huff_models_t; @@ -275,22 +275,22 @@ typedef struct ivas_huff_models_t /* Entropy coder structures */ typedef struct ivas_huffman_cfg_t { - const int16_t *codebook; - int16_t min_len; - int16_t max_len; - int16_t sym_len; + const Word16 *codebook; + Word16 min_len; + Word16 max_len; + Word16 sym_len; } ivas_huffman_cfg_t; typedef struct ivas_arith_t { - int16_t dyn_model_bits; - const int16_t *pFreq_model; - const int16_t *pAlt_freq_models[IVAS_NUM_PROB_MODELS]; - const int16_t *vals; - int16_t cum_freq[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; - int16_t range; - int16_t num_models; + Word16 dyn_model_bits; + const Word16 *pFreq_model; + const Word16 *pAlt_freq_models[IVAS_NUM_PROB_MODELS]; + const Word16 *vals; + Word16 cum_freq[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; + Word16 range; + Word16 num_models; Word32 saved_dist_arr[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS]; /* Q15 */ } ivas_arith_t; @@ -338,18 +338,18 @@ typedef struct ivas_cov_smooth_state_t Word32 *pPrior_cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 *q_cov_real_per_band[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word16 *q_prior_cov_real_per_band[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - int16_t prior_bank_idx; + Word16 prior_bank_idx; Word32 *pSmoothing_factor_fx; /* Q31 */ - int16_t num_bins; + Word16 num_bins; } ivas_cov_smooth_state_t; typedef struct ivas_cov_smooth_cfg_t { Word32 max_update_rate_fx; /* Q31 */ - int16_t min_pool_size; - int16_t max_bands; - int16_t num_bins; + Word16 min_pool_size; + Word16 max_bands; + Word16 num_bins; } ivas_cov_smooth_cfg_t; @@ -357,20 +357,20 @@ typedef struct ivas_cov_smooth_cfg_t /* SPAR bitrate constant table structure */ typedef struct ivas_spar_br_table_t { - int32_t ivas_total_brate; - int16_t isPlanar; - int16_t sba_order; - int16_t bwidth; - int16_t fpcs; - int16_t nchan_transport; + Word32 ivas_total_brate; + Word16 isPlanar; + Word16 sba_order; + Word16 bwidth; + Word16 fpcs; + Word16 nchan_transport; ivas_spar_pmx_strings_t dmx_str; - int16_t active_w; - int16_t tmode; - int32_t core_brs[FOA_CHANNELS][3]; - int16_t q_lvls[MAX_QUANT_STRATS][NUM_MD_Q_COEFS_SET]; - int16_t td_ducking; - int16_t agc_bits_ch_idx; /* 0-3, Indicates core-coder channel index from which AGC bits have been taken from*/ - int16_t usePlanarCoeff; + Word16 active_w; + Word16 tmode; + Word32 core_brs[FOA_CHANNELS][3]; + Word16 q_lvls[MAX_QUANT_STRATS][NUM_MD_Q_COEFS_SET]; + Word16 td_ducking; + Word16 agc_bits_ch_idx; /* 0-3, Indicates core-coder channel index from which AGC bits have been taken from*/ + Word16 usePlanarCoeff; } ivas_spar_br_table_t; @@ -419,7 +419,7 @@ typedef struct ivas_masa_common_spatial_meta_struct typedef struct ivas_omasa_meta_struct { - uint8_t num_dirs; + UWord8 num_dirs; MASA_DIRECTIONAL_SPATIAL_META directional_meta[MASA_MAXIMUM_DIRECTIONS]; MASA_COMMON_SPATIAL_META common_meta; @@ -435,16 +435,16 @@ typedef struct ivas_masa_metadata_frame_struct typedef struct ivas_masa_config_struct { - uint16_t max_metadata_bits; - int16_t block_grouping[5]; - int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; - uint8_t numCodingBands; - uint8_t numTwoDirBands; - uint8_t numberOfDirections; - uint8_t joinedSubframes; - uint8_t useCoherence; - uint8_t coherencePresent; - uint8_t mergeRatiosOverSubframes; + UWord16 max_metadata_bits; + Word16 block_grouping[5]; + Word16 band_grouping[MASA_FREQUENCY_BANDS + 1]; + UWord8 numCodingBands; + UWord8 numTwoDirBands; + UWord8 numberOfDirections; + UWord8 joinedSubframes; + UWord8 useCoherence; + UWord8 coherencePresent; + UWord8 mergeRatiosOverSubframes; IVAS_FORMAT input_ivas_format; } MASA_CODEC_CONFIG; @@ -456,11 +456,11 @@ typedef struct ivas_masa_config_struct typedef struct { - int16_t nbands; - int16_t nblocks; - int16_t start_band; - uint8_t inactiveBands; - int16_t search_effort; + Word16 nbands; + Word16 nblocks; + Word16 start_band; + UWord8 inactiveBands; + Word16 search_effort; MC_LS_SETUP mc_ls_setup; } IVAS_METADATA_CONFIG; @@ -615,10 +615,10 @@ typedef struct ivas_parametric_mc_metadata_struct typedef struct ivas_lfe_window { - int16_t dct_len; - int16_t fade_len; - int16_t zero_pad_len; - int16_t full_len; + Word16 dct_len; + Word16 fade_len; + Word16 zero_pad_len; + Word16 full_len; const Word32 *pWindow_coeffs_fx; @@ -626,14 +626,14 @@ typedef struct ivas_lfe_window typedef struct ivas_lfe_freq_models { - uint16_t entropy_coder_model_fine_sg1[65]; - uint16_t entropy_coder_model_fine_sg2[33]; - uint16_t entropy_coder_model_fine_sg3[9]; - uint16_t entropy_coder_model_fine_sg4[3]; - uint16_t entropy_coder_model_coarse_sg1[33]; - uint16_t entropy_coder_model_coarse_sg2[17]; - uint16_t entropy_coder_model_coarse_sg3[5]; - uint16_t entropy_coder_model_coarse_sg4; + UWord16 entropy_coder_model_fine_sg1[65]; + UWord16 entropy_coder_model_fine_sg2[33]; + UWord16 entropy_coder_model_fine_sg3[9]; + UWord16 entropy_coder_model_fine_sg4[3]; + UWord16 entropy_coder_model_coarse_sg1[33]; + UWord16 entropy_coder_model_coarse_sg2[17]; + UWord16 entropy_coder_model_coarse_sg3[5]; + UWord16 entropy_coder_model_coarse_sg4; } ivas_lfe_freq_models; diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index e460637f7..e15db9a15 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -2970,7 +2970,7 @@ Word64 var_32_fx( Word16 q /* q : q-factor for the array */ ) { - + Word16 i; Word64 mean, var; mean = 0; @@ -2978,14 +2978,14 @@ Word64 var_32_fx( var = 0; move64(); - FOR( int i = 0; i < len; i++ ) + FOR( i = 0; i < len; i++ ) { mean = W_add( mean, x[i] ); /*q*/ } mean = mean / len; /* NOTE: No BASOP for 64 bit division q*/ - FOR( int i = 0; i < len; i++ ) + FOR( i = 0; i < len; i++ ) { var = W_add( var, Mpy_32_32( L_sub( x[i], W_extract_l( mean ) ), L_sub( x[i], W_extract_l( mean ) ) ) ); /*q + q - 31*/ } diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 8946e41aa..72a763de3 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -52,27 +52,27 @@ *--------------------------------------------------------------------*/ void longadd( - uint16_t a[], /* i/o: vector of the length lena */ - const uint16_t b[], /* i/o: vector of the length lenb */ - const int16_t lena, /* i/o: length of vector a[] */ - const int16_t lenb /* i/o: length of vector b[] */ + UWord16 a[], /* i/o: vector of the length lena */ + const UWord16 b[], /* i/o: vector of the length lenb */ + const Word16 lena, /* i/o: length of vector a[] */ + const Word16 lenb /* i/o: length of vector b[] */ ) { - int16_t h; - int32_t carry = 0; + Word16 h; + Word32 carry = 0; assert( lena >= lenb ); for ( h = 0; h < lenb; h++ ) { carry += ( (uint32_t) a[h] ) + ( (uint32_t) b[h] ); - a[h] = (uint16_t) carry; + a[h] = (UWord16) carry; carry = carry >> 16; } for ( ; h < lena; h++ ) { carry = ( (uint32_t) a[h] ) + carry; - a[h] = (uint16_t) carry; + a[h] = (UWord16) carry; carry = carry >> 16; } @@ -91,14 +91,14 @@ void longadd( *--------------------------------------------------------------------*/ void longshiftright( - uint16_t a[], /* i : vector of the length lena */ - const int16_t b, /* i : number of bit positions to shift right */ - uint16_t d[], /* o : vector of the length lend */ - int16_t lena, /* i : length of vector a[] */ - const int16_t lend /* i : length of vector d[] */ + UWord16 a[], /* i : vector of the length lena */ + const Word16 b, /* i : number of bit positions to shift right */ + UWord16 d[], /* o : vector of the length lend */ + Word16 lena, /* i : length of vector a[] */ + const Word16 lend /* i : length of vector d[] */ ) { - int16_t intb, fracb, fracb_u, k; + Word16 intb, fracb, fracb_u, k; intb = b >> 4; @@ -164,16 +164,16 @@ void longshr( *--------------------------------------------------------------------*/ void longshiftleft( - const uint16_t a[], /* i : vector of the length len */ - const int16_t b, /* i : number of bit positions to shift left */ - uint16_t d[], /* o : vector of the length len */ - const int16_t len /* i : length of vector a[] and d[] */ + const UWord16 a[], /* i : vector of the length len */ + const Word16 b, /* i : number of bit positions to shift left */ + UWord16 d[], /* o : vector of the length len */ + const Word16 len /* i : length of vector a[] and d[] */ ) { - int16_t intb; /* integer part of b */ - int16_t fracb; /* shift left value for all upper words a[k] */ - int16_t fracb_l; /* shift right value for all lower words a[k-1] */ - int16_t k = len - 1; + Word16 intb; /* integer part of b */ + Word16 fracb; /* shift left value for all upper words a[k] */ + Word16 fracb_l; /* shift right value for all lower words a[k-1] */ + Word16 k = len - 1; intb = b >> 4; fracb = b & 0xF; diff --git a/lib_com/lsf_dec_bfi_fx.c b/lib_com/lsf_dec_bfi_fx.c index 6292630af..33de5d9ac 100644 --- a/lib_com/lsf_dec_bfi_fx.c +++ b/lib_com/lsf_dec_bfi_fx.c @@ -36,7 +36,7 @@ void lsf_dec_bfi( const Word16 Last_GSC_pit_band_idx, const Word16 Opt_AMR_WB, /* i : IO flag */ const Word8 tcxonly, - const short bwidth /* i: coded bandwidth */ + const Word16 bwidth /* i: coded bandwidth */ ) { Word16 i; diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index a15b11611..6bd8026c4 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -75,10 +75,10 @@ static void make_offset_scale( void create_offset( UWord32 *offset_scale1, UWord32 *offset_scale2, - const int16_t mode, - const int16_t prediction_flag ) + const Word16 mode, + const Word16 prediction_flag ) { - int16_t tmp, tmp1; + Word16 tmp, tmp1; if ( prediction_flag == 0 ) { diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index 180275d8f..0846c618b 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -58,15 +58,15 @@ static Word16 FixedWidthEncoding( Word16 value, Word16 index ) void GetParameters( ParamsBitMap const *paramsBitMap, - const int16_t nArrayLength, + const Word16 nArrayLength, void const *pParameter, - int16_t **pStream, - int16_t *pnSize, - int16_t *pnBits ) + Word16 **pStream, + Word16 *pnSize, + Word16 *pnBits ) { - int16_t index; - int16_t iParam, nParams; - int16_t value; + Word16 index; + Word16 iParam, nParams; + Word16 value; void const *pSubStruct; assert( ( paramsBitMap != NULL ) && ( nArrayLength > 0 ) && ( pParameter != NULL ) && ( pStream != NULL ) && ( pnSize != NULL ) && ( pnBits != NULL ) ); @@ -168,14 +168,14 @@ void GetParameters_fx( void SetParameters( ParamsBitMap const *paramsBitMap, - const int16_t nArrayLength, + const Word16 nArrayLength, void *pParameter, - const int16_t **pStream, - int16_t *pnSize ) + const Word16 **pStream, + Word16 *pnSize ) { - int16_t index; - int16_t iParam, nParams; - int16_t value; + Word16 index; + Word16 iParam, nParams; + Word16 value; void *pSubStruct; assert( ( paramsBitMap != NULL ) && ( nArrayLength > 0 ) && ( pParameter != NULL ) && ( pStream != NULL ) && ( pnSize != NULL ) ); diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 9b596ca42..d0f0efb72 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -72,10 +72,6 @@ #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif -#ifndef TRUNC -#define TRUNC( x ) ( (int16_t) ( ( ( x ) >= 32767. ? 32767 : ( ( x ) <= -32768. ? -32768 : ( x ) ) ) + 0.5 ) ) -#endif - #define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) #define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) @@ -11101,7 +11097,7 @@ void init_coder_ace_plus_ivas_fx( void core_coder_reconfig_ivas_fx( Encoder_State *st, - const int32_t last_total_brate ); + const Word32 last_total_brate ); void core_coder_mode_switch_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ diff --git a/lib_com/rom_basop_util.c b/lib_com/rom_basop_util.c index c3bfc6eef..eb79cc026 100644 --- a/lib_com/rom_basop_util.c +++ b/lib_com/rom_basop_util.c @@ -1449,7 +1449,7 @@ void BASOP_getTables( const PWord16 **ptwiddle /*Q15*/, const PWord16 **sin_twid ld2_length = sub( 16 - 1 - 1, norm_s( length ) ); /* Extract sort of "eigenvalue" (the 5 left most bits) of length. */ - SWITCH( (unsigned short) L_shl( length, sub( 15, ld2_length ) ) ) + SWITCH( (UWord16) L_shl( length, sub( 15, ld2_length ) ) ) { case 0xa000: /* 640 */ move16(); diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 274a33a18..33661fb58 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -66,7 +66,7 @@ typedef struct Word16 filt_len; /* number of filter coeff. */ Word16 filt_len_fx; /* number of filter coeff. Q0 */ - uint16_t flags; /* flags from config. table */ + UWord16 flags; /* flags from config. table */ UWord16 flags_fx; /* flags from config. table Q0 */ // UNS_Word16 flags_fx; /* flags from config. table Q0 */ diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 9edc28c03..c96dcc884 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -74,7 +74,7 @@ typedef struct typedef struct { Word16 lead_sign_ind; - uint32_t index, size; + UWord32 index, size; Word16 dim, k_val; } PvqEntry; @@ -313,7 +313,7 @@ typedef struct { Word32 low; Word32 high; - uint32_t value; + UWord32 value; Word32 bits_to_follow; } Tastat; typedef struct @@ -490,15 +490,6 @@ typedef Word16 ( *TEncodeValue )( Word16 value, Word16 index ); */ typedef Word16 ( *TDecodeValue )( struct Decoder_State *st, Word16 index, Word16 *pValue ); -/** Linear prediction analysis/synthesis filter definition. - * @param order filter order. - * @param parCoeff filter (PARCOR) coefficients. - * @param state state of the filter. Must be at least of 'order' size. - * @param x the current input value. - * @return the output of the filter. - */ -typedef float ( *TLinearPredictionFilter_flt )( const int16_t order, const float parCoeff[], float *state, float x ); - /** Structure that defines mapping between a parameter and a bitstream. */ typedef struct ParamBitMap { diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index 9b58084e3..e56a77be1 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -82,7 +82,7 @@ void FEC_clas_estim_fx( Word16 bfi, /* i : bad frame indicator */ /*B*/ Word32 last_core_brate, /* i : bitrate of previous frame */ - const int16_t FEC_mode /* i : ACELP FEC mode */ + const Word16 FEC_mode /* i : ACELP FEC mode */ ) { Word16 i, j, pos; diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index fc8aba043..b2cc593b3 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -847,7 +847,6 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( move16(); Copy_Scale_sig_16_32_DEPREC( synth_out, synth32, L_FRAME48k, 5 ); /*11-5-1*/ - // cldfbSynthesis_ivas_fx(realBuffer, imagBuffer, synth_out, (int16_t)(st_fx->output_Fs * 0.01f), st_fx->cldfbSyn); cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), st_fx->cldfbSyn ); Scale_sig32( st_fx->cldfbSyn->cldfb_state_fx, st_fx->cldfbSyn->cldfb_state_length, -1 ); // Q_cldfb_state-1 st_fx->cldfbSyn->Q_cldfb_state = sub( st_fx->cldfbSyn->Q_cldfb_state, 1 ); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 17b3f9fbc..0f361e658 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1290,7 +1290,7 @@ ivas_error core_switching_post_dec_ivas_fx( FD_BWE_DEC_HANDLE hBWE_FD; HQ_DEC_HANDLE hHQ_core; ivas_error error; - int16_t offset; + Word16 offset; L_tmp = 0; move32(); diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index aa898956a..42f3250fb 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -114,17 +114,17 @@ void decod_unvoiced_fx( *-------------------------------------------------------------------*/ void decod_unvoiced_ivas_fx( - Decoder_State *st_fx, /* i/o: decoder static memory */ - const Word16 *Aq_fx, /* Q12 i : LP filter coefficient */ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */ - const int16_t uc_two_stage_flag, /* i : flag indicating two-stage UC */ - const Word16 coder_type, /* Q0 i : coding type */ - Word16 *tmp_noise_fx, /* Q0 o : long term temporary noise energy */ - Word16 *pitch_buf_fx, /* Q6 o : floating pitch values for each subframe*/ - Word16 *voice_factors_fx, /* Q15 o : voicing factors */ - Word16 *exc_fx, /* Q_X o : adapt. excitation exc */ - Word16 *exc2_fx, /* Q_X o : adapt. excitation/total exc */ - Word16 *bwe_exc_fx, /* Q_X i/o: excitation for SWB TBE */ + Decoder_State *st_fx, /* i/o: decoder static memory */ + const Word16 *Aq_fx, /* Q12 i : LP filter coefficient */ + const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */ + const Word16 uc_two_stage_flag, /* i : flag indicating two-stage UC */ + const Word16 coder_type, /* Q0 i : coding type */ + Word16 *tmp_noise_fx, /* Q0 o : long term temporary noise energy */ + Word16 *pitch_buf_fx, /* Q6 o : floating pitch values for each subframe*/ + Word16 *voice_factors_fx, /* Q15 o : voicing factors */ + Word16 *exc_fx, /* Q_X o : adapt. excitation exc */ + Word16 *exc2_fx, /* Q_X o : adapt. excitation/total exc */ + Word16 *bwe_exc_fx, /* Q_X i/o: excitation for SWB TBE */ Word16 *gain_buf ) { Word16 gain_pit_fx; /* Quantized pitch gain */ diff --git a/lib_dec/er_dec_acelp_fx.c b/lib_dec/er_dec_acelp_fx.c index 7c3ecaa0a..e30553d38 100644 --- a/lib_dec/er_dec_acelp_fx.c +++ b/lib_dec/er_dec_acelp_fx.c @@ -446,7 +446,7 @@ void con_acelp_fx( ELSE { /* No harmonic part */ - assert( (int) ( sizeof( buf ) / sizeof( buf[0] ) ) - M - L_EXC_MEM_DEC >= st->L_frame + st->L_frame / 2 ); + assert( (Word32) ( sizeof( buf ) / sizeof( buf[0] ) ) - M - L_EXC_MEM_DEC >= st->L_frame + st->L_frame / 2 ); set16_fx( &exc[0], 0, add( st->L_frame, shr( st->L_frame, 1 ) ) ); FOR( i = 0; i < st->nb_subfr; i++ ) diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 3fe40c1f3..3c234c098 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -1484,7 +1484,7 @@ void ivas_binaural_add_LFE_fx( Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output Q11*/ ) { - Word16 render_lfe, idx_lfe, gain_fx; + Word16 render_lfe, idx_lfe, gain_fx, idx; IF( st_ivas->hBinRenderer != NULL ) { @@ -1523,7 +1523,7 @@ void ivas_binaural_add_LFE_fx( { v_multc_fixed_16( input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain_fx, input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); // q_input_fx - 1 /* copy LFE to left and right channels */ - FOR( int idx = 0; idx < output_frame; idx++ ) + FOR( idx = 0; idx < output_frame; idx++ ) { input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]][idx] = L_shl_sat( input_fx[st_ivas->hIntSetup.index_lfe[idx_lfe]][idx], 1 ); // saturating to keep same q move32(); diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 63ee40e2a..d0c78b604 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2216,7 +2216,7 @@ void ivas_dirac_dec_render_sf_fx( DIRAC_DEC_STACK_MEM DirAC_mem; Word32 *p_onset_filter_fx = NULL; - uint16_t coherence_flag; + UWord16 coherence_flag; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; Word16 scale = 0; move16(); diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index 9040a8a71..eae0e9069 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -1428,9 +1428,9 @@ void ivas_ism_param_dec_tc_gain_ajust_fx( static void ivas_ism_param_dec_render_sf_fx( Decoder_Struct *st_ivas, IVAS_OUTPUT_SETUP hSetup, - const int16_t nchan_transport, - const int16_t nchan_out, - const int16_t nchan_out_woLFE, + const Word16 nchan_transport, + const Word16 nchan_out, + const Word16 nchan_out_woLFE, Word32 *output_f_fx[], /*Q_output*/ Word16 Q_output[] ) { diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index f632d86c8..428c817ef 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -83,7 +83,7 @@ ivas_error ivas_jbm_dec_tc_fx( Word32 *data_fx /*Q11*/ ) { - Word16 n, output_frame, nchan_out, i; + Word16 n, output_frame, nchan_out, i, ii; Decoder_State *st; /* used for bitstream handling */ Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; /* buffer for output synthesis */ Word16 nchan_remapped; @@ -512,14 +512,14 @@ ivas_error ivas_jbm_dec_tc_fx( hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; move16(); } - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } #ifdef MSAN_FIX - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx } @@ -534,7 +534,7 @@ ivas_error ivas_jbm_dec_tc_fx( Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } #ifdef MSAN_FIX - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 } @@ -614,7 +614,7 @@ ivas_error ivas_jbm_dec_tc_fx( st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; move16(); - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[ii] = Q11; @@ -999,7 +999,7 @@ ivas_error ivas_jbm_dec_tc_fx( hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; move16(); } - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; @@ -1045,7 +1045,7 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); } - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[ii] = Q11; @@ -1464,7 +1464,7 @@ ivas_error ivas_jbm_dec_tc_fx( hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; move16(); } - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->q_output_mem_fx[ii] ) ); // q_dft hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; @@ -1509,7 +1509,7 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( st_ivas->hSpar != NULL ) { - FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[ii] = Q11; @@ -1787,7 +1787,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) { - ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + ivas_mc_paramupmix_dec_digest_tc( st_ivas, (UWord8) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); } ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) { @@ -1882,7 +1882,7 @@ ivas_error ivas_jbm_dec_render_fx( ivas_error error; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; Word32 *p_tc_fx[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; - Word16 subframe_len, gd_bits, exp, nchan_in, i, j; + Word16 subframe_len, gd_bits, exp, nchan_in, i, j, ch; const Word16 output_q_factor = Q11; move16(); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -2448,7 +2448,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); } /* CLDFB synthesis */ - FOR( Word16 ch = 0; ch < nchan_out_cldfb; ch++ ) + FOR( ch = 0; ch < nchan_out_cldfb; ch++ ) { IF( st_ivas->cldfbSynDec[ch] ) { @@ -2476,7 +2476,7 @@ ivas_error ivas_jbm_dec_render_fx( ivas_param_mc_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, channel_active_fx ); - FOR( int ch = 0; ch < nchan_out_cldfb; ch++ ) + FOR( ch = 0; ch < nchan_out_cldfb; ch++ ) { IF( st_ivas->cldfbSynDec[ch] ) { diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 897fd4433..be2363469 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -107,7 +107,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( const Word32 *proto_mtx, cons static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); -static void param_mc_protoSignalComputation_fx( Word32 *RealBuffer_fx, Word32 *ImagBuffer_fx, Word32 *proto_frame_f_fx, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands /*, Word16 RealBuffer_fx_e, Word16 ImagBuffer_fx_e, Word16 *common_e*/ ); +static void param_mc_protoSignalComputation_fx( Word32 *RealBuffer_fx, Word32 *ImagBuffer_fx, Word32 *proto_frame_f_fx, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const Word16 num_freq_bands /*, Word16 RealBuffer_fx_e, Word16 ImagBuffer_fx_e, Word16 *common_e*/ ); /*------------------------------------------------------------------------- * ivas_param_mc_dec_open() @@ -1509,8 +1509,8 @@ void ivas_param_mc_dec_read_BS_fx( *------------------------------------------------------------------------*/ void ivas_param_mc_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ Word32 *transport_channels_f_fx[], Word16 transport_f_e ) { @@ -2361,7 +2361,7 @@ static void param_mc_protoSignalComputation_fx( Word32 *ImagBuffer_fx, /* i : CLDFB samples of the transport channels (imaginary part) */ Word32 *proto_frame_f_fx, /* o : interleaved complex prototype CLDFB samples */ const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ - const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ + const Word16 num_freq_bands /* i : number of frequency bands for the prototypes */ ) { Word16 band; @@ -2680,7 +2680,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( Word16 nY_band; Word16 num_lfe_bands; Word16 brange[2]; - uint16_t i; + UWord16 i; Word16 ch_idx1, ch_idx2, lfe_idx1, lfe_idx2; Word16 remove_lfe; Word16 lfe_indices[PARAM_MC_LOCAL_SZ_LFE_MAP]; diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 812d9957f..6f75230c9 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -100,7 +100,7 @@ const Word32 dft_ap_gains_fx[5][3] = { 644245094, -644245120, 1073741824 } }; -const int16_t dft_ap_delays[3][3] = +const Word16 dft_ap_delays[3][3] = { { 2, 47, 61}, {29, 41, 73}, @@ -196,7 +196,7 @@ const Word16 dft_win_8k_fx[70] = * stereo CNA tables *------------------------------------------------------------------------*/ -const int16_t cna_init_bands[CNA_INIT_NBANDS + 1] = +const Word16 cna_init_bands[CNA_INIT_NBANDS + 1] = { 1, 4, 14, 33, 67, 171, 320 }; @@ -235,7 +235,7 @@ const Word16 min_smooth_gains2_fx[SBA_DIRAC_STEREO_NUM_BANDS] = /* all the "probability" tables for the actual AC are in the reversed cumulative counts table format; for example, given the counts table [c0 | c1 | c2 | c3] with c0 + c1 + c2 + c3 = 2 ^ 14, the reversed cumulative counts table is [2 ^ 14 | 2 ^ 14 - c0 | 2 ^ 14 - c0 - c1 | 2 ^ 14 - c0 - c1 - c2 | 2 ^ 14 - c0 - c1 - c2 - c3] */ -const uint16_t cum_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT] = +const UWord16 cum_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT] = { {0,1024,2048,3072,4096,5120,6144,7168,8192,9216,10240,11264,12288,13312,14336,15360,16384 }, {0,9294,16019,16213,16311,16346,16363,16371,16375,16377,16378,16379,16380,16381,16382,16383,16384 }, @@ -246,7 +246,7 @@ const uint16_t cum_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT] {0,5836,14448,15610,16267,16343,16374,16375,16376,16377,16378,16379,16380,16381,16382,16383,16384 } }; -const uint16_t sym_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][ECSQ_PARAM_COUNT] = +const UWord16 sym_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][ECSQ_PARAM_COUNT] = { {1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024 }, {9294,6725,194,98,35,17,8,4,2,1,1,1,1,1,1,1 }, @@ -257,7 +257,7 @@ const uint16_t sym_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][ECSQ_PARAM_COUNT] = {5836,8612,1162,657,76,31,1,1,1,1,1,1,1,1,1,1 } }; -const uint16_t cum_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SIZE] = +const UWord16 cum_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SIZE] = { {0,6445,12725,15035,15885,16198,16313,16355,16370,16376,16378,16379,16380,16381,16382,16383,16384 }, {0,3624,8645,11690,13537,14657,15336,15748,15998,16150,16242,16298,16332,16352,16364,16372,16384 }, @@ -276,7 +276,7 @@ const uint16_t cum_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SI {0,3623,6446,8644,10356,11689,12727,13536,14166,14657,15039,15337,15569,15749,15890,15999,16384 }, }; -const uint16_t sym_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][ECSQ_TAB_VALS_SIZE] = +const UWord16 sym_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][ECSQ_TAB_VALS_SIZE] = { {6445,6280,2310,850,313,115,42,15,6,2,1,1,1,1,1,1 }, {3624,5021,3045,1847,1120,679,412,250,152,92,56,34,20,12,8,12 }, @@ -295,59 +295,59 @@ const uint16_t sym_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][ECSQ_TAB_VALS_SIZE] {3623,2823,2198,1712,1333,1038,809,630,491,382,298,232,180,141,109,385 }, }; -const uint16_t cum_freq_ECSQ_tab_abs_1bit[1 + 2] = +const UWord16 cum_freq_ECSQ_tab_abs_1bit[1 + 2] = { 0, 5462, 16384 }; /* table for uniform coding of absolute values in {0, +-1, +-2, +-3} */ -const uint16_t cum_freq_ECSQ_tab_abs_2bit[1 + 4] = +const UWord16 cum_freq_ECSQ_tab_abs_2bit[1 + 4] = { 0, 2338, 7020, 11702, 16384 }; /* table for uniform coding of absolute values in {0, +-1, ..., +-7} */ -const uint16_t cum_freq_ECSQ_tab_abs_3bit[1 + 8] = +const UWord16 cum_freq_ECSQ_tab_abs_3bit[1 + 8] = { 0, 1096, 3280, 5464, 7648, 9832, 12016, 14200, 16384 }; /* table for uniform coding of absolute values in {0, +-1, ..., +-15} */ -const uint16_t cum_freq_ECSQ_tab_abs_4bit[1 + 16] = +const UWord16 cum_freq_ECSQ_tab_abs_4bit[1 + 16] = { 0, 514, 1572, 2630, 3688, 4746, 5804, 6862, 7920, 8978, 10036, 11094, 12152, 13210, 14268, 15326, 16384 }; -const uint16_t sym_freq_ECSQ_tab_abs_1bit[2] = +const UWord16 sym_freq_ECSQ_tab_abs_1bit[2] = { 5462, 10922 }; /* table for uniform coding of absolute values in {0, +-1, +-2, +-3} */ -const uint16_t sym_freq_ECSQ_tab_abs_2bit[4] = +const UWord16 sym_freq_ECSQ_tab_abs_2bit[4] = { 2338, 4682, 4682, 4682 }; /* table for uniform coding of absolute values in {0, +-1, ..., +-7} */ -const uint16_t sym_freq_ECSQ_tab_abs_3bit[8] = +const UWord16 sym_freq_ECSQ_tab_abs_3bit[8] = { 1096, 2184, 2184, 2184, 2184, 2184, 2184, 2184 }; /* table for uniform coding of absolute values in {0, +-1, ..., +-15} */ -const uint16_t sym_freq_ECSQ_tab_abs_4bit[16] = +const UWord16 sym_freq_ECSQ_tab_abs_4bit[16] = { 514, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058 }; /* array of tables for uniform coding of absolute values */ -const uint16_t * const cum_freq_ECSQ_tab_abs_lsbs[1 + 4] = +const UWord16 * const cum_freq_ECSQ_tab_abs_lsbs[1 + 4] = { NULL, cum_freq_ECSQ_tab_abs_1bit, cum_freq_ECSQ_tab_abs_2bit, cum_freq_ECSQ_tab_abs_3bit, cum_freq_ECSQ_tab_abs_4bit }; -const uint16_t * const sym_freq_ECSQ_tab_abs_lsbs[1 + 4] = +const UWord16 * const sym_freq_ECSQ_tab_abs_lsbs[1 + 4] = { NULL, sym_freq_ECSQ_tab_abs_1bit, sym_freq_ECSQ_tab_abs_2bit, sym_freq_ECSQ_tab_abs_3bit, sym_freq_ECSQ_tab_abs_4bit }; @@ -391,7 +391,7 @@ const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11] = *-----------------------------------------------------------------------*/ /* Alpha Fine Huffman table df0 */ -static const int16_t huff_nodes_first_band_alpha[32][2] = +static const Word16 huff_nodes_first_band_alpha[32][2] = { { -17, 1 }, { 3, 2 }, @@ -428,7 +428,7 @@ static const int16_t huff_nodes_first_band_alpha[32][2] = }; /* Alpha Fine Huffman table df */ -static const int16_t huff_nodes_alpha_1D_DF[64][2] = +static const Word16 huff_nodes_alpha_1D_DF[64][2] = { { -33, 1 }, { 3, 2 }, @@ -497,7 +497,7 @@ static const int16_t huff_nodes_alpha_1D_DF[64][2] = }; /* Alpha Fine Huffman table dt */ -static const int16_t huff_nodes_alpha_1D_DT[64][2] = +static const Word16 huff_nodes_alpha_1D_DT[64][2] = { { -33, 1 }, { -34, 2 }, @@ -566,19 +566,19 @@ static const int16_t huff_nodes_alpha_1D_DT[64][2] = }; /* Beta Fine Huffman table df0 */ -static const int16_t huff_nodes_first_band_beta[8][2] = +static const Word16 huff_nodes_first_band_beta[8][2] = { { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 }, { -6, 6 }, { -7, 7 }, { -8, -9 } }; /* Beta Fine Huffman table df */ -static const int16_t huff_nodes_beta_1D_DF[16][2] = +static const Word16 huff_nodes_beta_1D_DF[16][2] = { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { 9, 8 }, { -5, -13 }, { 11, 10 }, { -4, -14 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } }; /* Beta Fine Huffman table dt */ -static const int16_t huff_nodes_beta_1D_DT[16][2] = +static const Word16 huff_nodes_beta_1D_DT[16][2] = { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { -13, 8 }, { -5, 9 }, { -14, 10 }, { -4, 11 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } }; diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 11752380d..84c1a94a0 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -53,7 +53,7 @@ extern const Word16 dft_alpha_s2_b2_fx[STEREO_DFT_BAND_MAX]; extern const Word32 dft_bpf_weights_fx[]; extern const Word32 dft_ap_gains_fx[5][3]; -extern const int16_t dft_ap_delays[3][3]; +extern const Word16 dft_ap_delays[3][3]; extern const Word16 dft_win232ms_8k_fx[75]; extern const Word16 dft_win232ms_12k8_fx[120]; extern const Word16 dft_win232ms_16k_fx[150]; @@ -62,7 +62,7 @@ extern const Word16 dft_win232ms_48k_fx[450]; extern const Word16 dft_res_pred_weights_fx[][STEREO_DFT_BAND_MAX]; extern const Word16 dft_win_8k_fx[70]; -extern const int16_t cna_init_bands[CNA_INIT_NBANDS + 1]; +extern const Word16 cna_init_bands[CNA_INIT_NBANDS + 1]; extern const Word16 min_smooth_gains1_fx[SBA_DIRAC_STEREO_NUM_BANDS]; @@ -74,12 +74,12 @@ extern const Word16 max_smooth_gains2_fx[SBA_DIRAC_STEREO_NUM_BANDS]; * ECLVQ Stereo ROM tables *----------------------------------------------------------------------------------*/ -extern const uint16_t cum_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT]; -extern const uint16_t sym_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][ECSQ_PARAM_COUNT]; -extern const uint16_t cum_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SIZE]; -extern const uint16_t sym_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][ECSQ_TAB_VALS_SIZE]; -extern const uint16_t *const cum_freq_ECSQ_tab_abs_lsbs[1 + 4]; -extern const uint16_t *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4]; +extern const UWord16 cum_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT]; +extern const UWord16 sym_freq_ECSQ_tab_param[ECSQ_CONFIG_COUNT][ECSQ_PARAM_COUNT]; +extern const UWord16 cum_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SIZE]; +extern const UWord16 sym_freq_ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][ECSQ_TAB_VALS_SIZE]; +extern const UWord16 *const cum_freq_ECSQ_tab_abs_lsbs[1 + 4]; +extern const UWord16 *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4]; /*----------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index d1efbbd2c..bb79b956c 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -49,11 +49,11 @@ #define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 ) /* PLC constants */ -static const int16_t ivas_spar_dec_plc_num_frames_keep = 9; -// static const int16_t ivas_spar_dec_plc_num_frames_fade_out = 9; -static const int16_t ivas_spar_dec_plc_per_frame_ramp_down_gain_dB = 3; -static const int16_t ivas_spar_dec_plc_max_num_frames_ramp_down = 33; -static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0, 0, 0, 0, 0, 0, 0 }; +static const Word16 ivas_spar_dec_plc_num_frames_keep = 9; +// static const Word16 ivas_spar_dec_plc_num_frames_fade_out = 9; +static const Word16 ivas_spar_dec_plc_per_frame_ramp_down_gain_dB = 3; +static const Word16 ivas_spar_dec_plc_max_num_frames_ramp_down = 33; +static const Word16 ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0, 0, 0, 0, 0, 0, 0 }; /*------------------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index b1522be36..5704f4f60 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -49,14 +49,14 @@ /* State of the range decoder */ typedef struct { - uint32_t rc_low; - uint32_t rc_range; + UWord32 rc_low; + UWord32 rc_range; - uint16_t *bit_buffer; - int16_t bit_count; - int16_t max_allowable_bit_count; + UWord16 *bit_buffer; + Word16 bit_count; + Word16 max_allowable_bit_count; - int16_t bit_error_detected; + Word16 bit_error_detected; } RangeUniDecState; @@ -78,11 +78,11 @@ typedef struct stereo_dft_dec_data_struct STEREO_DFT_CONFIG_DATA_HANDLE hConfig; /*Sizes*/ - int16_t N; /* Size of DFT hop size */ - int16_t NFFT; /* Size of DFT */ + Word16 N; /* Size of DFT hop size */ + Word16 NFFT; /* Size of DFT */ /*FFT*/ - int16_t dft_trigo_step; + Word16 dft_trigo_step; const Word16 *dft_trigo_fx; /* Q15 */ const Word16 *dft_trigo_12k8_fx; /* Q15 */ @@ -90,13 +90,13 @@ typedef struct stereo_dft_dec_data_struct const Word16 *dft_trigo_8k_fx; /* Q15 */ - int16_t dft32ms_ovl; /* Overlap size */ + Word16 dft32ms_ovl; /* Overlap size */ const Word16 *win32ms_fx; /* DFT window */ /* Q15 */ const Word16 *win32ms_12k8_fx; /* DFT window */ /* Q15 */ const Word16 *win32ms_16k_fx; /* DFT window */ /* Q15 */ const Word16 *win32ms_8k_fx; /* DFT window */ /* Q15 */ - int16_t dft32ms_ovl2; /* Overlap2 size */ + Word16 dft32ms_ovl2; /* Overlap2 size */ const Word16 *win232ms_fx; /* DFT window */ /* Q15 */ const Word16 *win232ms_12k8_fx; /* DFT window */ /* Q15 */ const Word16 *win232ms_16k_fx; /* DFT window */ /* Q15 */ @@ -105,31 +105,31 @@ typedef struct stereo_dft_dec_data_struct /*Bands*/ - int16_t band_res[STEREO_DFT_DEC_DFT_NB]; - int16_t band_limits[STEREO_DFT_BAND_MAX + 1]; - int16_t nbands; + Word16 band_res[STEREO_DFT_DEC_DFT_NB]; + Word16 band_limits[STEREO_DFT_BAND_MAX + 1]; + Word16 nbands; /*Configuration*/ - int16_t prm_res[STEREO_DFT_DEC_DFT_NB]; + Word16 prm_res[STEREO_DFT_DEC_DFT_NB]; /*Stereo parameters*/ Word32 side_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* Q31 */ - int16_t side_gain_flag_1; - int16_t side_gain_flag_2; - int16_t side_gain_index_previous[STEREO_DFT_BAND_MAX]; - int16_t side_gain_index[STEREO_DFT_BAND_MAX]; + Word16 side_gain_flag_1; + Word16 side_gain_flag_2; + Word16 side_gain_index_previous[STEREO_DFT_BAND_MAX]; + Word16 side_gain_index[STEREO_DFT_BAND_MAX]; Word32 gipd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q27 */ - int16_t no_ipd_flag; /* flag to indicate when no IPD gets used */ + Word16 no_ipd_flag; /* flag to indicate when no IPD gets used */ - int16_t itd_xfade_counter; - int32_t last_active_element_brate; - int16_t ipd_xfade_counter; + Word16 itd_xfade_counter; + Word32 last_active_element_brate; + Word16 ipd_xfade_counter; /*residual prediction*/ - int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ - Word32 itd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q15 */ + Word16 res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ + Word32 itd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q15 */ Word32 itd_xfade_step_fx; /* Q15 */ Word32 itd_xfade_target_fx; /* Q15 */ @@ -139,19 +139,19 @@ typedef struct stereo_dft_dec_data_struct Word32 ipd_xfade_step_fx; /* Q27 */ Word32 ipd_xfade_prev_fx; /* Q27 */ Word32 res_pred_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ /* Q31 */ - int16_t res_pred_band_min; /* Band min for prediction of residual */ - int16_t past_DMX_pos; - int16_t res_pred_flag_0; - int16_t res_pred_flag_1; - int16_t res_pred_index_previous[STEREO_DFT_BAND_MAX]; + Word16 res_pred_band_min; /* Band min for prediction of residual */ + Word16 past_DMX_pos; + Word16 res_pred_flag_0; + Word16 res_pred_flag_1; + Word16 res_pred_index_previous[STEREO_DFT_BAND_MAX]; - int16_t reverb_flag; - int16_t nbands_respred; + Word16 reverb_flag; + Word16 nbands_respred; /*residual coding*/ - int16_t res_cod_mode[STEREO_DFT_DEC_DFT_NB]; /* mode from 0 (off) to 3 */ - int16_t res_cod_band_max; /* Band max for coding of residual */ - int16_t res_cod_line_max; + Word16 res_cod_mode[STEREO_DFT_DEC_DFT_NB]; /* mode from 0 (off) to 3 */ + Word16 res_cod_band_max; /* Band max for coding of residual */ + Word16 res_cod_line_max; Word32 DFT_past_DMX_fx[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ /* Q(q_DFT_past_DMX_fx) */ Word32 past_res_pred_gain_fx[STEREO_DFT_PAST_MAX][STEREO_DFT_BAND_MAX]; /* Q31 */ Word32 res_gains_ind_fx[2][2 * STEREO_DFT_BAND_MAX]; /* Q26 */ @@ -171,9 +171,9 @@ typedef struct stereo_dft_dec_data_struct BPF_DEC_HANDLE hBpf; TCX_LTP_DEC_HANDLE hTcxLtpDec; - int16_t trans; - int16_t attackPresent; - int16_t wasTransient; + Word16 trans; + Word16 attackPresent; + Word16 wasTransient; basic_allpass_t ap1, ap2, ap3; @@ -188,9 +188,9 @@ typedef struct stereo_dft_dec_data_struct Word32 ap_fade_mem_fx[STEREO_DFT_ALLPASS_FADELEN_16k]; /* Q(q_ap_fade_mem_fx) */ Word16 q_ap_fade_mem_fx; - int16_t ap_wasTransient; - int16_t core_hist[STEREO_DFT_CORE_HIST_MAX]; - int16_t hb_stefi_delay; + Word16 ap_wasTransient; + Word16 core_hist[STEREO_DFT_CORE_HIST_MAX]; + Word16 hb_stefi_delay; Word32 smooth_dmx_nrg_fx[STEREO_DFT_BAND_MAX]; /* Q(q_smoothed_nrg) */ Word32 smooth_res_nrg_fx[STEREO_DFT_BAND_MAX]; /* Q(q_smoothed_nrg) */ Word32 td_gain_fx[STEREO_DFT_CORE_HIST_MAX]; /* Q(q_td_gain) */ @@ -206,16 +206,16 @@ typedef struct stereo_dft_dec_data_struct /* stereo DTX */ Word16 g_state_fx[STEREO_DFT_BAND_MAX]; /* Q15 */ - int16_t frame_sid_nodata; - int16_t frame_nodata; - int16_t frame_sid; + Word16 frame_sid_nodata; + Word16 frame_nodata; + Word16 frame_sid; Word16 scale_fx; /* Q15 */ /* PLC on residual signal */ - int16_t time_offs; - int16_t sg_mem_corrupt; - int16_t recovery_flg; + Word16 time_offs; + Word16 sg_mem_corrupt; + Word16 recovery_flg; /* PLC on residual signal */ Word32 sg_mean_fx; /* Q31 */ @@ -228,7 +228,7 @@ typedef struct stereo_dft_dec_data_struct Word16 q_hb_nrg_subr; Word16 q_res_mem; - int16_t first_frame; + Word16 first_frame; Word32 mixer_mat_smooth_fx[2][4][2 * IVAS_MAX_NUM_BANDS]; /* Q31 */ Word32 g_L_prev_fx; /* Q31 */ Word32 g_R_prev_fx; /* Q31 */ @@ -257,26 +257,26 @@ typedef struct stereo_dec_cng { Word16 cm_fx[STEREO_DFT_BAND_MAX]; /* cm */ /* Q15 */ Word16 coh_fx[STEREO_DFT_BAND_MAX + 1]; /* coherence */ /* Q15 */ - int16_t first_SID; /* first SID indicator */ - int16_t first_SID_after_TD; /* first SID after TD-stereo indicator */ - int16_t prev_sid_nodata; /* previous frame SID/FRAME_NO_DATA indicator */ - int16_t last_tdm_idx; /* last tdm index */ + Word16 first_SID; /* first SID indicator */ + Word16 first_SID_after_TD; /* first SID after TD-stereo indicator */ + Word16 prev_sid_nodata; /* previous frame SID/FRAME_NO_DATA indicator */ + Word16 last_tdm_idx; /* last tdm index */ Word32 c_LR_LT_fx; /* left right cross correlation */ /* Q31 */ - int16_t active_frame_counter; /* counter for active frames */ - int16_t xfade_frame_counter; /* xfade counter */ - int16_t xfade_length; /* number of frames to perform xfade */ - int16_t nr_dft_frames; /* dft frame counter */ - int16_t nr_corr_frames; /* correlation frame counter */ - int16_t nr_sid_frames; /* SID frame counter */ - int16_t last_act_element_mode; /* Element mode of last active frame */ + Word16 active_frame_counter; /* counter for active frames */ + Word16 xfade_frame_counter; /* xfade counter */ + Word16 xfade_length; /* number of frames to perform xfade */ + Word16 nr_dft_frames; /* dft frame counter */ + Word16 nr_corr_frames; /* correlation frame counter */ + Word16 nr_sid_frames; /* SID frame counter */ + Word16 last_act_element_mode; /* Element mode of last active frame */ Word16 olapBufferSynth22_fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ Word32 olapBufferSynth22_32fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ - int16_t flag_cna_fade; /* flag enabling CNA fade out */ + Word16 flag_cna_fade; /* flag enabling CNA fade out */ Word16 maskingNoiseS_fx[L_FRAME16k]; /* masking noise (CNA) for secondary channel */ - int16_t enableSecCNA; /* flag enabling secondary channel CNA */ + Word16 enableSecCNA; /* flag enabling secondary channel CNA */ Word16 c_PS_LT_fx; /* long term cross-correlation between primary and secondary channel */ // Assumed Q15 for initialization. Can be modified later if reqd. - const int16_t *frameSize; /* Frame size in samples */ - const int16_t *fftlen; /* FFT length used for the decomposition */ + const Word16 *frameSize; /* Frame size in samples */ + const Word16 *fftlen; /* FFT length used for the decomposition */ } STEREO_CNG_DEC, *STEREO_CNG_DEC_HANDLE; @@ -287,18 +287,18 @@ typedef struct stereo_dec_cng typedef struct stereo_td_dec_data_structure { - int16_t tdm_last_ratio_idx; /* last TDM ratio index */ - int16_t tdm_last_SM_flag; /* last channel combination scheme flag */ - int16_t tdm_prev_last_SM_flag; /* channel combination scheme flag before last frame */ - int16_t tdm_SM_flag; /* current channel combination scheme flag */ - int16_t tdm_use_IAWB_Ave_lpc; /* Flag to indicate the usage of mean inactive LP coefficients */ - - int16_t tdm_lp_reuse_flag; /* Flag that indicate if it is possible to reuse the LP coefficient from the primary channel or not */ - int16_t tdm_low_rate_mode; /* secondary channel low rate mode flag */ + Word16 tdm_last_ratio_idx; /* last TDM ratio index */ + Word16 tdm_last_SM_flag; /* last channel combination scheme flag */ + Word16 tdm_prev_last_SM_flag; /* channel combination scheme flag before last frame */ + Word16 tdm_SM_flag; /* current channel combination scheme flag */ + Word16 tdm_use_IAWB_Ave_lpc; /* Flag to indicate the usage of mean inactive LP coefficients */ + + Word16 tdm_lp_reuse_flag; /* Flag that indicate if it is possible to reuse the LP coefficient from the primary channel or not */ + Word16 tdm_low_rate_mode; /* secondary channel low rate mode flag */ Word16 tdm_Pri_pitch_buf_fx[NB_SUBFR]; - int16_t tdm_Pitch_reuse_flag; - int16_t tdm_LRTD_flag; - int16_t flag_skip_DMX; /* flag that indicates whether the TD downmixing is skipped */ + Word16 tdm_Pitch_reuse_flag; + Word16 tdm_LRTD_flag; + Word16 flag_skip_DMX; /* flag that indicates whether the TD downmixing is skipped */ Word32 TCX_old_syn_Overl_fx[L_FRAME16k / 2]; /* past ovrl buffer for possible switching from TD stereo ACELP to MDCT stereo TCX frame */ /* Q11 */ Word16 prevSP_ratio_fx; /* previous SP ratio */ @@ -320,24 +320,24 @@ typedef struct stereo_mdct_dec_data_structure STEREO_MDCT_BAND_PARAMETERS stbParamsTCX20afterACELP; /* stereo frequency band parameters for transition frame */ /* only intraframe */ - int16_t mdct_stereo_mode[2]; /* mdct stereo mode: LR, MS, band-wise MS */ - int16_t global_ild[2]; /* Quantized ILD for the whole spectrum */ - int16_t split_ratio; /* Ratio of bitrate (1 to 7), split_ratio = 8 * 1st chn bitrate / (1st + 2nd chn bitrate) */ + Word16 mdct_stereo_mode[2]; /* mdct stereo mode: LR, MS, band-wise MS */ + Word16 global_ild[2]; /* Quantized ILD for the whole spectrum */ + Word16 split_ratio; /* Ratio of bitrate (1 to 7), split_ratio = 8 * 1st chn bitrate / (1st + 2nd chn bitrate) */ - int16_t IGFStereoMode[2]; /* MDCT stereo mode for IGF */ + Word16 IGFStereoMode[2]; /* MDCT stereo mode for IGF */ - int16_t use_itd; - int16_t itd_mode; /*0/1*/ - Word32 itd_fx; /* Q15 */ + Word16 use_itd; + Word16 itd_mode; /*0/1*/ + Word32 itd_fx; /* Q15 */ - int16_t reverse_dmx; + Word16 reverse_dmx; Word32 smooth_ratio_fx; /* Q26 */ - int16_t prev_ms_mask[NB_DIV][MAX_SFB]; + Word16 prev_ms_mask[NB_DIV][MAX_SFB]; Word16 lastCoh_fx; /* Q14 */ - int16_t noise_seeds_channels[CPE_CHANNELS]; - int16_t noise_seed_common; - int16_t isSBAStereoMode; + Word16 noise_seeds_channels[CPE_CHANNELS]; + Word16 noise_seed_common; + Word16 isSBAStereoMode; } STEREO_MDCT_DEC_DATA, *STEREO_MDCT_DEC_DATA_HANDLE; @@ -348,18 +348,18 @@ typedef struct stereo_mdct_dec_data_structure typedef struct stereo_tca_dec_data_structure { - int16_t refChanIndx; /* reference channel index in current frame */ - int16_t prevRefChanIndx; /* reference channel index in previous frame */ - int16_t indx_ica_NCShift; /* ICA target channel inter-channel corrstats */ - int16_t indx_ica_gD; /* ICA target gain */ + Word16 refChanIndx; /* reference channel index in current frame */ + Word16 prevRefChanIndx; /* reference channel index in previous frame */ + Word16 indx_ica_NCShift; /* ICA target channel inter-channel corrstats */ + Word16 indx_ica_gD; /* ICA target gain */ Word32 targetGain_fx; /* gain norm applied on target (or right) channel in current frame */ // Q29 Word32 prevTargetGain_fx; /* gain norm applied on target (or right) channel in previous frame */ // Q29 - int16_t corrLagStats; /* corr lag stats in current frame */ - int16_t prevCorrLagStats; /* corr lag stats in previous frame */ + Word16 corrLagStats; /* corr lag stats in current frame */ + Word16 prevCorrLagStats; /* corr lag stats in previous frame */ - int16_t interp_dec_prevNCShift; /* NC Shift in previous frame */ - int16_t interp_dec_switch_to_zero_diff; /* switch flag for interpolation */ + Word16 interp_dec_prevNCShift; /* NC Shift in previous frame */ + Word16 interp_dec_switch_to_zero_diff; /* switch flag for interpolation */ Word32 memChanL_fx[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over for Fixed */ @@ -428,10 +428,10 @@ typedef struct stereo_icbwe_dec_data_structure typedef struct { - int16_t dtx_flag; - int16_t sce_id_dtx; + Word16 dtx_flag; + Word16 sce_id_dtx; - int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ + Word16 ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ } ISM_DTX_DATA_DEC; @@ -478,9 +478,9 @@ typedef struct ivas_dirac_dec_data_structure { DIRAC_CONFIG_DATA_HANDLE hConfig; - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - int16_t dithering_seed; - int16_t spar_to_dirac_write_idx; + Word16 band_grouping[IVAS_MAX_NUM_BANDS + 1]; + Word16 dithering_seed; + Word16 spar_to_dirac_write_idx; IVAS_FB_MIXER_HANDLE hFbMdft; @@ -521,10 +521,10 @@ typedef struct dirac_output_synthesis_cov_state_structure typedef struct ivas_param_mc_diff_proto_info_structure { - int16_t num_protos_diff; - int16_t *proto_index_diff; - int16_t *num_source_chan_diff; - int16_t **source_chan_idx; + Word16 num_protos_diff; + Word16 *proto_index_diff; + Word16 *num_source_chan_diff; + Word16 **source_chan_idx; Word32 **proto_fac_fx; } PARAM_MC_DIFF_PROTO_INFO; @@ -532,42 +532,42 @@ typedef struct ivas_param_mc_diff_proto_info_structure typedef struct ivas_param_mc_dec_data_structure { - int16_t slot_size; + Word16 slot_size; Word32 *Cldfb_RealBuffer_tc_fx; // Q12 Word16 Cldfb_RealBuffer_tc_e; Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 Word16 Cldfb_ImagBuffer_tc_e; Word16 sz; - int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; - int16_t nb_subframes; - int16_t subframes_rendered; - int16_t slots_rendered; - int16_t num_slots; - int16_t num_freq_bands; - int16_t num_param_bands_synth; + Word16 subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + Word16 nb_subframes; + Word16 subframes_rendered; + Word16 slots_rendered; + Word16 num_slots; + Word16 num_freq_bands; + Word16 num_param_bands_synth; - int16_t band_grouping[PARAM_MC_MAX_PARAMETER_BANDS + 1]; + Word16 band_grouping[PARAM_MC_MAX_PARAMETER_BANDS + 1]; /*Decoder parameters */ /*Prototypes*/ - int16_t num_outputs_diff; + Word16 num_outputs_diff; PARAM_MC_DIFF_PROTO_INFO *diff_proto_info; PARAM_MC_SYNTHESIS_CONF synthesis_conf; /*Options*/ /* Decorrelator options */ - int16_t max_band_decorr; + Word16 max_band_decorr; /*Decoder states=memories*/ Word32 *proto_frame_f_fx; /* Q11 */ Word32 *proto_frame_dec_f_fx; /* Q11 */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE h_output_synthesis_cov_state; DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_params; - int16_t max_band_energy_compensation; + Word16 max_band_energy_compensation; HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC; Word16 *icc_q_fx; /* ICC parameters*/ /* Q15 */ Word16 *icld_q_fx; /* Q8 */ - int16_t max_param_band_abs_cov; + Word16 max_param_band_abs_cov; Word16 q_proto_frame_f; Word32 *ls_conv_dmx_matrix_fx; /* Q30 */ Word32 *proto_matrix_int_fx; @@ -588,12 +588,12 @@ typedef struct ivas_param_mc_dec_data_structure typedef struct ivas_mc_paramupmix_dec_data_structure { - int16_t num_freq_bands; + Word16 num_freq_bands; ivas_td_decorr_state_t *hTdDecorr[MC_PARAMUPMIX_COMBINATIONS]; - int32_t alpha_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int32_t beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int16_t first_frame; - int16_t free_param_interpolator; + Word32 alpha_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + Word32 beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + Word16 first_frame; + Word16 free_param_interpolator; Word32 alphas_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; // Q28 @@ -627,30 +627,30 @@ typedef struct ivas_spar_md_dec_state_t ivas_spar_dec_matrices_t spar_coeffs; ivas_spar_dec_matrices_t spar_coeffs_prev; ivas_spar_dec_matrices_t spar_coeffs_tar; - int16_t dtx_md_smoothing_cntr; - int16_t valid_bands[IVAS_MAX_NUM_BANDS]; - int16_t base_band_age[IVAS_MAX_NUM_BANDS]; - int16_t spar_plc_num_lost_frames; - int16_t num_decorr; - int16_t td_decorr_flag; - int16_t spar_plc_enable_fadeout_flag; + Word16 dtx_md_smoothing_cntr; + Word16 valid_bands[IVAS_MAX_NUM_BANDS]; + Word16 base_band_age[IVAS_MAX_NUM_BANDS]; + Word16 spar_plc_num_lost_frames; + Word16 num_decorr; + Word16 td_decorr_flag; + Word16 spar_plc_enable_fadeout_flag; Word32 ***mixer_mat_fx; /* Q(Q_mixer_mat) */ Word32 mixer_mat_prev_fx[MAX_PARAM_SPATIAL_SUBFRAMES + 1][IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; /* Q(Q_mixer_mat) */ Word16 Q_mixer_mat; ivas_spar_md_com_cfg spar_md_cfg; ivas_arith_coeffs_t arith_coeffs; ivas_huff_coeffs_t huff_coeffs; - int16_t table_idx; - int16_t dtx_vad; - int16_t spar_hoa_md_flag; - int16_t spar_hoa_dirac2spar_md_flag; - int16_t HOA_md_ind[IVAS_SPAR_MAX_CH]; + Word16 table_idx; + Word16 dtx_vad; + Word16 spar_hoa_md_flag; + Word16 spar_hoa_dirac2spar_md_flag; + Word16 HOA_md_ind[IVAS_SPAR_MAX_CH]; Word32 smooth_buf_fx[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; /* Q0 */ Word16 smooth_fac_fx[IVAS_MAX_NUM_BANDS]; /* Q15 */ Word32 mixer_mat_prev2_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; /* Q(Q_mixer_mat) */ - int16_t first_valid_frame; + Word16 first_valid_frame; ivas_band_coeffs_t *band_coeffs_prev; - int16_t base_band_coeffs_age[IVAS_MAX_NUM_BANDS]; + Word16 base_band_coeffs_age[IVAS_MAX_NUM_BANDS]; } ivas_spar_md_dec_state_t; @@ -676,11 +676,11 @@ typedef struct { Word16 prev_ql_fx[IVAS_PCA_INTERP]; Word16 prev_qr_fx[IVAS_PCA_INTERP]; - int16_t prev_pca_bypass; + Word16 prev_pca_bypass; Word16 mem_eigVec_interp_fx[IVAS_PCA_LEN_INTERP_EIG_DEC]; /* parser output: */ - int16_t pca_bypass; - int32_t index[2]; + Word16 pca_bypass; + Word32 index[2]; } PCA_DEC_STATE; @@ -690,20 +690,20 @@ typedef struct ivas_spar_dec_lib_t ivas_td_decorr_state_t *hTdDecorr; ivas_spar_md_dec_state_t *hMdDec; IVAS_FB_MIXER_HANDLE hFbMixer; - int16_t AGC_flag; + Word16 AGC_flag; ivas_agc_dec_state_t *hAgcDec; PCA_DEC_STATE *hPCA; - int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; - int16_t enc_param_start_band; - int32_t core_nominal_brate; /* Nominal bitrate for core coding */ - int16_t i_subframe; - - int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; - int16_t render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; - int16_t nb_subframes; - int16_t subframes_rendered; - int16_t slots_rendered; - int16_t num_slots; + Word16 dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; + Word16 enc_param_start_band; + Word32 core_nominal_brate; /* Nominal bitrate for core coding */ + Word16 i_subframe; + + Word16 subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + Word16 render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; + Word16 nb_subframes; + Word16 subframes_rendered; + Word16 slots_rendered; + Word16 num_slots; } SPAR_DEC_DATA, *SPAR_DEC_HANDLE; @@ -712,8 +712,8 @@ typedef struct ivas_spar_dec_lib_t typedef struct ivas_osba_data { Word32 **delayBuffer_fx; - int16_t delayBuffer_size; - int16_t delayBuffer_nchan; + Word16 delayBuffer_size; + Word16 delayBuffer_nchan; } SBA_ISM_DATA, *SBA_ISM_DATA_HANDLE; @@ -724,9 +724,9 @@ typedef struct ivas_osba_data typedef struct sce_dec_data_structure { - int16_t sce_id; /* SCE # identifier */ - int32_t element_brate; /* SCE total bitrate in bps */ - int32_t last_element_brate; /* SCE last total bitrate in bps */ + Word16 sce_id; /* SCE # identifier */ + Word32 element_brate; /* SCE total bitrate in bps */ + Word32 last_element_brate; /* SCE last total bitrate in bps */ /* core coder handle */ DEC_CORE_HANDLE hCoreCoder[1]; @@ -747,15 +747,15 @@ typedef struct sce_dec_data_structure typedef struct cpe_dec_data_structure { - int16_t cpe_id; /* CPE # identifier */ - int32_t element_brate; /* CPE element total bitrate in bps */ - int32_t last_element_brate; /* last CPE element total bitrate in bps */ + Word16 cpe_id; /* CPE # identifier */ + Word32 element_brate; /* CPE element total bitrate in bps */ + Word32 last_element_brate; /* last CPE element total bitrate in bps */ - int16_t element_mode; /* element mode, in CPE it can be IVAS_CPE_DFT, IVAS_CPE_TD or IVAS_CPE_MDCT */ - int16_t last_element_mode; /* last element mode */ + Word16 element_mode; /* element mode, in CPE it can be IVAS_CPE_DFT, IVAS_CPE_TD or IVAS_CPE_MDCT */ + Word16 last_element_mode; /* last element mode */ - int16_t stereo_switching_counter; - int16_t NbFrameMod; + Word16 stereo_switching_counter; + Word16 NbFrameMod; /* core coder handle */ DEC_CORE_HANDLE hCoreCoder[CPE_CHANNELS]; @@ -768,7 +768,7 @@ typedef struct cpe_dec_data_structure STEREO_ICBWE_DEC_HANDLE hStereoICBWE; /* Stereo inter-channel BWE data handle */ STEREO_CNG_DEC_HANDLE hStereoCng; /* Stereo CNG data structure */ - int16_t nchan_out; /* number of output channels (1: mono dmx, 2: default stereo) */ + Word16 nchan_out; /* number of output channels (1: mono dmx, 2: default stereo) */ /* DFT stereo I/O channel buffer memories that need to be updated for TD->DFT stereo switching */ @@ -792,7 +792,7 @@ typedef struct cpe_dec_data_structure /* buffers used for fading between MDCT and DFT Stereo */ - int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ + Word32 brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ } CPE_DEC_DATA, *CPE_DEC_HANDLE; @@ -803,8 +803,8 @@ typedef struct cpe_dec_data_structure typedef struct mct_dec_block_data_struct { - int16_t ch1, ch2; - int16_t mask[2][MAX_SFB]; + Word16 ch1, ch2; + Word16 mask[2][MAX_SFB]; STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct; /* MDCT stereo data handle */ } MCT_DEC_BLOCK_DATA, *MCT_DEC_BLOCK_DATA_HANDLE; @@ -812,14 +812,14 @@ typedef struct mct_dec_block_data_struct typedef struct mct_dec_data_structure { - int16_t nchan_out_woLFE; /* number of active channels within multi-channel configuration */ - int16_t currBlockDataCnt; - int16_t bitsChannelPairIndex; /* bits needed to code channel pair index, depends on number of active channels */ + Word16 nchan_out_woLFE; /* number of active channels within multi-channel configuration */ + Word16 currBlockDataCnt; + Word16 bitsChannelPairIndex; /* bits needed to code channel pair index, depends on number of active channels */ MCT_DEC_BLOCK_DATA_HANDLE hBlockData[MCT_MAX_BLOCKS]; - int16_t chBitRatios[MCT_MAX_CHANNELS]; - int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ - uint16_t mc_global_ild[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ + Word16 chBitRatios[MCT_MAX_CHANNELS]; + Word16 lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ + UWord16 mc_global_ild[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ } MCT_DEC_DATA, *MCT_DEC_HANDLE; @@ -866,12 +866,12 @@ typedef struct ivas_binaural_rendering_struct IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ EFAP_HANDLE hEFAPdata; /* EFAP structure*/ Word32 *hoa_dec_mtx; /* pointer to HOA decoder mtx */ /*Q29*/ - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ + Word8 rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ + Word16 max_band; /* band upto which rendering is performed */ + Word16 conv_band; /* band upto which convolution in cldfb domain is performed */ + Word16 timeSlots; /* number of time slots of binaural renderer */ + Word16 nInChannels; /* number input channels */ + Word8 render_lfe; /* Flag to render LFE in binaural rendering*/ IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ /* Convolution module structure */ @@ -892,18 +892,18 @@ typedef struct ivas_masa_decoder_ext_out_meta_struct { MASA_DECRIPTIVE_META descriptiveMeta; - uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + UWord16 directionIndex[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + UWord8 directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + UWord8 spreadCoherence[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - uint8_t surroundCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - uint8_t diffuseToTotalRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + UWord8 surroundCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + UWord8 diffuseToTotalRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; } MASA_DECODER_EXT_OUT_META; typedef struct ivas_masa_decoder_data_struct { - int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; + Word16 band_mapping[MASA_FREQUENCY_BANDS + 1]; SPHERICAL_GRID_DATA *sph_grid16; MASA_DECODER_EXT_OUT_META *extOutMeta; @@ -922,32 +922,32 @@ typedef struct ivas_masa_decoder_struct /* Data structure for MASA_ISM rendering */ typedef struct ivas_masa_ism_data_structure { - int16_t azimuth_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; - int16_t elevation_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + Word16 azimuth_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + Word16 elevation_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; Word32 energy_ratio_ism_fx[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; /* Q30 */ Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */ - int16_t azimuth_ism_edited[MAX_NUM_OBJECTS]; - int16_t elevation_ism_edited[MAX_NUM_OBJECTS]; - uint8_t ism_is_edited[MAX_NUM_OBJECTS]; + Word16 azimuth_ism_edited[MAX_NUM_OBJECTS]; + Word16 elevation_ism_edited[MAX_NUM_OBJECTS]; + UWord8 ism_is_edited[MAX_NUM_OBJECTS]; - int16_t idx_separated_ism; - int16_t azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; - int16_t elevation_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + Word16 idx_separated_ism; + Word16 azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + Word16 elevation_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; Word32 q_azimuth_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ Word32 q_elevation_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ Word16 ismPreprocMatrix_fx[2][2][CLDFB_NO_CHANNELS_MAX]; /* Q15 */ - uint8_t objectsMoved; + UWord8 objectsMoved; Word32 eneMoveIIR_fx[2][CLDFB_NO_CHANNELS_MAX]; /*Q-22*/ Word32 enePreserveIIR_fx[2][CLDFB_NO_CHANNELS_MAX]; /*Q-22*/ Word32 preprocEneTarget_fx[CLDFB_NO_CHANNELS_MAX]; /*Q-19*/ Word32 preprocEneRealized_fx[CLDFB_NO_CHANNELS_MAX]; /*Q-19*/ Word32 **delayBuffer_fx; /* Q11 */ - int16_t delayBuffer_size; - int16_t delayBuffer_nchan; + Word16 delayBuffer_size; + Word16 delayBuffer_nchan; } MASA_ISM_DATA, *MASA_ISM_DATA_HANDLE; @@ -965,41 +965,41 @@ typedef struct decoder_tc_buffer_structure Word16 no_channels; /*Stores no of channels in tc_fx with values*/ #endif Word16 q_tc_fx; - TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ - int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ - int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ - int16_t nchan_buffer_full; /* number of channels to be fully buffered */ - int16_t n_samples_available; /* samples still available for rendering in the current frame */ - int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ - int16_t n_samples_rendered; /* samples already rendered in the current frame */ - int16_t n_samples_granularity; /* render granularity */ - int16_t n_samples_flushed; - int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; - int16_t nb_subframes; - int16_t subframes_rendered; - int16_t slots_rendered; - int16_t num_slots; - int16_t n_samples_discard; /* number of samples to discard from the beginning of the output */ + TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ + Word16 nchan_transport_jbm; /* number of TCs after TC decoding */ + Word16 nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ + Word16 nchan_buffer_full; /* number of channels to be fully buffered */ + Word16 n_samples_available; /* samples still available for rendering in the current frame */ + Word16 n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ + Word16 n_samples_rendered; /* samples already rendered in the current frame */ + Word16 n_samples_granularity; /* render granularity */ + Word16 n_samples_flushed; + Word16 subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + Word16 nb_subframes; + Word16 subframes_rendered; + Word16 slots_rendered; + Word16 num_slots; + Word16 n_samples_discard; /* number of samples to discard from the beginning of the output */ } DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE; typedef struct jbm_metadata_structure { - int16_t sf_write_idx; - int16_t sf_md_buffer_length; + Word16 sf_write_idx; + Word16 sf_md_buffer_length; - uint16_t directionIndexBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; - uint8_t directToTotalRatioBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; - uint8_t spreadCoherenceBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; - uint8_t surroundCoherenceBuffer[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; - uint8_t diffuseToTotalRatioBuffer[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; - uint8_t numberOfDirections[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES]; /* Descriptive metadata, value is 0 or 1 */ + UWord16 directionIndexBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; + UWord8 directToTotalRatioBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; + UWord8 spreadCoherenceBuffer[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; + UWord8 surroundCoherenceBuffer[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; + UWord8 diffuseToTotalRatioBuffer[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES][MASA_FREQUENCY_BANDS]; + UWord8 numberOfDirections[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_JBM_RINGBUFFER_FRAMES]; /* Descriptive metadata, value is 0 or 1 */ - int16_t slot_read_idx; - int16_t slot_write_idx; - int16_t slot_md_buffer_length; + Word16 slot_read_idx; + Word16 slot_write_idx; + Word16 slot_md_buffer_length; - int16_t sf_to_slot_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME * MASA_JBM_RINGBUFFER_FRAMES]; + Word16 sf_to_slot_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME * MASA_JBM_RINGBUFFER_FRAMES]; } JBM_METADATA, *JBM_METADATA_HANDLE; @@ -1010,25 +1010,25 @@ typedef struct jbm_metadata_structure typedef struct decoder_config_structure { - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ + Word32 ivas_total_brate; /* IVAS total bitrate in bps */ + Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */ + Word32 output_Fs; /* output signal sampling frequency in Hz */ + Word16 nchan_out; /* number of output audio channels */ AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ + Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + Word16 Opt_Headrotation; /* indicates whether head-rotation is used */ + Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ - int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ + Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */ Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain*/ /* Q15 */ - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ - int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ - int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ - int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ + Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + Word16 Opt_ExternalOrientation; /* indiates whether external orientations are used */ + Word16 Opt_dpid_on; /* indicates whether Directivity pattern option is used */ + Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */ + Word16 Opt_tsm; /* indicates whether time scaling modification is activated */ IVAS_RENDER_FRAMESIZE render_framesize; - int16_t Opt_delay_comp; /* flag indicating delay compensation active */ + Word16 Opt_delay_comp; /* flag indicating delay compensation active */ } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; @@ -1047,8 +1047,8 @@ typedef struct Decoder_Struct IVAS_FORMAT ivas_format; /* IVAS format */ IVAS_FORMAT last_ivas_format; /* last frame IVAS format */ - int16_t sid_format; /* IVAS format indicator from SID frame */ - int16_t nchan_transport; /* number of transport channels */ + Word16 sid_format; /* IVAS format indicator from SID frame */ + Word16 nchan_transport; /* number of transport channels */ IVAS_OUTPUT_SETUP hOutSetup; /* output setup structure */ AUDIO_CONFIG intern_config; /* internal audio configuration */ IVAS_OUTPUT_SETUP hIntSetup; /* internal setup structure */ @@ -1056,24 +1056,24 @@ typedef struct Decoder_Struct AUDIO_CONFIG transport_config; /* transport audio configuration */ IVAS_OUTPUT_SETUP hTransSetup; /* transport setup structure */ - int16_t element_mode_init; /* element mode used at initialization */ - int16_t codec_mode; /* Mode 1 or 2 */ - int16_t ini_frame; /* initialization frames counter */ - int16_t ini_active_frame; /* initialization active frames counter */ + Word16 element_mode_init; /* element mode used at initialization */ + Word16 codec_mode; /* Mode 1 or 2 */ + Word16 ini_frame; /* initialization frames counter */ + Word16 ini_active_frame; /* initialization active frames counter */ - int16_t bfi; /* FEC - bad frame indicator */ - int16_t BER_detect; /* BER detect flag */ - int16_t num_bits; /* BER detect flag */ + Word16 bfi; /* FEC - bad frame indicator */ + Word16 BER_detect; /* BER detect flag */ + Word16 num_bits; /* BER detect flag */ - uint16_t *bit_stream; /* Pointer to bitstream buffer */ - int16_t writeFECoffset; /* parameter for debugging JBM stuff */ + UWord16 *bit_stream; /* Pointer to bitstream buffer */ + Word16 writeFECoffset; /* parameter for debugging JBM stuff */ IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */ /* core-decoder modules */ - int16_t nSCE; /* number of total SCEs */ - int16_t nCPE; /* number of total CPEs */ - int16_t nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */ + Word16 nSCE; /* number of total SCEs */ + Word16 nCPE; /* number of total CPEs */ + Word16 nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */ SCE_DEC_HANDLE hSCE[MAX_SCE]; /* SCE handles */ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS]; /* CPE handles */ @@ -1092,12 +1092,12 @@ typedef struct Decoder_Struct LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ - int16_t nchan_ism; /* number of ISM channels */ + Word16 nchan_ism; /* number of ISM channels */ MC_MODE mc_mode; /* MC format mode */ - int16_t sba_order; /* Ambisonic (SBA) order */ - int16_t sba_planar; /* Ambisonic (SBA) planar flag */ - int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ - int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ + Word16 sba_order; /* Ambisonic (SBA) order */ + Word16 sba_planar; /* Ambisonic (SBA) planar flag */ + Word16 sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ + Word16 sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ @@ -1120,7 +1120,7 @@ typedef struct Decoder_Struct Word32 *hoa_dec_mtx; /* Pointer to decoder matrix for SBA */ HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */ RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ - int32_t binaural_latency_ns; /* Binauralization latency in ns */ + Word32 binaural_latency_ns; /* Binauralization latency in ns */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */ DIRAC_REND_HANDLE hDirACRend; /* DirAC renderer handle */ @@ -1128,16 +1128,16 @@ typedef struct Decoder_Struct MASA_ISM_DATA_HANDLE hMasaIsmData; /* OMASA rendering handle */ SBA_ISM_DATA_HANDLE hSbaIsmData; /* OSBA rendering handle */ - int16_t flag_omasa_brate; + Word16 flag_omasa_brate; /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ JBM_METADATA_HANDLE hJbmMetadata; /* Structure for metadata buffering in JBM */ - int32_t last_active_ivas_total_brate; - int16_t ism_extmeta_active; /* Extended metadata active in decoder */ - int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */ + Word32 last_active_ivas_total_brate; + Word16 ism_extmeta_active; /* Extended metadata active in decoder */ + Word16 ism_extmeta_cnt; /* Change frame counter for extended metadata */ Word32 **mem_hp20_out_fx; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* Word32-output audio buffers */ Word16 p_out_len;/*Stores the total no of channels for which memory is allocated to p_output_fx*/ diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 2dd2a30c3..e5e18083d 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -2078,7 +2078,7 @@ void stereo_td2dft_update_fx( ) { Word16 ovl, ovl_TCX, dft32ms_ovl, hq_delay_comp; - Word16 ns, nsLB; + Word16 ns, nsLB, i; Word16 old_out_len, old_outLB_len; Decoder_State **sts; @@ -2181,9 +2181,9 @@ void stereo_td2dft_update_fx( v_add_fx( sts[0]->hHQ_core->old_outLB_fx + nsLB, sts[1]->hHQ_core->old_outLB_fx + nsLB, hCPE->old_outLB_mdct_fx, old_outLB_len ); L_lerp_fx_q11( hCPE->old_outLB_mdct_fx, hCPE->old_outLB_mdct_fx, STEREO_MDCT2DFT_FADE_LEN_48k, old_outLB_len ); #ifndef MSAN_FIX - for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) + for ( i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) #else - FOR( Word32 i = 0; i < old_outLB_len; i++ ) + FOR( i = 0; i < old_outLB_len; i++ ) #endif { hCPE->old_outLB_mdct_fx[i] = L_shr( hCPE->old_outLB_mdct_fx[i], 1 ); /* Q11 */ @@ -2193,7 +2193,7 @@ void stereo_td2dft_update_fx( #ifndef MSAN_FIX for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) #else - FOR( Word32 i = 0; i < old_out_len; i++ ) + FOR( i = 0; i < old_out_len; i++ ) #endif { hCPE->old_out_mdct_fx[i] = L_shr( hCPE->old_out_mdct_fx[i], 1 ); /* q_old_out_mdct */ diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index bb73fe7f0..375dbdad0 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -306,7 +306,6 @@ Word16 svd_fx( Word16 iCh, jCh; Word16 lengthSingularValues; Word16 errorMessage, condition; - // int16_t max_length = ((nChannelsL > nChannelsC) ? nChannelsL : nChannelsC); Word32 secDiag_fx[MAX_OUTPUT_CHANNELS]; #ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE Word16 secDiag_fx_e = 0; diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 939fad2cb..5b5ff16c5 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -67,7 +67,7 @@ struct JB4_DATAUNIT Word16 qBit; /** the binary encoded access unit */ - uint8_t *data; + UWord8 *data; /** the size of the binary encoded access unit [bits] */ UWord16 dataSize; diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 1fe7481df..7955d0ea6 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -92,7 +92,7 @@ typedef struct apa_state_t *PCMDSP_APA_HANDLE; /*! Allocates memory for state struct and initializes elements. * @return 0 on success, 1 on failure */ ivas_error apa_init( apa_state_t **s, - const int32_t num_channels ); + const Word32 num_channels ); /*! Sets state variables to initial value. */ void apa_reset( apa_state_t *s ); @@ -106,7 +106,7 @@ void apa_reset( apa_state_t *s ); * @param[in] output_Fs sample rate [Hz] * @param[in] num_channels number of channels * @return 0 on success, 1 on failure */ -bool apa_set_rate( apa_state_t *ps, const int32_t output_Fs ); +bool apa_set_rate( apa_state_t *ps, const Word32 output_Fs ); /*! Set scaling. * The scale is given in % and will be valid until changed again. @@ -120,7 +120,7 @@ bool apa_set_renderer_residual_samples( apa_state_t *ps, UWord16 l_r_buf ); bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ); -uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts ); +UWord8 apa_reconfigure( apa_state_t *ps, UWord16 num_channels, UWord16 l_ts ); bool apa_set_complexity_options( apa_state_t *s, UWord16 wss, UWord16 css ); @@ -129,5 +129,5 @@ bool apa_set_quality( apa_state_t *s, Word32 quality, UWord16 qualityred, UWord1 bool apa_exit( apa_state_t **s ); UWord8 apa_exec_ivas_fx( apa_state_t *s, const Word32 a_in[], UWord16 l_in, UWord16 maxScaling, Word32 a_out[], UWord16 *l_out ); -uint8_t apa_exec_fx( apa_state_t *s, const Word16 a_in[], UWord16 l_in, UWord16 maxScaling, Word16 a_out[], UWord16 *l_out ); +UWord8 apa_exec_fx( apa_state_t *s, const Word16 a_in[], UWord16 l_in, UWord16 maxScaling, Word16 a_out[], UWord16 *l_out ); #endif /* JBM_PCMDSP_APA_H */ diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h index 3551380de..1d193433e 100644 --- a/lib_dec/jbm_pcmdsp_window.h +++ b/lib_dec/jbm_pcmdsp_window.h @@ -52,7 +52,7 @@ * <------> * n */ -void hannWindow( uint16_t n, float *w ); +void hannWindow( UWord16 n, float *w ); /** Overlap/Add of two signal with a given window. */ /** @param[in] fadeOut signal to fade out diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index 5a3aec3f4..976826949 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -612,7 +612,7 @@ void amr_wb_enc_init_fx( AMRWB_IO_ENC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO encoder handle */ ) { - int16_t i; + Word16 i; /* HF (6-7kHz) BWE */ hAmrwb_IO->seed2_enc = RANDOM_INITSEED; diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 93a0146f3..962b715cd 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -519,7 +519,7 @@ void AVQ_encmux_fx( bit_tmp = add( unusedbitsFlag, unused_bits_idx ); /*nq_est = (int16_t)ceil(0.2f * (bits - 5 * (unusedbitsFlag + unused_bits_idx)));*/ nq_est = mult( 6554, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) ); - assert( (int16_t) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est ); + assert( (Word16) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est ); if ( EQ_16( nq_est, 1 ) ) { @@ -946,7 +946,7 @@ void AVQ_encmux_ivas_fx( bit_tmp = add( unusedbitsFlag, unused_bits_idx ); /*nq_est = (int16_t)ceil(0.2f * (bits - 5 * (unusedbitsFlag + unused_bits_idx)));*/ nq_est = mult( 6554 /*.2 in Q15*/, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) ); - assert( (int16_t) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est ); + assert( (Word16) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est ); if ( EQ_16( nq_est, 1 ) ) { @@ -1085,8 +1085,8 @@ static void wrte_cv( Word16 *nbits /* i/o: bits */ ) { - int16_t pos, j; - int16_t bits, nq4; + Word16 pos, j; + Word16 bits, nq4; bits = *nbits; move16(); @@ -1145,8 +1145,8 @@ static void wrte_cv_ivas_fx( Word16 *nbits /* i/o: bits */ ) { - int16_t pos, j; - int16_t bits, nq4; + Word16 pos, j; + Word16 bits, nq4; bits = *nbits; move16(); diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index a2995245d..1c60f2ecd 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -30,8 +30,8 @@ static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, co static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); static void init_core_sig_ana_ivas_fx( Encoder_State *st ); static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); -static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const int32_t last_total_brate ); -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const int32_t last_total_brate ); +static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); +static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ); /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() @@ -1324,7 +1324,7 @@ static void init_tcx_ivas_fx( * Initialization of signal buffers *-----------------------------------------------------------------------*/ /*copy of evs function since it was static */ -static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const int32_t last_total_brate ) +static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ) { LPD_state_HANDLE hLPDmem = st->hLPDmem; @@ -1542,7 +1542,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) * * *-----------------------------------------------------------------------*/ -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const int32_t last_total_brate ) +static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ) { Word16 mem_syn_r_size_old; Word16 mem_syn_r_size_new; diff --git a/lib_enc/core_enc_reconf_fx.c b/lib_enc/core_enc_reconf_fx.c index 3637dd53f..1ba496b0e 100644 --- a/lib_enc/core_enc_reconf_fx.c +++ b/lib_enc/core_enc_reconf_fx.c @@ -344,7 +344,7 @@ void core_coder_reconfig_fx( void core_coder_reconfig_ivas_fx( Encoder_State *st, - const int32_t last_total_brate ) + const Word32 last_total_brate ) { Word16 i, bwidth, index; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 7dd342318..a509a7cd7 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -1761,7 +1761,7 @@ void E_ACELP_4t_fx( const Word16 last_L_frame, /*Q0*/ const Word32 total_brate, /*Q0*/ const Word16 i_subfr, /*Q0*/ - const int16_t cmpl_flag /*Q0*/ ) + const Word16 cmpl_flag /*Q0*/ ) { PulseConfig config; Word16 ind[NPMAXPT * 4]; @@ -1824,7 +1824,7 @@ void E_ACELP_4t_ivas_fx( const Word16 last_L_frame, /*Q0*/ const Word32 total_brate, /*Q0*/ const Word16 i_subfr, /*Q0*/ - const int16_t cmpl_flag, /*Q0*/ + const Word16 cmpl_flag, /*Q0*/ Word16 element_mode /*Q0*/ ) { PulseConfig config; diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index a36ee78e2..4305e5bca 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -216,7 +216,7 @@ ivas_error ivas_ism_metadata_enc_fx( move16(); Word32 valQ_fx; ISM_METADATA_HANDLE hIsmMetaData; - int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; + Word32 element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; Word16 ism_metadata_flag_global; Word16 non_diegetic_flag_global; Word16 ism_imp[MAX_NUM_OBJECTS]; diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index bb6ef0d01..c4d3908ca 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -574,7 +574,7 @@ ivas_error ivas_mcmasa_enc_reconfig_fx( void ivas_mcmasa_enc_close_fx( MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ - const int32_t input_Fs /* i : input sampling rate */ + const Word32 input_Fs /* i : input sampling rate */ ) { Word16 i, j; diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index 55da30e73..d6bc4c7f0 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -421,7 +421,7 @@ ivas_error ivas_mct_enc_fx( } /* joint MCT encoding */ - ivas_mct_core_enc_fx( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); + ivas_mct_core_enc_fx( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (Word16) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 403d379fa..70b2b0034 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -799,7 +799,7 @@ static void applyStereoPreProcessingCplx( * * encoder-side complex-valued stereo pre-processing (crosstalk) *---------------------------------------------------------------*/ -static uint16_t enc_ste_pre_mdct( +static UWord16 enc_ste_pre_mdct( Word32 *sigR0_fx, /* i/o: MDCT samples of the 1st (left) channel q_com*/ Word32 *sigR1_fx, /* i/o: MDCT samples of the 2nd (right) channel q_com*/ Word32 *sigI0_fx, /* i/o: MDST samples of the 1st (left) channel q_com*/ diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 3416ab279..b32c80404 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -160,7 +160,7 @@ static Word16 encode_coherence_indexesDCT1_fx( BSTR_ENC_HANDLE hMetaData /* i : metadata handle */ ); -static UWord64 create_combined_index_fx( uint16_t *idx_dct, const Word16 len, const Word16 *no_cb_vec ); +static UWord64 create_combined_index_fx( UWord16 *idx_dct, const Word16 len, const Word16 *no_cb_vec ); static Word16 encode_surround_coherence_fx( IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */ @@ -184,7 +184,7 @@ static void ivas_diffuseness_huff_ec_prepare_fx( UWord16 *avr_idx, Word16 *diffuseness_bits_huff ); -static Word16 coherence_coding_length( const uint16_t *idx_sur_coh_shift, const UWord8 idx_shift_len, const Word16 coding_subbands, const Word16 *no_cv, uint16_t *mr_idx, Word16 *no_cv_shift, Word16 *p_min_idx, Word16 *GR_ord, Word16 *nbits_fr, Word16 *nbits_fr1 ); +static Word16 coherence_coding_length( const UWord16 *idx_sur_coh_shift, const UWord8 idx_shift_len, const Word16 coding_subbands, const Word16 *no_cv, UWord16 *mr_idx, Word16 *no_cv_shift, Word16 *p_min_idx, Word16 *GR_ord, Word16 *nbits_fr, Word16 *nbits_fr1 ); static Word16 write_2dir_info( BSTR_ENC_HANDLE hMetaData, UWord8 *twoDirBands, const Word16 n, const Word16 k ); @@ -2326,7 +2326,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( move16(); UWord16 dist_elevation_indexes_best[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_MAXIMUM_CODING_SUBBANDS]; Word16 gr_param_azimuth_best, avg_azimuth_index_best; - uint16_t dist_azimuth_indexes_best[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_MAXIMUM_CODING_SUBBANDS]; + UWord16 dist_azimuth_indexes_best[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_MAXIMUM_CODING_SUBBANDS]; UWord16 idx, dist_count; Word16 direction_bits_ec; diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index e6038186e..e321f1c7c 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -60,7 +60,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - Word16 index; + Word16 index, i; const Word16 split_len = M / 2; move16(); const Word16 *means; @@ -85,7 +85,7 @@ static Word16 sns_1st_cod_fx( Word16 exp_snsq_buffer[M] = { 0 }, exp_snsq = 0; move16(); move16(); - FOR( Word16 i = 0; i < M; ++i ) + FOR( i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 exp_snsq_buffer[i] = 0; @@ -93,11 +93,11 @@ static Word16 sns_1st_cod_fx( snsq_fx[i] = BASOP_Util_Add_Mant32Exp( sns_fx[i], exp_sns, L_negate( tmp ), 15, &exp_snsq_buffer[i] ); move32(); } - FOR( int i = 0; i < M; i++ ) + FOR( i = 0; i < M; i++ ) { exp_snsq = s_max( exp_snsq_buffer[i], exp_snsq ); } - FOR( int i = 0; i < M; i++ ) + FOR( i = 0; i < M; i++ ) { snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); move32(); @@ -121,7 +121,7 @@ static Word16 sns_1st_cod_fx( dist_min_fx = MAXVAL_WORD32; Word16 exp_dist_min = 31; index_split = 0; - FOR( Word16 i = 0; i < 32; ++i ) + FOR( i = 0; i < 32; ++i ) { Word32 dist_fx = 0; move32(); diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 925f4e702..2ace35473 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -1665,7 +1665,7 @@ static void ivas_write_parameter_bitstream_dtx_fx( Word16 *num_dec, const Word16 num_bands ) { - int16_t i, j; + Word16 i, j; Word32 val; Word16 idx; Word32 pr_min_max[2]; diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 3f7237ce5..ede3d3ad9 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -3302,8 +3302,8 @@ static void stereo_dft_enc_compute_prm_fx( Word32 *dot_prod_nrg_ratio_fx, // Q(31-dot_prod_nrg_ratio_fx_e[]) Word16 *dot_prod_nrg_ratio_fx_e ) { - int16_t b, i; - int16_t b2; + Word16 b, i; + Word16 b2; Word32 *pDFT_L, *pDFT_R; // Word16 DFT_L_e, DFT_R_e; Word32 sum_nrg_L, sum_nrg_R; @@ -3352,7 +3352,7 @@ static void stereo_dft_enc_compute_prm_fx( Word16 sum_past_dot_prod_abs_e, sum_past_dot_prod_abs2_e = 0; Word32 sum_past_nrg_dmx; Word16 sum_past_nrg_dmx_e; - int16_t pos; + Word16 pos; Word32 pIpd[STEREO_DFT_BAND_MAX]; // Q13 Word32 ipd_smooth[STEREO_DFT_BAND_MAX]; // Q13 Word32 ipd_mean_change; // Q13 diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index f8d600276..979978c03 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -1006,9 +1006,8 @@ void stereo_tdm_prep_dwnmx_fx( const Word16 input_q /* i : frame lenght */ ) { -#define USER_ENER Word32 mener; - int16_t i, sw_pos, enr_len; + Word16 i, sw_pos, enr_len; Encoder_State **sts; Word16 mener_e; sts = hCPE->hCoreCoder; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 211c53f8c..9d4736368 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -59,8 +59,8 @@ struct IVAS_ENC bool cmd_stereo; #endif bool switchingActive; /* flag for configuration changes during encoding - currently only used with mono */ - int16_t Opt_RF_ON_loc; - int16_t rf_fec_offset_loc; + Word16 Opt_RF_ON_loc; + Word16 rf_fec_offset_loc; bool ismMetadataProvided[MAX_NUM_OBJECTS]; bool maxBandwidthUser; /* Was a specific max bandwith selected by the user? */ IVAS_ENC_BANDWIDTH newBandwidthApi; /* maximum encoded bandwidth, as set on API level */ @@ -77,14 +77,14 @@ static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBitrateISM_fx( const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi ); static Word16 getInputBufferSize_fx( const Encoder_Struct *st_ivas ); -static ivas_error configureEncoder( IVAS_ENC_HANDLE hIvasEnc, const int32_t inputFs, const int32_t initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); -static ivas_error setBitrate( IVAS_ENC_HANDLE hIvasEnc, const int32_t totalBitrate ); +static ivas_error configureEncoder( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +static ivas_error setBitrate( IVAS_ENC_HANDLE hIvasEnc, const Word32 totalBitrate ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); -static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); -static ivas_error fecIndicatorApiToInternal( const IVAS_ENC_FEC_INDICATOR fecIndicator, int16_t *fecIndicatorInternal ); +static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, Word16 *internalMaxBandwidth ); +static ivas_error fecIndicatorApiToInternal( const IVAS_ENC_FEC_INDICATOR fecIndicator, Word16 *fecIndicatorInternal ); #ifdef DEBUGGING static ivas_error forcedModeApiToInternal( IVAS_ENC_FORCED_MODE forcedMode, int16_t *forcedModeInternal ); #endif @@ -276,8 +276,8 @@ void IVAS_ENC_Close( ivas_error IVAS_ENC_ConfigureForMono( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -296,7 +296,7 @@ ivas_error IVAS_ENC_ConfigureForMono( } hIvasEnc->st_ivas->hEncoderConfig->ivas_format = MONO_FORMAT; - hIvasEnc->st_ivas->hEncoderConfig->is_binaural = (int16_t) is_binaural; + hIvasEnc->st_ivas->hEncoderConfig->is_binaural = (Word16) is_binaural; if ( downmixFromStereo ) { @@ -318,8 +318,8 @@ ivas_error IVAS_ENC_ConfigureForMono( ivas_error IVAS_ENC_ConfigureForStereo( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -344,7 +344,7 @@ ivas_error IVAS_ENC_ConfigureForStereo( hEncoderConfig = st_ivas->hEncoderConfig; hEncoderConfig->nchan_inp = 2; hEncoderConfig->ivas_format = STEREO_FORMAT; - hEncoderConfig->is_binaural = (int16_t) is_binaural; + hEncoderConfig->is_binaural = (Word16) is_binaural; #ifdef DEBUGGING switch ( stereoMode ) @@ -458,12 +458,12 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( ivas_error IVAS_ENC_ConfigureForObjects( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ + const UWord16 numObjects, /* i : number of objects to be encoded */ const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ ) { @@ -503,7 +503,7 @@ ivas_error IVAS_ENC_ConfigureForObjects( ivas_error IVAS_ENC_FeedObjectMetadata( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const uint16_t ismIndex, /* i : object index */ + const UWord16 ismIndex, /* i : object index */ const IVAS_ISM_METADATA metadata /* i : object metadata handle for current frame */ ) { @@ -551,8 +551,8 @@ ivas_error IVAS_ENC_FeedObjectMetadata( ivas_error IVAS_ENC_ConfigureForAmbisonics( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -580,7 +580,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( hEncoderConfig->nchan_inp = ivas_sba_get_nchan_fx( hEncoderConfig->sba_order, 0 ); /*planar input arg. deliberately set to zero since input always in ACN/SN3D*/ - hEncoderConfig->Opt_PCA_ON = (int16_t) Opt_PCA_ON; + hEncoderConfig->Opt_PCA_ON = (Word16) Opt_PCA_ON; hIvasEnc->maxBandwidthUser = max_bwidth_user; @@ -780,8 +780,8 @@ ivas_error IVAS_ENC_FeedMasaMetadata( ivas_error IVAS_ENC_ConfigureForMultichannel( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -841,8 +841,8 @@ ivas_error IVAS_ENC_ConfigureForMultichannel( static ivas_error configureEncoder( IVAS_ENC_HANDLE hIvasEnc, - const int32_t inputFs, - const int32_t initBitrate, + const Word32 inputFs, + const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ) @@ -850,7 +850,7 @@ static ivas_error configureEncoder( Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - int32_t cpe_brate; + Word32 cpe_brate; error = IVAS_ERR_OK; @@ -1476,7 +1476,7 @@ static Word16 getInputBufferSize_fx( *---------------------------------------------------------------------*/ ivas_error IVAS_ENC_GetNumInChannels( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - int16_t *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ + Word16 *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ ) { if ( hIvasEnc == NULL || numInChannels == NULL ) @@ -1824,8 +1824,8 @@ ivas_error IVAS_ENC_SetBandwidth( *---------------------------------------------------------------------*/ ivas_error IVAS_ENC_SetBitrate( - IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t totalBitrate /* i : requested bitrate of the output bitstream */ + IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + const Word32 totalBitrate /* i : requested bitrate of the output bitstream */ ) { ivas_error error; @@ -2003,11 +2003,11 @@ const char *IVAS_ENC_GetErrorMessage( static ivas_error printConfigInfo_enc( IVAS_ENC_HANDLE hIvasEnc, - const int16_t channelAwareModeEnabled ) + const Word16 channelAwareModeEnabled ) { Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; - int16_t newBandwidthApi; + Word16 newBandwidthApi; ivas_error error; st_ivas = hIvasEnc->st_ivas; @@ -2237,7 +2237,7 @@ static ivas_error printConfigInfo_enc( static ivas_error setBitrate( IVAS_ENC_HANDLE hIvasEnc, - const int32_t totalBitrate ) + const Word32 totalBitrate ) { Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -2753,8 +2753,8 @@ static ivas_error forcedModeApiToInternal( *---------------------------------------------------------------------*/ ivas_error IVAS_ENC_PrintConfig( - const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ - const int16_t channelAwareModeEnabled /* i : channel-aware mode enabled flag */ + const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ + const Word16 channelAwareModeEnabled /* i : channel-aware mode enabled flag */ ) { return printConfigInfo_enc( hIvasEnc, channelAwareModeEnabled ); diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 4911711d7..ab6c39c23 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -68,7 +68,7 @@ typedef struct _IVAS_ENC_DTX_CONFIG { bool enabled; bool variable_SID_rate; - int16_t SID_interval; + Word16 SID_interval; } IVAS_ENC_DTX_CONFIG; typedef enum _IVAS_ENC_SBA_ORDER @@ -169,8 +169,8 @@ ivas_error IVAS_ENC_Open_fx( /*! r: error code */ ivas_error IVAS_ENC_ConfigureForMono( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -182,8 +182,8 @@ ivas_error IVAS_ENC_ConfigureForMono( /*! r: error code */ ivas_error IVAS_ENC_ConfigureForStereo( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -197,34 +197,34 @@ ivas_error IVAS_ENC_ConfigureForStereo( /*! r: error code */ ivas_error IVAS_ENC_ConfigureForObjects( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ + const UWord16 numObjects, /* i : number of objects to be encoded */ const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ ); /*! r: encoder error code */ ivas_error IVAS_ENC_ConfigureForMASAObjects( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the ouput bitstream */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ - const int16_t masaVariant /* i : index specifying the number of MASA transport channels */ + const UWord16 numObjects, /* i : number of objects to be encoded */ + const Word16 masaVariant /* i : index specifying the number of MASA transport channels */ ); /*! r: encoder error code */ ivas_error IVAS_ENC_ConfigureForSBAObjects( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the ouput bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the ouput bitstream */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects, /* i : number of objects to be encoded */ + const UWord16 numObjects, /* i : number of objects to be encoded */ const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_PCA_ON /* i : PCA option flag */ @@ -233,8 +233,8 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( /*! r: error code */ ivas_error IVAS_ENC_ConfigureForAmbisonics( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -245,8 +245,8 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -257,8 +257,8 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( /*! r: error code */ ivas_error IVAS_ENC_ConfigureForMasa( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -268,8 +268,8 @@ ivas_error IVAS_ENC_ConfigureForMasa( /*! r: encoder error code */ ivas_error IVAS_ENC_ConfigureForMultichannel( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t inputFs, /* i : input sampling frequency */ - const int32_t bitrate, /* i : requested bitrate of the output bitstream */ + const Word32 inputFs, /* i : input sampling frequency */ + const Word32 bitrate, /* i : requested bitrate of the output bitstream */ const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ @@ -285,7 +285,7 @@ void IVAS_ENC_Close( /*! r: error code */ ivas_error IVAS_ENC_FeedObjectMetadata( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const uint16_t ismIndex, /* i : object index */ + const UWord16 ismIndex, /* i : object index */ const IVAS_ISM_METADATA metadata /* i : object metadata handle for current frame */ ); @@ -307,10 +307,10 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( /*! r: error code */ ivas_error IVAS_ENC_EncodeFrameToCompact( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - int16_t *inputBuffer, /* i : PCM input */ - const int16_t inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ - uint8_t *outputBitStream, /* o : pointer to compact output bitstream. The array must already be allocated. */ - uint16_t *numOutBits /* o : number of bits written to output bitstream */ + Word16 *inputBuffer, /* i : PCM input */ + const Word16 inputBufferSize, /* i : total number of samples in the input buffer. Related function: IVAS_ENC_GetInputBufferSize() */ + UWord8 *outputBitStream, /* o : pointer to compact output bitstream. The array must already be allocated. */ + UWord16 *numOutBits /* o : number of bits written to output bitstream */ ); /* Setter functions - apply changes to encoder configuration */ @@ -324,7 +324,7 @@ ivas_error IVAS_ENC_SetBandwidth( /*! r: error code */ ivas_error IVAS_ENC_SetBitrate( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - const int32_t totalBitrate /* i : requested bitrate of the output bitstream */ + const Word32 totalBitrate /* i : requested bitrate of the output bitstream */ ); /*! r: error code */ @@ -355,13 +355,13 @@ ivas_error IVAS_ENC_GetDelay( /*! r: encoder error code */ ivas_error IVAS_ENC_GetNumInChannels( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - int16_t *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ + Word16 *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ ); /*! r: encoder error code */ ivas_error IVAS_ENC_GetInputBufferSize( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ - int16_t *inputBufferSize /* o : total number of samples expected in the input buffer for current encoder configuration */ + Word16 *inputBufferSize /* o : total number of samples expected in the input buffer for current encoder configuration */ ); /* Utility functions */ @@ -388,7 +388,7 @@ const char *IVAS_ENC_GetErrorMessage( ivas_error IVAS_ENC_PrintConfig( const IVAS_ENC_HANDLE hIvasEnc, /* i : IVAS encoder handle */ - const int16_t channelAwareModeEnabled /* i : channel-aware mode enabled flag */ + const Word16 channelAwareModeEnabled /* i : channel-aware mode enabled flag */ ); void IVAS_ENC_PrintDisclaimer( diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index a61b2ebff..24179f375 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -31,9 +31,9 @@ static Word32 vq_lvq_lsf_enc( Word16 pred_flag, Word16 mode, Word16 u[], Word16 static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 pred_flag, Word16 mode, Word16 u[], Word16 *levels, Word16 stages, Word16 w[], Word16 Idx[], const Word16 *lsf, const Word16 *pred, Word16 *resq, Word16 *lsfq ); -static void lsf_mid_enc_fx( BSTR_ENC_HANDLE hBstr, int16_t nb_bits, const Word16 int_fs, const Word16 qlsp0[], const Word16 qlsp1[], Word16 lsp[], const Word16 coder_type, const Word16 bwidth, Word32 Bin_Ener_old[], Word32 Bin_Ener[], Word16 Q_ener, Word16 ppp_mode, Word16 nelp_mode ); +static void lsf_mid_enc_fx( BSTR_ENC_HANDLE hBstr, Word16 nb_bits, const Word16 int_fs, const Word16 qlsp0[], const Word16 qlsp1[], Word16 lsp[], const Word16 coder_type, const Word16 bwidth, Word32 Bin_Ener_old[], Word32 Bin_Ener[], Word16 Q_ener, Word16 ppp_mode, Word16 nelp_mode ); -static void lsf_mid_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, int16_t nb_bits, const Word32 int_fs, const Word16 qlsp0[], const Word16 qlsp1[], Word16 lsp[], const Word16 coder_type, const Word16 bwidth, Word32 Bin_Ener_old[], Word16 Q_ener, Word16 ppp_mode, Word16 nelp_mode ); +static void lsf_mid_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, Word16 nb_bits, const Word32 int_fs, const Word16 qlsp0[], const Word16 qlsp1[], Word16 lsp[], const Word16 coder_type, const Word16 bwidth, Word32 Bin_Ener_old[], Word16 Q_ener, Word16 ppp_mode, Word16 nelp_mode ); /*===========================================================================*/ /* FUNCTION : lsf_enc_fx() */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 7f58a9501..28e1a39de 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -366,7 +366,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( const Word16 st1_syn_vec_e, /* i : exp for IDCT24 synthesis vectors */ const Word32 *u_fx, /* i : target signal */ const Word16 u_e, /* i : exp for target signal */ - const int16_t maxC_st1, /* i : number of candidates in stage1 */ + const Word16 maxC_st1, /* i : number of candidates in stage1 */ Word32 *dist_ptr_fx, /* i/o: updated MSE vector for stage1 */ Word16 *dist_ptr_e /* i/o: exp for updated MSE vector for stage1 */ ) diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 02f8344d1..10d020ee3 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -143,7 +143,7 @@ void bw_detect_fx( const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t mct_on /* i : flag MCT mode */ + const Word16 mct_on /* i : flag MCT mode */ ); void core_switching_post_enc_fx( /*done */ @@ -627,7 +627,7 @@ void swb_bwe_enc_fx( void swb_bwe_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ + const Word16 last_element_mode, /* i : last element mode */ Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */ Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ @@ -1585,7 +1585,7 @@ void E_ACELP_4t_ivas_fx( const Word16 last_L_frame, const Word32 total_brate, const Word16 i_subfr, - const int16_t cmpl_flag, + const Word16 cmpl_flag, Word16 element_mode ); void E_ACELP_innovative_codebook_fx( @@ -3077,15 +3077,15 @@ void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state #ifdef MSAN_FIX Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ #endif - const int16_t igfGridIdx, /* i : IGF grid index */ - Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ - Word16 e_mdct, /* i : exponent of pMDCTspectrum */ - Word32 *pPowerSpectrum_fx, /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ - Word16 *e_ps, /* i : exponent of pPowerSpectrum */ - const int16_t isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */ - const int8_t isTNSActive, /* i : flag indicating if the TNS is active */ - const int16_t sp_aud_decision0, /* i : first stage switching decision */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ + const Word16 igfGridIdx, /* i : IGF grid index */ + Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ + Word16 e_mdct, /* i : exponent of pMDCTspectrum */ + Word32 *pPowerSpectrum_fx, /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ + Word16 *e_ps, /* i : exponent of pPowerSpectrum */ + const Word16 isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */ + const Word8 isTNSActive, /* i : flag indicating if the TNS is active */ + const Word16 sp_aud_decision0, /* i : first stage switching decision */ + const Word16 vad_hover_flag /* i : VAD hangover flag */ ); void IGFEncConcatenateBitstream_ivas_fx( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index ad572d2ba..41c6b0468 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -51,9 +51,9 @@ typedef struct { - int16_t id; /* id of the indice */ - uint16_t value; /* value of the quantized indice */ - int16_t nb_bits; /* number of bits used for the quantization of the indice */ + Word16 id; /* id of the indice */ + UWord16 value; /* value of the quantized indice */ + Word16 nb_bits; /* number of bits used for the quantization of the indice */ } Indice, *INDICE_HANDLE; typedef struct @@ -84,12 +84,12 @@ typedef struct typedef struct bitstream_enc_data_structure { - int16_t nb_ind_tot; /* total number of indices already written */ - int16_t nb_bits_tot; /* total number of bits already written */ - Indice *ind_list; /* list of indices */ - int16_t *ivas_max_num_indices; /* maximum total number of indices in the list */ - Indice **ivas_ind_list_zero; /* beginning of the buffer of indices */ - void *st_ivas; /* IVAS encoder structure */ + Word16 nb_ind_tot; /* total number of indices already written */ + Word16 nb_bits_tot; /* total number of bits already written */ + Indice *ind_list; /* list of indices */ + Word16 *ivas_max_num_indices; /* maximum total number of indices in the list */ + Indice **ivas_ind_list_zero; /* beginning of the buffer of indices */ + void *st_ivas; /* IVAS encoder structure */ // Word16 nb_bits_tot_fx; /* total number of bits already written */ // Indice *ind_list_fx; /* list of indices */ Word16 next_ind_fx; /* pointer to the next empty slot in the list of indices */ @@ -128,9 +128,9 @@ typedef struct signal_buffers_enc_data_structure /* Delay buffer: Used to buffer input samples and to define the subblock size of a transient detector. */ typedef struct { - int16_t nSubblockSize; /* Subblock size of a transient detector that uses this delay buffer. */ + Word16 nSubblockSize; /* Subblock size of a transient detector that uses this delay buffer. */ Word16 buffer[L_FRAME48k / NSUBBLOCKS]; - int16_t nDelay; /* Size of the delay buffer in use. Maximum delay from all users of this buffer. */ + Word16 nDelay; /* Size of the delay buffer in use. Maximum delay from all users of this buffer. */ } DelayBuffer; @@ -141,8 +141,8 @@ typedef struct Word32 subblockNrg[NSUBBLOCKS + MAX_TD_DELAY]; // IVAS Q(-1) Word32 accSubblockNrg[NSUBBLOCKS + MAX_TD_DELAY + 1]; // IVAS Q(-1) Word16 subblockNrgChange[NSUBBLOCKS + MAX_TD_DELAY]; /* EVS: Q7(15 - SUBBLOCK_NRG_CHANGE_E) */ /* IVAS: Q3 */ - int16_t nDelay; /* Size of the delay buffer in use, as number of subblocks. Maximum delay from all users of this buffer. */ - int16_t nPartialDelay; /* Delay of the input (modulo pDelayBuffer->nSubblockSize), nPartialDelay <= pDelayBuffer->nDelay. */ + Word16 nDelay; /* Size of the delay buffer in use, as number of subblocks. Maximum delay from all users of this buffer. */ + Word16 nPartialDelay; /* Delay of the input (modulo pDelayBuffer->nSubblockSize), nPartialDelay <= pDelayBuffer->nDelay. */ /* Decay factor for the recursive accumulation */ Word16 facAccSubblockNrg; @@ -152,27 +152,25 @@ typedef struct Word16 firState2; Word16 q_firState; - uint16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */ + UWord16 ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */ } SubblockEnergies; /* Attack detection function. */ -typedef void ( *TCheckSubblocksForAttack )( const float *pSubblockNrg, const float *pAccSubblockNrg, int16_t nSubblocks, int16_t nPastSubblocks, float attackRatioThreshold, int16_t *pbIsAttackPresent, int16_t *pAttackIndex ); typedef void ( *TCheckSubblocksForAttack_fx )( Word32 const *pSubblockNrg, Word32 const *pAccSubblockNrg, Word16 nSubblocks, Word16 nPastSubblocks, Word16 attackRatioThreshold, Word16 *pbIsAttackPresent, Word16 *pAttackIndex ); /* Transient detector. */ typedef struct TransientDetector { SubblockEnergies *pSubblockEnergies; /* Subblock energies used in this transient detector. */ - int16_t nDelay; /* Delay of the transient detector in number of subblocks, nDelay <= pSubblockEnergies->nDelay. */ - int16_t nSubblocksToCheck; /* Number of subblocks to check for transients. */ - TCheckSubblocksForAttack CheckSubblocksForAttack; /* Function for checking a presence of an attack. */ + Word16 nDelay; /* Delay of the transient detector in number of subblocks, nDelay <= pSubblockEnergies->nDelay. */ + Word16 nSubblocksToCheck; /* Number of subblocks to check for transients. */ TCheckSubblocksForAttack_fx CheckSubblocksForAttack_fx; /* Function for checking a presence of an attack. */ Word16 attackRatioThreshold; /* Attack ratio threshold Q11 */ - int16_t bIsAttackPresent; /* True when an attack was detected. */ - int16_t prev_bIsAttackPresent; /* True if an attack was detected in the previous frame. */ - int16_t attackIndex; /* The index of an attack. */ + Word16 bIsAttackPresent; /* True when an attack was detected. */ + Word16 prev_bIsAttackPresent; /* True if an attack was detected in the previous frame. */ + Word16 attackIndex; /* The index of an attack. */ } TransientDetector; /* Transient detection: Holds all transient detectors and buffers used by them. */ @@ -191,25 +189,25 @@ typedef struct TransientDetection_structure typedef struct vad_structure { - int16_t nb_active_frames; - int16_t hangover_cnt; - int16_t nb_active_frames_he; - int16_t hangover_cnt_he; - int32_t vad_flag_reg_H; - int32_t vad_flag_reg_L; - int32_t vad_prim_reg; - - int16_t vad_flag_cnt_50; - int16_t vad_prim_cnt_16; - - int16_t hangover_cnt_dtx; - int16_t hangover_cnt_music; + Word16 nb_active_frames; + Word16 hangover_cnt; + Word16 nb_active_frames_he; + Word16 hangover_cnt_he; + Word32 vad_flag_reg_H; + Word32 vad_flag_reg_L; + Word32 vad_prim_reg; + + Word16 vad_flag_cnt_50; + Word16 vad_prim_cnt_16; + + Word16 hangover_cnt_dtx; + Word16 hangover_cnt_music; Word16 bcg_flux_fx; // Q4 - int16_t soft_hangover; - int16_t voiced_burst; - int16_t bcg_flux_init; - int16_t nb_active_frames_he1; - int16_t hangover_cnt_he1; + Word16 soft_hangover; + Word16 voiced_burst; + Word16 bcg_flux_init; + Word16 nb_active_frames_he1; + Word16 hangover_cnt_he1; Word16 prim_act_quick_fx; /*Q15 */ /* Noise estimator - primary activity quick */ Word16 prim_act_slow_fx; /*Q15 */ /* Noise estimator - primary activity slow */ Word16 prim_act_fx; /*Q15 */ /* Noise estimator - primary activity slow rise quick fall */ @@ -217,22 +215,22 @@ typedef struct vad_structure Word16 prim_act_slow_he_fx; /*Q15 */ /* Noise estimator - primary activity slow */ Word16 prim_act_he_fx; /*Q15 */ /* Q15 Noise estimator - primary activity slow rise quick fall */ - int16_t spectral_tilt_reset; - int16_t consec_inactive; + Word16 spectral_tilt_reset; + Word16 consec_inactive; Word16 ra_deltasum_fx; - int16_t trigger_SID; + Word16 trigger_SID; Word16 snr_sum_vad_fx; /*Q15 */ Word16 running_avg_fx; /*Q15 */ Word32 L_snr_sum_vad_fx; /*Q4*/ - int16_t hangover_terminate_flag; /* CNG and DTX - flag indicating whether to early terminate DTX hangover */ - int16_t vad_flag; /* VAD flag */ + Word16 hangover_terminate_flag; /* CNG and DTX - flag indicating whether to early terminate DTX hangover */ + Word16 vad_flag; /* VAD flag */ } VAD_DATA, *VAD_HANDLE; typedef struct cldfb_vad_structure { - int16_t bw_index; /* index of band width */ + Word16 bw_index; /* index of band width */ /* feature */ Word16 sp_center[SP_CENTER_NUM]; /* spectral center*/ @@ -248,8 +246,8 @@ typedef struct cldfb_vad_structure Word32 t_bg_energy; /* time background energy of several frames*/ Word16 scale_t_bg_energy; /* the Scaling of t_bg_energy*/ T_VAD_EXP t_bg_energy_sum; /* number of time background energy*/ - int16_t tbg_energy_count; /* sum of time background energy of several frames*/ - int16_t bg_update_count; /* time of background update*/ + Word16 tbg_energy_count; /* sum of time background energy of several frames*/ + Word16 bg_update_count; /* time of background update*/ Word32 frame_energy_smooth; /* smoothed energy of several frames*/ Word16 frame_energy_smooth_scale; /* the Scaling of frame_energy_smooth*/ @@ -268,14 +266,14 @@ typedef struct cldfb_vad_structure Word16 fg_energy_scale; /* the Scaling of fg_energy*/ Word32 bg_energy; /* background energy sum */ Word16 bg_energy_scale; /* the Scaling of bg_energy*/ - int16_t fg_energy_count; /* number of the foreground energy frame */ - int16_t bg_energy_count; /* number of the background energy frame */ + Word16 fg_energy_count; /* number of the foreground energy frame */ + Word16 bg_energy_count; /* number of the background energy frame */ Word32 fg_energy_est_start; /* flag by that indicate whether if estimate energy*/ - int16_t speech_flag; /* residual number of hangover 1 */ - int16_t continuous_noise_num; /* time of continuous noise frames*/ - int16_t continuous_speech_num; /* time of continuous speech frames*/ - int16_t continuous_speech_num2; /* time 2 of continuous speech frames*/ - int16_t frameloop; /* number of frame*/ + Word16 speech_flag; /* residual number of hangover 1 */ + Word16 continuous_noise_num; /* time of continuous noise frames*/ + Word16 continuous_speech_num; /* time of continuous speech frames*/ + Word16 continuous_speech_num2; /* time 2 of continuous speech frames*/ + Word16 frameloop; /* number of frame*/ Word16 tonality_rate3; /* tonality rate*/ Word16 music_background_rate; /* music background rate*/ Word32 lt_noise_sp_center_diff_sum; /* different sum of long time noise sp_center*/ @@ -283,10 +281,10 @@ typedef struct cldfb_vad_structure Word16 lt_noise_sp_center0; /* long time noise sp_center0*/ Word16 lt_noise_sp_center3; /* long time noise sp_center3*/ Word32 lt_bg_highf_eng; /* average of long time high frequency energy*/ - int16_t update_num_with_snr; /* the number of the background update with SNR*/ - int16_t update_count; - int16_t warm_hang_num; /* the number of hangover for warm up*/ - int16_t vad_flag_for_bk_update; + Word16 update_num_with_snr; /* the number of the background update with SNR*/ + Word16 update_count; + Word16 warm_hang_num; /* the number of hangover for warm up*/ + Word16 vad_flag_for_bk_update; } T_CldfbVadState, *VAD_CLDFB_HANDLE; @@ -326,7 +324,7 @@ typedef struct td_cng_enc_structure Word16 cng_buf_cnt; /* CNG and DTX - Counter of buffered CNG parameters */ Word16 cng_exc2_buf[HO_HIST_SIZE * L_FFT]; /* CNG and DTX - exc2 buffer for storing */ Word16 cng_Qexc_buf[HO_HIST_SIZE]; /* CNG and DTX - Q_exc buffer for storing */ - int32_t cng_brate_buf[HO_HIST_SIZE]; /* CNG and DTX - buffer for storing last_active_brate */ + Word32 cng_brate_buf[HO_HIST_SIZE]; /* CNG and DTX - buffer for storing last_active_brate */ Word16 CNG_att_fx; /* CNG and DTX - attenuation factor for CNG, in dB Q7 */ Word16 ho_16k_lsp[HO_HIST_SIZE]; /* CNG and DTX - 16k LSPs flags */ Word16 act_cnt2; /* CNG and DTX - counter of active frames for CNG_mode switching */ @@ -432,23 +430,23 @@ typedef struct dtx_enc_structure typedef struct igfscfenc_public_data_struct { - int16_t ptrBitIndex; - int16_t bitCount; - int16_t prev[64]; /* no more than 64 SCFs for the IGF energy envelope of one block */ - int16_t prevSave[64]; - int16_t scfCountLongBlock[IGF_NOF_GRIDS]; - int16_t t; - int16_t Tsave; - int16_t contex_saved; - const uint16_t *cf_se00; - const uint16_t *cf_se01; - int16_t cf_off_se01; - const uint16_t *cf_se02; - const int16_t *cf_off_se02; - const uint16_t *cf_se10; - int16_t cf_off_se10; - const uint16_t *cf_se11; - const int16_t *cf_off_se11; + Word16 ptrBitIndex; + Word16 bitCount; + Word16 prev[64]; /* no more than 64 SCFs for the IGF energy envelope of one block */ + Word16 prevSave[64]; + Word16 scfCountLongBlock[IGF_NOF_GRIDS]; + Word16 t; + Word16 Tsave; + Word16 contex_saved; + const UWord16 *cf_se00; + const UWord16 *cf_se01; + Word16 cf_off_se01; + const UWord16 *cf_se02; + const Word16 *cf_off_se02; + const UWord16 *cf_se10; + Word16 cf_off_se10; + const UWord16 *cf_se11; + const Word16 *cf_off_se11; Tastat acState; TastatEnc acState_fx; @@ -749,21 +747,21 @@ typedef struct acelp_cbkcorr_structure typedef struct gsc_enc_structure { - int16_t seed_tcx; /* AC mode (GSC) - seed for noise fill */ - int16_t cor_strong_limit; /* AC mode (GSC) - Indicator about high spectral correlation per band */ - int16_t mem_last_pit_band; /* AC mode (GSC) - memory of the last band where pitch contribution was significant */ + Word16 seed_tcx; /* AC mode (GSC) - seed for noise fill */ + Word16 cor_strong_limit; /* AC mode (GSC) - Indicator about high spectral correlation per band */ + Word16 mem_last_pit_band; /* AC mode (GSC) - memory of the last band where pitch contribution was significant */ Word16 mem_w0_tmp_fx; Word16 mem_syn_tmp_fx[M]; Word16 mid_dyn_fx; /* AC mode (GSC) - signal dynamic Q7 */ - int16_t noise_lev; /* AC mode (GSC) - noise level */ - int16_t past_dyn_dec; /* AC mode (GSC) - Past noise level decision */ + Word16 noise_lev; /* AC mode (GSC) - noise level */ + Word16 past_dyn_dec; /* AC mode (GSC) - Past noise level decision */ Word32 Last_frame_ener_fx; /* AC mode (GSC) - Last frame energy */ - int16_t pit_exc_hangover; /* AC mode (GSC) - Hangover for the time contribution switching */ + Word16 pit_exc_hangover; /* AC mode (GSC) - Hangover for the time contribution switching */ Word16 last_exc_dct_in_fx[L_FRAME16k]; /* AC mode (GSC) - previous exciation */ Word16 Q_last_exc_dct_in; - Word16 last_ener_fx; /* AC mode (GSC) - previous energy Q0 */ - int16_t last_bitallocation_band[6]; /* AC mode (GSC) - previous bit allocation of each band */ - Word16 lt_gpitch_fx; /* Q15 */ + Word16 last_ener_fx; /* AC mode (GSC) - previous energy Q0 */ + Word16 last_bitallocation_band[6]; /* AC mode (GSC) - previous bit allocation of each band */ + Word16 lt_gpitch_fx; /* Q15 */ } GSC_ENC_DATA, *GSC_ENC_HANDLE; @@ -804,14 +802,14 @@ typedef struct hq_enc_structure /* PVQ range coder state */ typedef struct pvq_enc_structure { - uint32_t rc_low; - uint32_t rc_range; - int16_t rc_cache; - int16_t rc_carry; - int16_t rc_carry_count; - int16_t rc_num_bits; - int16_t rc_tot_bits; - int16_t rc_offset; + UWord32 rc_low; + UWord32 rc_range; + Word16 rc_cache; + Word16 rc_carry; + Word16 rc_carry_count; + Word16 rc_num_bits; + Word16 rc_tot_bits; + Word16 rc_offset; } PVQ_ENC_DATA, *PVQ_ENC_HANDLE; @@ -838,33 +836,33 @@ typedef struct sc_vbr_enc_structure Word16 nelp_lp_fit_mem[NELP_LP_ORDER * 2]; /* Q(prev_Q_new) */ Word32 bp1_filt_mem_nb_fx[14]; /* Q(qprevGain_fx) */ - int16_t nelp_enc_seed; + Word16 nelp_enc_seed; Word16 nelp_gain_mem_fx; /* Q0 */ - int16_t last_nelp_mode; - int16_t nelp_mode; + Word16 last_nelp_mode; + Word16 nelp_mode; Word16 qprevIn_fx; Word16 qprevGain_fx; /* PPP variables */ - int16_t pppcountE; - int16_t bump_up; - int16_t last_ppp_mode; - int16_t last_last_ppp_mode; - int16_t ppp_mode; + Word16 pppcountE; + Word16 bump_up; + Word16 last_ppp_mode; + Word16 last_last_ppp_mode; + Word16 ppp_mode; Word16 prev_ppp_gain_pit_fx; /* Q14 */ Word16 prev_tilt_code_fx; /* Q15 */ /* voiced encoder variables */ - int16_t firstTime_voicedenc; + Word16 firstTime_voicedenc; /* DTFS variables */ Word16 dtfs_enc_a_fx[MAXLAG_WI]; /* Q(dtfs_enc_Q) */ Word16 dtfs_enc_b_fx[MAXLAG_WI]; /* Q(dtfs_enc_Q) */ - int16_t dtfs_enc_lag; - int16_t dtfs_enc_nH; - int16_t dtfs_enc_nH_4kHz; + Word16 dtfs_enc_lag; + Word16 dtfs_enc_nH; + Word16 dtfs_enc_nH_4kHz; Word16 dtfs_enc_upper_cut_off_freq_of_interest_fx; /* Q0 */ Word16 dtfs_enc_upper_cut_off_freq_fx; /* Q0 */ Word16 dtfs_enc_Q; @@ -876,23 +874,23 @@ typedef struct sc_vbr_enc_structure Word16 lasterbE_fx[NUM_ERB_WB]; /* Previous Amplitude spectrum (ERB) Q13 */ Word16 Q_prev_cw_en_fx; - int16_t mode_QQF; - int16_t rate_control; + Word16 mode_QQF; + Word16 rate_control; Word16 SNR_THLD_fx; /* Q8 */ - int16_t Q_to_F; - int16_t pattern_m; - int16_t patterncount; - int16_t Last_Resort; - int16_t numactive; /* keep the count of the frames inside current 600 frame block */ + Word16 Q_to_F; + Word16 pattern_m; + Word16 patterncount; + Word16 Last_Resort; + Word16 numactive; /* keep the count of the frames inside current 600 frame block */ Word32 sum_of_rates_fx; /*Q=13 sum of the rates of past 600 active frames*/ Word32 global_avr_rate_fx; /*Q=13 global rate upto current time. recorded a (rate in kbps) *6000*/ - int16_t global_frame_cnt; /* 600 active frame block count. Used to update the global rate */ - int16_t set_ppp_generic; - int16_t avoid_HQ_VBR_NB; + Word16 global_frame_cnt; /* 600 active frame block count. Used to update the global rate */ + Word16 set_ppp_generic; + Word16 avoid_HQ_VBR_NB; - int16_t vbr_generic_ho; - int16_t Local_VAD; - int16_t last_7k2_coder_type; + Word16 vbr_generic_ho; + Word16 Local_VAD; + Word16 last_7k2_coder_type; } SC_VBR_ENC_DATA, *SC_VBR_ENC_HANDLE; @@ -910,7 +908,7 @@ typedef struct amrwb_io_enc_structure Word16 mem_hp400_enc_fx[6]; Word16 mem_hf_enc_fx[L_FIR - 1]; Word16 mem_syn_hf_enc_fx[M]; - int16_t seed2_enc; + Word16 seed2_enc; } AMRWB_IO_ENC_DATA, *AMRWB_IO_ENC_HANDLE; @@ -944,7 +942,7 @@ typedef struct td_bwe_enc_structure Word16 state_syn_shbexc_fx[L_SHB_LAHEAD]; /* Q(prev_Q_bwe_exc - 16) */ Word16 state_lpc_syn_fx[LPC_SHB_ORDER]; /* Q(prev_Q_bwe_exc - 16) */ Word16 old_bwe_exc_fx[PIT16k_MAX * 2]; /*Q_exc*/ - int16_t bwe_seed[2]; + Word16 bwe_seed[2]; Word32 bwe_non_lin_prev_scale_fx; /* Q30 */ Word16 old_bwe_exc_extended_fx[NL_BUFF_OFFSET]; /* Q(prev_Q_bwe_exc - 16) */ Word16 syn_overlap_fx[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain */ @@ -964,7 +962,7 @@ typedef struct td_bwe_enc_structure Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; /* Q(Q_shb_spch) */ Word16 lsp_shb_spacing_fx[3]; /* Q15 */ Word16 prev_swb_GainShape_fx; /* Q15 */ - int16_t prev_frGainAtten; + Word16 prev_frGainAtten; Word16 prev_wb_GainShape; /* Q15 */ Word16 swb_lsp_prev_interp_fx[LPC_SHB_ORDER]; /* Q15 */ @@ -973,25 +971,25 @@ typedef struct td_bwe_enc_structure Word16 fb_tbe_demph_fx; Word16 tilt_mem_fx; /* Q12 */ - int16_t prev_coder_type; + Word16 prev_coder_type; Word16 prev_lsf_diff_fx[LPC_SHB_ORDER - 2]; /* Q15 */ Word16 prev_tilt_para_fx; /* Q10 */ Word16 cur_sub_Aq_fx[M + 1]; /* Q12 */ /* quantized data */ - int16_t lsf_idx[NUM_Q_LSF]; - int16_t m_idx; - int16_t grid_idx; - int16_t idxSubGains; - int16_t idxFrameGain; - int16_t idx_shb_fr_gain; - int16_t idx_res_gs[NB_SUBFR16k]; - int16_t idx_mixFac; - - int16_t lsf_WB; - int16_t gFrame_WB; - - int16_t idxGain; + Word16 lsf_idx[NUM_Q_LSF]; + Word16 m_idx; + Word16 grid_idx; + Word16 idxSubGains; + Word16 idxFrameGain; + Word16 idx_shb_fr_gain; + Word16 idx_res_gs[NB_SUBFR16k]; + Word16 idx_mixFac; + + Word16 lsf_WB; + Word16 gFrame_WB; + + Word16 idxGain; Word16 dec_2_over_3_mem_fx[L_FILT_2OVER3]; Word16 dec_2_over_3_mem_lp_fx[6]; @@ -1041,9 +1039,9 @@ typedef struct fd_bwe_enc_structure typedef struct rf_enc_structure { - int16_t rf_frame_type; - int16_t rf_targetbits_buff[MAX_RF_FEC_OFFSET]; - int16_t rf_indx_frametype[MAX_RF_FEC_OFFSET]; + Word16 rf_frame_type; + Word16 rf_targetbits_buff[MAX_RF_FEC_OFFSET]; + Word16 rf_indx_frametype[MAX_RF_FEC_OFFSET]; ACELP_config acelp_cfg_rf; /* configuration for RF frame */ @@ -1054,31 +1052,31 @@ typedef struct rf_enc_structure struct dispMem_fx rf_dm_fx; Word32 rf_gc_threshold; - int16_t rf_target_bits; + Word16 rf_target_bits; Word16 rf_tilt_buf[NB_SUBFR16k]; - int16_t rf_indx_lsf[MAX_RF_FEC_OFFSET][3]; - int16_t rf_indx_pitch[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; - int16_t rf_indx_fcb[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; - int16_t rf_indx_gain[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; - int16_t rf_indx_EsPred[MAX_RF_FEC_OFFSET]; - int16_t rf_indx_ltfMode[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; + Word16 rf_indx_lsf[MAX_RF_FEC_OFFSET][3]; + Word16 rf_indx_pitch[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; + Word16 rf_indx_fcb[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; + Word16 rf_indx_gain[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; + Word16 rf_indx_EsPred[MAX_RF_FEC_OFFSET]; + Word16 rf_indx_ltfMode[MAX_RF_FEC_OFFSET][NB_SUBFR16k]; - int16_t rf_indx_nelp_fid[MAX_RF_FEC_OFFSET]; - int16_t rf_indx_nelp_iG1[MAX_RF_FEC_OFFSET]; - int16_t rf_indx_nelp_iG2[MAX_RF_FEC_OFFSET][2]; + Word16 rf_indx_nelp_fid[MAX_RF_FEC_OFFSET]; + Word16 rf_indx_nelp_iG1[MAX_RF_FEC_OFFSET]; + Word16 rf_indx_nelp_iG2[MAX_RF_FEC_OFFSET][2]; - int16_t rf_indx_tbeGainFr[MAX_RF_FEC_OFFSET]; + Word16 rf_indx_tbeGainFr[MAX_RF_FEC_OFFSET]; - int16_t rf_tcxltp_pitch_int_past; - int16_t rf_last_tns_active; - int16_t rf_second_last_tns_active; - int16_t rf_second_last_core; - int16_t rf_clas[MAX_RF_FEC_OFFSET]; - int16_t rf_gain_tcx[MAX_RF_FEC_OFFSET]; - int16_t rf_tcxltp_param[MAX_RF_FEC_OFFSET]; + Word16 rf_tcxltp_pitch_int_past; + Word16 rf_last_tns_active; + Word16 rf_second_last_tns_active; + Word16 rf_second_last_core; + Word16 rf_clas[MAX_RF_FEC_OFFSET]; + Word16 rf_gain_tcx[MAX_RF_FEC_OFFSET]; + Word16 rf_tcxltp_param[MAX_RF_FEC_OFFSET]; - int16_t RF_bwe_gainFr_ind; + Word16 RF_bwe_gainFr_ind; } RF_ENC_DATA, *RF_ENC_HANDLE; @@ -1088,17 +1086,17 @@ typedef struct rf_enc_structure typedef struct plc_enc_evs_structure { - int16_t nBits; /* number of bits */ + Word16 nBits; /* number of bits */ Word16 Q_new; Word16 Q_exp; - int16_t enableGplc; - int16_t T0_4th; - int16_t T0; - int16_t calcOnlylsf; - int16_t pit_min; - int16_t pit_max; + Word16 enableGplc; + Word16 T0_4th; + Word16 T0; + Word16 calcOnlylsf; + Word16 pit_min; + Word16 pit_max; Word16 mem_MA_14Q1[M]; Word16 mem_AR[M]; @@ -1131,8 +1129,8 @@ typedef struct tec_enc_structure Word16 loTempEnv[CLDFB_NO_COL_MAX]; /* Q7 */ Word16 loTempEnv_ns[CLDFB_NO_COL_MAX]; /* Q7 */ Word16 hiTempEnv[CLDFB_NO_COL_MAX + DELAY_TEMP_ENV_BUFF_TEC + EXT_DELAY_HI_TEMP_ENV]; /* Q7 */ - int16_t tranFlag; - int16_t corrFlag; + Word16 tranFlag; + Word16 corrFlag; } TEC_ENC_DATA, *TEC_ENC_HANDLE; @@ -1143,63 +1141,63 @@ typedef struct tec_enc_structure typedef struct tcx_enc_structure { - int16_t L_frameTCX; + Word16 L_frameTCX; - int16_t tcxMode; /* Chosen TCX mode for this frame */ - int16_t transform_type[2]; /* TCX20/10/5 mode in each subframe */ + Word16 tcxMode; /* Chosen TCX mode for this frame */ + Word16 transform_type[2]; /* TCX20/10/5 mode in each subframe */ /* Core Signal Analysis Outputs */ Word16 noiseTiltFactor; /* compensation for LPC tilt in noise filling Q15 */ - int16_t noiseLevelMemory_cnt; /* counter of consecutive low TCX noise levels */ + Word16 noiseLevelMemory_cnt; /* counter of consecutive low TCX noise levels */ Word16 ltpGainMemory_fx[N_LTP_GAIN_MEMS]; /* for smoothing noiseTransWidth Q15 */ STnsData tnsData[2]; - // int16_t fUseTns[2]; + // Word16 fUseTns[2]; Word8 fUseTns[2]; - int16_t bTnsOnWhithenedSpectra[2]; + Word16 bTnsOnWhithenedSpectra[2]; - // int16_t memQuantZeros[L_FRAME_PLUS]; /* Quantization deadzone flags */ + // Word16 memQuantZeros[L_FRAME_PLUS]; /* Quantization deadzone flags */ Word8 memQuantZeros[L_FRAME_PLUS]; /* Quantization deadzone flags */ Word16 *speech_TCX; Word16 *new_speech_TCX; // Word16 q_speech_TCX; - int16_t tcxltp; - int16_t tcxltp_pitch_int; - int16_t tcxltp_pitch_fr; + Word16 tcxltp; + Word16 tcxltp_pitch_int; + Word16 tcxltp_pitch_fr; Word16 tcxltp_gain; /* Q15 */ - int16_t tcxltp_pitch_int_past; - int16_t tcxltp_pitch_fr_past; + Word16 tcxltp_pitch_int_past; + Word16 tcxltp_pitch_fr_past; Word16 tcxltp_gain_past; /* Q15 */ Word16 tcxltp_norm_corr_past; /* Q15 */ Word16 tcxltp_norm_corr_mem; /* Q15 */ Word16 kernel_switch_corr_past; /* Q15 */ - uint16_t kernel_type[2]; /* transform kernel type in each subframe (MDCT or MDST) */ - uint16_t kernel_symmetry_past; /* last TDA symmetry (0 for MDCT, 1 for MDST type) */ - uint16_t enc_ste_pre_corr_past; + UWord16 kernel_type[2]; /* transform kernel type in each subframe (MDCT or MDST) */ + UWord16 kernel_symmetry_past; /* last TDA symmetry (0 for MDCT, 1 for MDST type) */ + UWord16 enc_ste_pre_corr_past; Word32 tfm_mem_fx; /* state of IIR filtered temporal flatness measure Q31 */ Word16 buf_speech_ltp[L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k]; Word16 exp_buf_speech_ltp; Word16 *speech_ltp; Word16 *new_speech_ltp; - int16_t tcxltp_filt_idx; - int16_t tcxltp_bits; - int16_t tcxltp_param[LTPSIZE]; - int16_t tcxltp_on_mem; + Word16 tcxltp_filt_idx; + Word16 tcxltp_bits; + Word16 tcxltp_param[LTPSIZE]; + Word16 tcxltp_on_mem; Word16 measuredBwRatio; /* measured bw; used for TCX noise-filling. 1Q14 */ - int16_t nmStartLine; /* Starting line for the noise measurement */ + Word16 nmStartLine; /* Starting line for the noise measurement */ - int16_t tcx_lpc_shaped_ari; + Word16 tcx_lpc_shaped_ari; Word16 old_out_fx[L_FRAME32k]; /* buffer for OLA; at the encoder, the maximum length is L_FRAME32k (corresponds to maximum internal L_frame length) */ Word16 Q_old_out; /* MDCT switching */ Word16 prev_hi_ener; /* Q8 */ - int16_t prev_hi_sparse; + Word16 prev_hi_sparse; Word16 clas_sec_old_fx; /* Q13 */ - int16_t clas_final_old; + Word16 clas_final_old; Word32 last_gain1; /* Q(31 - st->last_enerBuffer_exp) */ Word32 last_gain2; /* Q(31 - st->last_enerBuffer_exp) */ @@ -1209,7 +1207,7 @@ typedef struct tcx_enc_structure Word16 q_Txnq; Word16 tcx_target_bits_fac; /* Q14 */ - int16_t tns_ms_flag[2]; + Word16 tns_ms_flag[2]; Word32 *spectrum_fx[2]; /* MDCT output for a short block */ Word16 spectrum_e[2]; Word32 spectrum_long_fx[N_MAX]; /* MDCT output for a long block. Points to spectrum */ @@ -1241,9 +1239,9 @@ typedef struct enc_core_structure Word16 idchan; /* channel ID (audio channel number) */ Word16 id_element; /* element ID */ - int16_t element_mode; /* element mode */ + Word16 element_mode; /* element mode */ Word16 last_element_mode; /* element mode */ - int32_t element_brate; /* element bitrate */ + Word32 element_brate; /* element bitrate */ Word16 extl_orig; /* extension layer */ Word32 extl_brate_orig; /* extension layer bitrate */ Word16 codec_mode; /* Mode1 or Mode2 */ @@ -1257,40 +1255,40 @@ typedef struct enc_core_structure BSTR_ENC_HANDLE hBstr; /* encoder bitstream handle */ Word16 last_enerBuffer_exp; - int16_t bitstreamformat; /* Bitstream format flag (G.192/MIME) */ - Word16 next_bit_pos_fx; /* position of the next bit to be written in the bitstream */ - - int32_t input_Fs; /* input signal sampling frequency in Hz */ - int32_t total_brate; /* total bitrate in kbps of the codec */ - int32_t last_total_brate; /* last frame's total bitrate in kbps of the codec */ - int32_t last_total_brate_cng; /* last inactive frame's total bitrate in kbps of the codec */ - int16_t core; /* core (ACELP_CORE, TCX_20_CORE, TCX_10_CORE, HQ_CORE, AMR_WB_CORE) */ - int16_t last_core; /* previous frame core */ - int16_t coder_type; /* core coder type */ - int16_t flag_ACELP16k; /* flag indicating use of ACELP core at 16kHz internal sampling rate */ - int32_t core_brate; /* core bitrate */ - int32_t last_core_brate; /* previous frame core bitrate */ - int16_t extl; /* extension layer */ - int16_t last_extl; /* previous extension layer */ - int32_t extl_brate; /* extension layer bitrate */ - int16_t input_bwidth; /* input signal bandwidth */ - int16_t bwidth; /* encoded bandwidth NB, WB, SWB or FB */ - int16_t max_bwidth; /* maximum encoded bandwidth */ - int16_t last_input_bwidth; /* input signal bandwidth in the previous frame */ - int16_t last_bwidth; /* coded bandwidth in the previous frame */ - int16_t last_bwidth_cng; /* coded bandwidth in the previous inactive frame */ - int16_t bwidth_sw_cnt; /* bandwidth switching counter */ - int16_t L_frame; /* ACELP core internal frame length */ - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - int16_t Opt_DTX_ON; /* flag indicating DTX operation */ - int16_t cng_type; /* flag indicating LP or CLDFB based SID/CNG */ - int16_t cng_sba_flag; /* flag indicating CNG/SID for SBA 2TC */ - int16_t Opt_SC_VBR; /* flag indicating SC-VBR mode */ - int16_t last_Opt_SC_VBR; /* flag indicating prev frame's SC-VBR mode */ - int16_t low_rate_mode; /* low-rate mode flag */ - int16_t inactive_coder_type_flag; /* inactive coder type flag (0 = AVQ / 1 = GSC) */ + Word16 bitstreamformat; /* Bitstream format flag (G.192/MIME) */ + Word16 next_bit_pos_fx; /* position of the next bit to be written in the bitstream */ + + Word32 input_Fs; /* input signal sampling frequency in Hz */ + Word32 total_brate; /* total bitrate in kbps of the codec */ + Word32 last_total_brate; /* last frame's total bitrate in kbps of the codec */ + Word32 last_total_brate_cng; /* last inactive frame's total bitrate in kbps of the codec */ + Word16 core; /* core (ACELP_CORE, TCX_20_CORE, TCX_10_CORE, HQ_CORE, AMR_WB_CORE) */ + Word16 last_core; /* previous frame core */ + Word16 coder_type; /* core coder type */ + Word16 flag_ACELP16k; /* flag indicating use of ACELP core at 16kHz internal sampling rate */ + Word32 core_brate; /* core bitrate */ + Word32 last_core_brate; /* previous frame core bitrate */ + Word16 extl; /* extension layer */ + Word16 last_extl; /* previous extension layer */ + Word32 extl_brate; /* extension layer bitrate */ + Word16 input_bwidth; /* input signal bandwidth */ + Word16 bwidth; /* encoded bandwidth NB, WB, SWB or FB */ + Word16 max_bwidth; /* maximum encoded bandwidth */ + Word16 last_input_bwidth; /* input signal bandwidth in the previous frame */ + Word16 last_bwidth; /* coded bandwidth in the previous frame */ + Word16 last_bwidth_cng; /* coded bandwidth in the previous inactive frame */ + Word16 bwidth_sw_cnt; /* bandwidth switching counter */ + Word16 L_frame; /* ACELP core internal frame length */ + Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + Word16 Opt_DTX_ON; /* flag indicating DTX operation */ + Word16 cng_type; /* flag indicating LP or CLDFB based SID/CNG */ + Word16 cng_sba_flag; /* flag indicating CNG/SID for SBA 2TC */ + Word16 Opt_SC_VBR; /* flag indicating SC-VBR mode */ + Word16 last_Opt_SC_VBR; /* flag indicating prev frame's SC-VBR mode */ + Word16 low_rate_mode; /* low-rate mode flag */ + Word16 inactive_coder_type_flag; /* inactive coder type flag (0 = AVQ / 1 = GSC) */ #ifdef DEBUGGING - int16_t force; /* flag indicating specific signal type (0 = speech, 1 = music, -1 = N/A) */ + Word16 force; /* flag indicating specific signal type (0 = speech, 1 = music, -1 = N/A) */ #ifdef DEBUG_FORCE_DIR char *force_dir; /* directory containing external binary files for modes/parameters enforcement (empty string indicates no enforcement) */ #endif @@ -1328,13 +1326,13 @@ typedef struct enc_core_structure * ACELP core parameters *----------------------------------------------------------------------------------*/ - int16_t clas; /* current frame clas */ - int16_t last_clas; /* previous frame signal classification */ + Word16 clas; /* current frame clas */ + Word16 last_clas; /* previous frame signal classification */ Word16 prev_fmerit; /* previous signal classification score Q15 */ Word16 fmerit_dt; /* signal classification score difference Q15 */ - int16_t Nb_ACELP_frames; + Word16 Nb_ACELP_frames; - int16_t pitch[3]; /* open-loop pitch values @12.8 kHz for three half-frames */ + Word16 pitch[3]; /* open-loop pitch values @12.8 kHz for three half-frames */ // Word16 pitch_fx[3]; Word16 voicing_fx[3]; /* open-loop normalized correlation values for three half-frames Q15 */ @@ -1348,7 +1346,7 @@ typedef struct enc_core_structure Word16 lsf_old_fx[M]; /* old LSF vector at the end of the frame Qlog2(2.56) */ Word16 lsp_old16k_fx[M]; /* old LSP vector at the end of the frame @16kHz Q15 */ Word16 lspold_enc_fx[M]; /* old LSP vector at the end of the frame @16kHz Q15 */ - int16_t pstreaklen; /* LSF quantizer */ + Word16 pstreaklen; /* LSF quantizer */ Word16 streaklimit_fx; /* LSF quantizer Q15 */ Word16 stab_fac_fx; /* LSF stability factor Q15 */ Word16 clip_var_fx[6]; /* pitch gain clipping memory [2.56x,Q14,Q8,Q0,Q14,Q14] */ @@ -1375,42 +1373,42 @@ typedef struct enc_core_structure Word16 mem_deemph_fx; /* deemphasis filter memory */ Word32 mem_hp20_in_fx[5]; /* HP filter memory for AMR-WB IO */ Word16 mCb1_fx; /* LSF quantizer - counter of stationary frames after a transition frame */ - int16_t GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ - int16_t GSC_IVAS_mode; + Word16 GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ + Word16 GSC_IVAS_mode; GSC_ENC_HANDLE hGSCEnc; - int16_t Last_pulse_pos; /* FEC - last position of the first glottal pulse in the frame */ + Word16 Last_pulse_pos; /* FEC - last position of the first glottal pulse in the frame */ Word16 lsfoldbfi0_fx[M]; /* FEC - LSF vector of the previous frame Qlog2(2.56) */ Word16 lsfoldbfi1_fx[M]; /* FEC - LSF vector of the past previous frame Qlog2(2.56) */ Word16 lsf_adaptive_mean_fx[M]; /* FEC - adaptive mean LSF vector for FEC Qlog2(2.56) */ - int16_t next_force_safety_net; /* FEC - flag to force safety net in next frame */ + Word16 next_force_safety_net; /* FEC - flag to force safety net in next frame */ // Word16 next_force_safety_net_fx; /* FEC - flag to force safety net in next frame */ - int16_t uv_count; /* Stationary noise UV modification - unvoiced counter */ - int16_t act_count; /* Stationary noise UV modification - activation counter */ + Word16 uv_count; /* Stationary noise UV modification - unvoiced counter */ + Word16 act_count; /* Stationary noise UV modification - activation counter */ Word32 ge_sm_fx; /* Stationary noise UV modification - smoothed excitation gain Q(GE_SHIFT) */ Word16 lspold_s_fx[M]; /* Stationary noise UV modification - old LSP vector Q15 */ - int16_t noimix_seed; /* Stationary noise UV modification - mixture seed */ + Word16 noimix_seed; /* Stationary noise UV modification - mixture seed */ Word16 min_alpha_fx; /* Stationary noise UV modification - minimum alpha Q15 */ Word16 exc_pe_fx; /* Stationary noise UV modification - memory of the preemphasis filter */ - int16_t coder_type_raw; /* raw coder_type (before UNVOICED is lost) */ - int16_t last_coder_type_raw; /* raw last_coder_type (coming from the sigal classification) */ - int16_t last_coder_type; /* previous coding type */ + Word16 coder_type_raw; /* raw coder_type (before UNVOICED is lost) */ + Word16 last_coder_type_raw; /* raw last_coder_type (coming from the sigal classification) */ + Word16 last_coder_type; /* previous coding type */ Word16 old_thres_fx; /* normalized correlation weighting in open-loop pitch Q14 */ Word16 old_corr_fx; /* normalized correlation in previous frame (mean value) Q15 */ - int16_t old_pitch; /* previous pitch for open-loop pitch search */ - int16_t delta_pit; /* open-loop pitch extrapolation correction */ + Word16 old_pitch; /* previous pitch for open-loop pitch search */ + Word16 delta_pit; /* open-loop pitch extrapolation correction */ Word32 ee_old_fx; /* previous frame low/high frequency energy ratio Q6 */ - int16_t min_band; /* minimum critical band of useful bandwidth */ - int16_t max_band; /* maximum critical band of useful bandwidth */ - int16_t tc_cnt; /* TC frame counter */ - int16_t audio_frame_cnt; /* Counter of relative presence of audio frames */ + Word16 min_band; /* minimum critical band of useful bandwidth */ + Word16 max_band; /* maximum critical band of useful bandwidth */ + Word16 tc_cnt; /* TC frame counter */ + Word16 audio_frame_cnt; /* Counter of relative presence of audio frames */ Word32 old_dE1_fx; /* Maximum energy increase in previous frame Q13 */ - int16_t old_ind_deltaMax; /* Index of the sub-subframe of maximum energy in previous frame */ + Word16 old_ind_deltaMax; /* Index of the sub-subframe of maximum energy in previous frame */ Word32 old_enr_ssf_fx[2 * NB_SSF]; /* Maxima of energies per sub-subframes of previous frame */ - int16_t spike_hyst; /* Hysteresis to prevent UC after sharp energy spike */ - int16_t last_harm_flag_acelp; /* harmonicity flag for ACELP @32kbps rate */ + Word16 spike_hyst; /* Hysteresis to prevent UC after sharp energy spike */ + Word16 last_harm_flag_acelp; /* harmonicity flag for ACELP @32kbps rate */ Word16 old_Aq_12_8_fx[M + 1]; /* Q12 old Aq[] for core switching */ Word16 old_Es_pred_fx; /* old Es_pred for core switching Q8 */ Word16 music_hysteresis_fx; /* Counter of frames after AUDIO coding mode to prevent UC */ @@ -1433,7 +1431,7 @@ typedef struct enc_core_structure Word16 voicing0_sm_fx; Word16 voicing_sm_fx; Word16 LF_EnergyRatio_sm_fx; - int16_t predecision_flag; + Word16 predecision_flag; Word32 diff_sm_fx; /* Q7 */ Word32 energy_sm_fx; /* Q7 */ @@ -1492,9 +1490,9 @@ typedef struct enc_core_structure Word16 lgBin_E_fx[L_FFT / 2]; /* Q8 per bin energy of two frames */ - int16_t sp_aud_decision0; /* 1st stage speech/music decision flag */ - int16_t sp_aud_decision1; /* 1st stage speech/music classification flag */ - int16_t sp_aud_decision2; /* 2nd stage speech/music classification flag */ + Word16 sp_aud_decision0; /* 1st stage speech/music decision flag */ + Word16 sp_aud_decision1; /* 1st stage speech/music classification flag */ + Word16 sp_aud_decision2; /* 2nd stage speech/music classification flag */ /*----------------------------------------------------------------------------------* * VAD/DTX/CNG @@ -1505,9 +1503,9 @@ typedef struct enc_core_structure VAD_CLDFB_HANDLE hVAD_CLDFB; T_CldfbVadState vad_st; - int16_t vad_flag; /* i : VAD flag */ - int16_t sharpFlag; - int16_t localVAD; /* i : local VAD flag */ + Word16 vad_flag; /* i : VAD flag */ + Word16 sharpFlag; + Word16 localVAD; /* i : local VAD flag */ Word32 bckr_tilt_lt; /* Q16 */ Word16 lp_speech_fx; /* Q8 */ @@ -1517,7 +1515,7 @@ typedef struct enc_core_structure Word16 voicing_old_fx; Word16 var_SID_rate_flag_fx; /* CNG and DTX - flag for variable SID rate */ Word16 interval_SID_fx; - int16_t active_cnt; /* counter of active frames */ + Word16 active_cnt; /* counter of active frames */ TD_CNG_ENC_HANDLE hTdCngEnc; @@ -1544,10 +1542,10 @@ typedef struct enc_core_structure *----------------------------------------------------------------------------------*/ HANDLE_FD_CNG_ENC hFdCngEnc; - int16_t fd_cng_reset_flag; + Word16 fd_cng_reset_flag; Word16 last_totalNoise_fx; /* Q8 */ Word16 totalNoise_increase_hist_fx[TOTALNOISE_HIST_SIZE]; /* Q8 */ - int16_t totalNoise_increase_len; + Word16 totalNoise_increase_len; /*----------------------------------------------------------------------------------* * SC-VBR parameters @@ -1564,7 +1562,7 @@ typedef struct enc_core_structure Word16 old_hpfilt_out_fx; Word32 EnergyLT_fx; /* Q(EnergyLT_fx_exp) */ Word32 Energy_Old_fx; - int16_t TransientHangOver; + Word16 TransientHangOver; HQ_ENC_HANDLE hHQ_core; /* HQ core encoder handle */ @@ -1588,21 +1586,21 @@ typedef struct enc_core_structure Word16 lt_mean_NB_fx; /* Q11 */ Word16 lt_mean_WB_fx; /* Q11 */ Word16 lt_mean_SWB_fx; /* Q11 */ - int16_t count_WB; - int16_t count_SWB; - int16_t count_FB; + Word16 count_WB; + Word16 count_SWB; + Word16 count_FB; /*----------------------------------------------------------------------------------* * Channel-aware mode *----------------------------------------------------------------------------------*/ - int16_t rf_mode; /* flag to signal the RF mode */ - int16_t rf_mode_last; - int16_t last_rf_mode_cng; - int16_t Opt_RF_ON; - int16_t rf_fec_offset; - int16_t rf_target_bits_write; - int16_t rf_fec_indicator; + Word16 rf_mode; /* flag to signal the RF mode */ + Word16 rf_mode_last; + Word16 last_rf_mode_cng; + Word16 Opt_RF_ON; + Word16 rf_fec_offset; + Word16 rf_target_bits_write; + Word16 rf_fec_indicator; RF_ENC_HANDLE hRF; /* RF encoder handle */ @@ -1650,17 +1648,17 @@ typedef struct enc_core_structure Word16 *wspeech_enc; // exp_buf_wspeech_enc Word16 *synth; - int16_t enableTcxLpc; /* global toggle for the TCX LPC quantizer */ - int16_t envWeighted; /* are is{p,f}_old_q[] weighted or not? */ + Word16 enableTcxLpc; /* global toggle for the TCX LPC quantizer */ + Word16 envWeighted; /* are is{p,f}_old_q[] weighted or not? */ - int16_t acelpEnabled; /* Flag indicating if ACELP can be used */ - int16_t tcx10Enabled; /* Flag indicating if TCX 10 can be used */ - int16_t tcx20Enabled; /* Flag indicating if TCX 20 can be used */ + Word16 acelpEnabled; /* Flag indicating if ACELP can be used */ + Word16 tcx10Enabled; /* Flag indicating if TCX 10 can be used */ + Word16 tcx20Enabled; /* Flag indicating if TCX 20 can be used */ Word16 mem_wsp_enc; /* wsp vector memory */ - int16_t nb_bits_header_ace; /* number of bits for the header */ - int16_t nb_bits_header_tcx; /* number of bits for the header */ + Word16 nb_bits_header_ace; /* number of bits for the header */ + Word16 nb_bits_header_tcx; /* number of bits for the header */ Word16 preemph_fac; /*Preemphasis factor Q15*/ Word16 gamma; /* Q15 */ @@ -1669,7 +1667,7 @@ typedef struct enc_core_structure TRAN_DET_HANDLE hTranDet; TransientDetection transientDetection; Word16 transient_info[3]; - int16_t acelpFramesCount; + Word16 acelpFramesCount; Word16 prevTempFlatness_fx; /* exponent is AVG_FLAT_E Q7 in EVS */ /* Q4 in IVAS */ // float currEnergyLookAhead; @@ -1684,34 +1682,34 @@ typedef struct enc_core_structure Word16 parcorr[2]; Word16 parcorr_mid[2]; - int16_t lpcQuantization; + Word16 lpcQuantization; Word16 numlpc; - int16_t encoderLookahead_enc; - int16_t encoderPastSamples_enc; - int16_t encoderLookahead_FB; + Word16 encoderLookahead_enc; + Word16 encoderPastSamples_enc; + Word16 encoderLookahead_FB; /* pitch_ol for adaptive lag window */ - int16_t old_pitch_la; /* past open loop pitch lag from look-ahead before very short stable pitch detection */ + Word16 old_pitch_la; /* past open loop pitch lag from look-ahead before very short stable pitch detection */ Word16 old_voicing_la; /* past open loop pitch gain from look-ahead */ Word32 band_energies[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor MODE2_E_MIN */ Word16 band_energies_exp; /* exponent for energy in critical bands without minimum noise floor MODE2_E_MIN */ - int16_t acelp_autocorr; /* Optimize acelp in 0 covariance or 1 correlation domain */ + Word16 acelp_autocorr; /* Optimize acelp in 0 covariance or 1 correlation domain */ - int16_t pit_min; - int16_t pit_fr1; - int16_t pit_fr1b; - int16_t pit_fr2; - int16_t pit_max; - int16_t pit_res_max; + Word16 pit_min; + Word16 pit_fr1; + Word16 pit_fr1b; + Word16 pit_fr2; + Word16 pit_max; + Word16 pit_res_max; /* for FAC */ - int16_t L_frame_past; + Word16 L_frame_past; /*Adaptive BPF*/ - int16_t bpf_gain_param; + Word16 bpf_gain_param; Word32 mem_bpf_fx1[2 * L_FILT16k]; Word32 mem_error_bpf_fx[2 * L_FILT16k]; Word16 bpf_T[NB_SUBFR16k]; @@ -1726,24 +1724,24 @@ typedef struct enc_core_structure Word16 noise_shift_old; } mem_bpf_fx; - int16_t glr; - int16_t glr_idx[2]; + Word16 glr; + Word16 glr_idx[2]; Word32 mean_gc[2]; /* Q15 */ Word16 prev_lsf4_mean; /* Qlog2(2.56) */ - int16_t glr_reset; - int32_t last_sr_core; + Word16 glr_reset; + Word32 last_sr_core; Word16 last_stab_fac; /* Q15 */ Word32 gain_code[NB_SUBFR16k]; /*for rate switching*/ - int16_t rate_switching_reset; /*Rate switching flag requiring a reset of memories at least partially */ - int16_t rate_switching_reset_16kHz; + Word16 rate_switching_reset; /*Rate switching flag requiring a reset of memories at least partially */ + Word16 rate_switching_reset_16kHz; - int16_t enablePlcWaveadjust; - int16_t Tonal_SideInfo; + Word16 enablePlcWaveadjust; + Word16 Tonal_SideInfo; - int16_t seed_acelp; + Word16 seed_acelp; PLC_ENC_EVS_HANDLE hPlcExt; @@ -1752,23 +1750,23 @@ typedef struct enc_core_structure *----------------------------------------------------------------------------------*/ IGF_ENC_INSTANCE_HANDLE hIGFEnc; /* IGF encoder handle */ - int16_t igf; + Word16 igf; /*----------------------------------------------------------------------------------* * TEC *----------------------------------------------------------------------------------*/ - int16_t tec_tfa; + Word16 tec_tfa; TEC_ENC_HANDLE hTECEnc; /* TEC encoder handle */ - int16_t tec_flag; - int16_t tfa_flag; + Word16 tec_flag; + Word16 tfa_flag; Word32 tfa_enr[N_TEC_TFA_SUBFR]; /*---------------------------------------------------------------* * IVAS parameters *---------------------------------------------------------------*/ - int16_t tdm_LRTD_flag; /* LRTD stereo mode flag */ + Word16 tdm_LRTD_flag; /* LRTD stereo mode flag */ Word16 cna_dirac_flag; /* CNA in DirAC flag */ /* stereo switching memories */ @@ -1813,24 +1811,24 @@ typedef struct enc_core_structure Word16 prev_lpc_wb_fx[LPC_SHB_ORDER_WB]; Word16 prev_lsp_wb_temp_fx[LPC_SHB_ORDER_WB]; - int16_t sba_br_sw_while_no_data; /* Indicator for SBA bitrate switch while in FRAME_NO_DATA mode */ + Word16 sba_br_sw_while_no_data; /* Indicator for SBA bitrate switch while in FRAME_NO_DATA mode */ } Encoder_State, *ENC_CORE_HANDLE; typedef struct GainItemStr { - int16_t gainIndex; + Word16 gainIndex; } GainItem; typedef struct context_rc_mem_struct { - int16_t nbits_old; - int16_t ctx; + Word16 nbits_old; + Word16 ctx; Word64 bit_estimate_fx; /* Q23 */ - int16_t rateFlag; - int16_t lastnz; - int16_t nt_half; + Word16 rateFlag; + Word16 lastnz; + Word16 nt_half; } RC_CONTEXT_MEM, *HANDLE_RC_CONTEXT_MEM; diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 2ca0b6d74..b1a3f2f20 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -282,7 +282,7 @@ void wb_bwe_enc_ivas_fx( *-------------------------------------------------------------------*/ void swb_bwe_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ + const Word16 last_element_mode, /* i : last element mode */ Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */ Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */ const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index 3bad5fa7f..7bbc54780 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1390,7 +1390,7 @@ void swb_pre_proc_ivas_fx( } /* Dirty downsampling to match Nyquist to upper frequency limit of target */ - lerp( st->input_fx, new_swb_speech, L_resamp, (int16_t) Mpy_32_32( input_Fs, one_by_50_Q31 ) ); + lerp( st->input_fx, new_swb_speech, L_resamp, extract_l( Mpy_32_32( input_Fs, one_by_50_Q31 ) ) ); /* flip the spectrum */ Copy( new_swb_speech, spchTmp, L_resamp ); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 2a6f040ac..7247b6446 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -48,14 +48,12 @@ void ComputeSpectrumNoiseMeasure_fx( const Word32 *powerSpec, Word8 *noiseFlags, Word16 lowpassLine ) { - Word16 i, lastTone; + Word16 i, lastTone, j; Word32 s, c; Word16 tmp16; Word32 tmp1, tmp2 = 0; /* initialization only to avoid compiler warning, not counted */ move32(); - int j; - IF( resetMemory != 0 ) { FOR( i = 0; i < lowpassLine; i++ ) @@ -81,7 +79,7 @@ void ComputeSpectrumNoiseMeasure_fx( const Word32 *powerSpec, i = sub( startLine, 1 ); s = 0; move32(); - for ( j = -7; j < 8; j++ ) + FOR( j = -7; j < 8; j++ ) { s = L_add( s, L_shr( powerSpec[i + j], 4 ) ); } diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 82d24ceba..3c88ca224 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -1288,7 +1288,7 @@ static void UpdateDelayBuffer( Word16 const *input, Word16 nSamplesAvailable, De move16(); nDelay = pDelayBuffer->nDelay; - assert( ( nDelay >= 0 ) && ( nDelay <= (int) sizeof( pDelayBuffer->buffer ) / (int) sizeof( pDelayBuffer->buffer[0] ) ) ); + assert( ( nDelay >= 0 ) && ( nDelay <= (Word32) sizeof( pDelayBuffer->buffer ) / (Word32) sizeof( pDelayBuffer->buffer[0] ) ) ); assert( nSamplesAvailable <= NSUBBLOCKS * pDelayBuffer->nSubblockSize ); /* If this is not the last frame */ IF( EQ_16( nSamplesAvailable, imult1616( NSUBBLOCKS, pDelayBuffer->nSubblockSize ) ) ) @@ -1307,7 +1307,7 @@ static void UpdateSubblockEnergies( Word16 const *input, Word16 nSamplesAvailabl Word16 i; - assert( ( pSubblockEnergies->nDelay >= 0 ) && ( pSubblockEnergies->nDelay + NSUBBLOCKS <= (int) sizeof( pSubblockEnergies->subblockNrg ) / (int) sizeof( pSubblockEnergies->subblockNrg[0] ) ) ); + assert( ( pSubblockEnergies->nDelay >= 0 ) && ( pSubblockEnergies->nDelay + NSUBBLOCKS <= (Word32) sizeof( pSubblockEnergies->subblockNrg ) / (Word32) sizeof( pSubblockEnergies->subblockNrg[0] ) ) ); assert( pSubblockEnergies->nPartialDelay <= pSubblockEnergies->pDelayBuffer->nDelay ); /* At least one block delay is required when subblock energy change is required */ assert( pSubblockEnergies->nDelay >= 1 ); @@ -1332,7 +1332,7 @@ static void UpdateSubblockEnergies_ivas_fx( Word16 const *input, Word16 nSamples Word16 i; - assert( ( pSubblockEnergies->nDelay >= 0 ) && ( pSubblockEnergies->nDelay + NSUBBLOCKS <= (int) sizeof( pSubblockEnergies->subblockNrg ) / (int) sizeof( pSubblockEnergies->subblockNrg[0] ) ) ); + assert( ( pSubblockEnergies->nDelay >= 0 ) && ( pSubblockEnergies->nDelay + NSUBBLOCKS <= (Word32) sizeof( pSubblockEnergies->subblockNrg ) / (Word32) sizeof( pSubblockEnergies->subblockNrg[0] ) ) ); assert( pSubblockEnergies->nPartialDelay <= pSubblockEnergies->pDelayBuffer->nDelay ); /* At least one block delay is required when subblock energy change is required */ assert( pSubblockEnergies->nDelay >= 1 ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7e41581f4..730705ffd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -83,8 +83,8 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; typedef struct hrtfGainCache { - int16_t azi; - int16_t ele; + Word16 azi; + Word16 ele; Word32 shVec_fx[HRTF_SH_CHANNELS]; @@ -92,13 +92,13 @@ typedef struct hrtfGainCache typedef struct parambin_rend_config_data { - int16_t separateCenterChannelRendering; + Word16 separateCenterChannelRendering; IVAS_FORMAT ivas_format; MC_MODE mc_mode; - int32_t ivas_total_brate; - int16_t nchan_transport; + Word32 ivas_total_brate; + Word16 nchan_transport; Word32 qualityBasedSmFactor_fx; /* Q31 */ - int16_t processReverb; + Word16 processReverb; ISM_MODE ism_mode; } PARAMBIN_REND_CONFIG, *PARAMBIN_REND_CONFIG_HANDLE; @@ -113,7 +113,7 @@ static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBi static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q*/, Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q*/, Word32 Rmat_fx[3][3] /*Q30*/, const Word16 subframe, const Word16 isHeadtracked, const MASA_ISM_DATA_HANDLE hMasaIsmData, Word16 q ); -static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, Word32 Rmat[3][3] /*Q30*/, const Word16 subframe, const Word16 isHeadtracked, const Word16 nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData ); +static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const Word16 max_band_decorr, Word32 Rmat[3][3] /*Q30*/, const Word16 subframe, const Word16 isHeadtracked, const Word16 nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData ); static void ivas_dirac_dec_binaural_process_output_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], Word32 *output_fx[] /*q_out*/, Word16 *q_out, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, const Word16 q_inp, const Word16 max_band_decorr, const Word16 numInChannels, const Word16 processReverb, const Word16 subframe, const Word16 q_mat ); @@ -137,8 +137,8 @@ static void matrixTransp2Mul_fx( Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, #ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx - int Ascale, - int Bscale, + Word32 Ascale, + Word32 Bscale, #endif Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, @@ -3810,8 +3810,8 @@ static void matrixTransp2Mul_fx( Word32 Bim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word16 *q_B, #ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx - int Ascale, - int Bscale, + Word32 Ascale, + Word32 Bscale, #endif Word32 outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 32803f6c3..e89414542 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -67,7 +67,7 @@ *------------------------------------------------------------------------*/ static void get_lattice_coeffs_fx( const Word16 band_index, const Word16 channel_index, Word16 *lattice_coeffs ); -static void lattice2allpass_fx( const int16_t filter_length, const Word16 *lattice_coeffs_fx, Word16 *filter_coeffs_num_real_fx, Word16 *filter_coeffs_den_real_fx ); +static void lattice2allpass_fx( const Word16 filter_length, const Word16 *lattice_coeffs_fx, Word16 *filter_coeffs_num_real_fx, Word16 *filter_coeffs_den_real_fx ); /*------------------------------------------------------------------------- * ivas_dirac_dec_decorr_open() @@ -1280,7 +1280,7 @@ static void get_lattice_coeffs_fx( /* convert lattice filter coeffs to all pass transfer function coeffs */ static void lattice2allpass_fx( - const int16_t filter_length, // Q0 + const Word16 filter_length, // Q0 const Word16 *lattice_coeffs_fx, // Q15 Word16 *filter_coeffs_num_real_fx, // Q12 Word16 *filter_coeffs_den_real_fx ) // Q12 diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 6b41815c4..c8e6aa12f 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -165,13 +165,13 @@ static ivas_error calc_jot_t60_coeffs_fx( Word16 *pH_dB_fx, Word16 pH_dB_exp, co * *------------------------------------------------------------------------*/ -static uint16_t binRend_rand( +static UWord16 binRend_rand( REVERB_STRUCT_HANDLE hReverb /* i/o: binaural reverb handle */ ) { hReverb->binRend_RandNext = hReverb->binRend_RandNext * 1103515245 + 12345; - return (uint16_t) ( hReverb->binRend_RandNext / 65536 ) % 32768; + return (UWord16) ( hReverb->binRend_RandNext / 65536 ) % 32768; } @@ -886,9 +886,9 @@ static ivas_error calc_jot_t60_coeffs_fx( Word32 L_tmp; Word16 f0_fx, tmp_fx, lf_target_gain_dB_fx, hf_target_gain_dB_fx, mid_crossing_gain_dB_fx; Word16 lin_gain_lf_fx, lin_gain_hf_fx, shift, expl, exph; - int16_t f_idx, e = pH_dB_exp; + Word16 f_idx, e = pH_dB_exp; move16(); - uint16_t n_points_lf, n_points_hf; + UWord16 n_points_lf, n_points_hf; lf_target_gain_dB_fx = 0; move16(); @@ -1471,7 +1471,7 @@ ivas_error ivas_reverb_open_fx( { ivas_error error; REVERB_HANDLE pState = NULL; - Word16 bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; + Word16 bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx, i; ivas_reverb_params_t params; Word32 pColor_target_l_fx[RV_LENGTH_NR_FC]; Word32 pColor_target_r_fx[RV_LENGTH_NR_FC]; @@ -1559,7 +1559,7 @@ ivas_error ivas_reverb_open_fx( set_reverb_acoustic_data_fx( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); Scale_sig32( params.pFc_fx, nr_fc_fft_filter, -2 ); - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pRt60_fx[i] = L_abs( params.pRt60_fx[i] ); move32(); @@ -1601,7 +1601,7 @@ ivas_error ivas_reverb_open_fx( Word32 *pT60_filter_coeff = (Word32 *) malloc( ( lenT60_filter_coeff ) * sizeof( Word32 * ) ); - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pDsr_fx[i] = L_shl( params.pDsr_fx[i], params.pDsr_e[i] ); move32(); @@ -1610,7 +1610,7 @@ ivas_error ivas_reverb_open_fx( pHrtf_avg_pwr_response_r_const[i] = L_shl( params.pHrtf_avg_pwr_response_r_const_fx[i], 5 ); /*Q23+5*/ move32(); } - FOR( Word16 i = 0; i < lenT60_filter_coeff; i++ ) + FOR( i = 0; i < lenT60_filter_coeff; i++ ) { pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); move32(); @@ -1648,20 +1648,20 @@ ivas_error ivas_reverb_open_fx( { /* Computing correlation filters on the basis of target IA coherence */ #ifdef MSAN_FIX - FOR( int i = 0; i < shl( sub( nr_fc_fft_filter, 1 ), 1 ); i++ ) + FOR( i = 0; i < shl( sub( nr_fc_fft_filter, 1 ), 1 ); i++ ) { pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ move32(); } #else - FOR( int i = 0; i < RV_FILTER_MAX_FFT_SIZE; i++ ) + FOR( i = 0; i < RV_FILTER_MAX_FFT_SIZE; i++ ) { pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ } #endif // MSAN_FIX Word32 *pHrtf_inter_aural_coherence_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 ) ); - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { pHrtf_inter_aural_coherence_const[i] = L_shl( params.pHrtf_inter_aural_coherence_const_fx[i], 3 ); /*Scaling up to Q30*/ move32(); @@ -1670,14 +1670,14 @@ ivas_error ivas_reverb_open_fx( free( pHrtf_inter_aural_coherence_const ); - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch0_fx[i][0] = L_shl( pFft_wf_filter_ch0_fx[i][0], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); pFft_wf_filter_ch0_fx[i][1] = L_shl( pFft_wf_filter_ch0_fx[i][1], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); } - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch1_fx[i][0] = L_shl( pFft_wf_filter_ch1_fx[i][0], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); @@ -1699,14 +1699,14 @@ ivas_error ivas_reverb_open_fx( /* Computing coloration filters on the basis of target responses */ ivas_reverb_calc_color_filters_fx( pColor_target_l_fx, pColor_target_r_fx, pTime_window_fx, pState->fft_size, pFft_wf_filter_ch0_fx, pFft_wf_filter_ch1_fx, &q_pFft_wf_filter_ch0_fx, &q_pFft_wf_filter_ch1_fx ); - FOR( int i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch0_fx[i][0] = L_shl( pFft_wf_filter_ch0_fx[i][0], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); pFft_wf_filter_ch0_fx[i][1] = L_shl( pFft_wf_filter_ch0_fx[i][1], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); } - FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) + FOR( i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch1_fx[i][0] = L_shl( pFft_wf_filter_ch1_fx[i][0], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); @@ -2492,7 +2492,7 @@ ivas_error ivas_binaural_reverb_open_parambin( const Word16 numBins, /* i : number of CLDFB bins Q0 */ const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame Q0 */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ - const int32_t sampling_rate, /* i : sampling rate Q0 */ + const Word32 sampling_rate, /* i : sampling rate Q0 */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ ) { diff --git a/lib_rend/ivas_rom_binaural_crend_head.h b/lib_rend/ivas_rom_binaural_crend_head.h index bc0d3cd17..2b4c3e919 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.h +++ b/lib_rend/ivas_rom_binaural_crend_head.h @@ -56,13 +56,13 @@ extern Word32 CRendBin_Combined_HRIR_latency_s_fx; /* Sample Rate = 48000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; +extern Word16 CRendBin_Combined_HRIR_max_num_iterations_48kHz; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[15]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][240]; extern Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; @@ -70,13 +70,13 @@ extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNEL /* Sample Rate = 32000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; +extern Word16 CRendBin_Combined_HRIR_max_num_iterations_32kHz; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[15]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][160]; extern Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; @@ -84,13 +84,13 @@ extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNEL /* Sample Rate = 16000 */ -extern int16_t CRendBin_Combined_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; +extern Word16 CRendBin_Combined_HRIR_max_num_iterations_16kHz; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[15]; -extern uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][80]; extern Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; @@ -105,13 +105,13 @@ extern Word32 CRendBin_FOA_HRIR_latency_s_fx; /* Sample Rate = 48000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; +extern Word16 CRendBin_FOA_HRIR_max_num_iterations_48kHz; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[4]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[4][BINAURAL_CHANNELS][240]; extern Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[4][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; @@ -119,13 +119,13 @@ extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; +extern Word16 CRendBin_FOA_HRIR_max_num_iterations_32kHz; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[4]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[4][BINAURAL_CHANNELS][160]; extern Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[4][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; @@ -133,13 +133,13 @@ extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_FOA_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; +extern Word16 CRendBin_FOA_HRIR_max_num_iterations_16kHz; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[4]; -extern uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[4][BINAURAL_CHANNELS][80]; extern Word32 CRendBin_FOA_HRIR_coeff_im_16kHz_fx[4][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; @@ -153,13 +153,13 @@ extern Word32 CRendBin_HOA2_HRIR_latency_s_fx; /* Sample Rate = 48000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; +extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_48kHz; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[9]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[9][BINAURAL_CHANNELS][240]; extern Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[9][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; @@ -167,13 +167,13 @@ extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; +extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_32kHz; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[9]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[9][BINAURAL_CHANNELS][160]; extern Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[9][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; @@ -181,13 +181,13 @@ extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_HOA2_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; +extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_16kHz; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[9]; -extern uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[9][BINAURAL_CHANNELS][80]; extern Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[9][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; @@ -200,13 +200,13 @@ extern Word32 CRendBin_HOA3_HRIR_latency_s_fx; /* Sample Rate = 48000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; +extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_48kHz; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[16]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[16][BINAURAL_CHANNELS][240]; extern Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[16][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; @@ -214,13 +214,13 @@ extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; +extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_32kHz; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[16]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[16][BINAURAL_CHANNELS][160]; extern Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[16][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; @@ -228,13 +228,13 @@ extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ -extern int16_t CRendBin_HOA3_HRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]; -extern uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; +extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_16kHz; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[16]; -extern uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; extern Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[16][BINAURAL_CHANNELS][80]; extern Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[16][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; @@ -248,13 +248,13 @@ extern Word32 CRendBin_Combined_BRIR_latency_s_fx; /* Sample Rate = 48000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_48kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; +extern Word16 CRendBin_Combined_BRIR_max_num_iterations_48kHz; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]; +extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[15]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]; extern Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][2955]; extern Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][2955]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS][2885]; @@ -262,13 +262,13 @@ extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS /* Sample Rate = 32000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_32kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; +extern Word16 CRendBin_Combined_BRIR_max_num_iterations_32kHz; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]; +extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[15]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]; extern Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][2819]; extern Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][2819]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS][2870]; @@ -276,13 +276,13 @@ extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS /* Sample Rate = 16000 */ -extern int16_t CRendBin_Combined_BRIR_max_num_iterations_16kHz; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]; -extern uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; +extern Word16 CRendBin_Combined_BRIR_max_num_iterations_16kHz; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]; +extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[15]; -extern uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]; extern Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][1774]; extern Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][1774]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS][2522]; diff --git a/lib_rend/ivas_rom_binaural_crend_head_fx.c b/lib_rend/ivas_rom_binaural_crend_head_fx.c index 068ce0927..be015058b 100644 --- a/lib_rend/ivas_rom_binaural_crend_head_fx.c +++ b/lib_rend/ivas_rom_binaural_crend_head_fx.c @@ -56,35 +56,35 @@ const Word32 CRendBin_Combined_HRIR_latency_s_fx = 44741;/*Q-31*/ /* Sample Rate = 48000 */ -const int16_t CRendBin_Combined_HRIR_max_num_iterations_48kHz = 1; -const uint16_t CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; -const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz = 0; +const Word16 CRendBin_Combined_HRIR_max_num_iterations_48kHz = 1; +const UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz = 0; const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; -const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ -const int16_t CRendBin_Combined_HRIR_max_num_iterations_32kHz = 1; -const uint16_t CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; -const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz = 0; +const Word16 CRendBin_Combined_HRIR_max_num_iterations_32kHz = 1; +const UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz = 0; const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; -const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ -const int16_t CRendBin_Combined_HRIR_max_num_iterations_16kHz = 1; -const uint16_t CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; -const uint16_t CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz = 0; +const Word16 CRendBin_Combined_HRIR_max_num_iterations_16kHz = 1; +const UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz = 0; const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; -const uint16_t *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -96,35 +96,35 @@ const Word32 CRendBin_FOA_HRIR_latency_s_fx = 44741; // Q31 /* Sample Rate = 48000 */ -const int16_t CRendBin_FOA_HRIR_max_num_iterations_48kHz = 1; -const uint16_t CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; -const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz = 0; +const Word16 CRendBin_FOA_HRIR_max_num_iterations_48kHz = 1; +const UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz = 0; const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[4]={0, 0, 0, 0}; -const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ -const int16_t CRendBin_FOA_HRIR_max_num_iterations_32kHz = 1; -const uint16_t CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; -const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz = 0; +const Word16 CRendBin_FOA_HRIR_max_num_iterations_32kHz = 1; +const UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz = 0; const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[4]={0, 0, 0, 0}; -const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ -const int16_t CRendBin_FOA_HRIR_max_num_iterations_16kHz = 1; -const uint16_t CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; -const uint16_t CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz = 0; +const Word16 CRendBin_FOA_HRIR_max_num_iterations_16kHz = 1; +const UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz = 0; const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[4]={0, 0, 0, 0}; -const uint16_t *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -135,35 +135,35 @@ const Word32 CRendBin_HOA2_HRIR_latency_s_fx = 44741; // Q31 /* Sample Rate = 48000 */ -const int16_t CRendBin_HOA2_HRIR_max_num_iterations_48kHz = 1; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; -const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz = 0; +const Word16 CRendBin_HOA2_HRIR_max_num_iterations_48kHz = 1; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz = 0; const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ -const int16_t CRendBin_HOA2_HRIR_max_num_iterations_32kHz = 1; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; -const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz = 0; +const Word16 CRendBin_HOA2_HRIR_max_num_iterations_32kHz = 1; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz = 0; const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ -const int16_t CRendBin_HOA2_HRIR_max_num_iterations_16kHz = 1; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; -const uint16_t CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz = 0; +const Word16 CRendBin_HOA2_HRIR_max_num_iterations_16kHz = 1; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz = 0; const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -173,36 +173,36 @@ const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={N const Word32 CRendBin_HOA3_HRIR_latency_s_fx = 44741;/*Q-31*/ /* Sample Rate = 48000 */ -const int16_t CRendBin_HOA3_HRIR_max_num_iterations_48kHz = 1; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; -const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz = 0; +const Word16 CRendBin_HOA3_HRIR_max_num_iterations_48kHz = 1; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz = 0; const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ -const int16_t CRendBin_HOA3_HRIR_max_num_iterations_32kHz = 1; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; -const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz = 0; +const Word16 CRendBin_HOA3_HRIR_max_num_iterations_32kHz = 1; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz = 0; const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ -const int16_t CRendBin_HOA3_HRIR_max_num_iterations_16kHz = 1; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; -const uint16_t CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; -const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz = 0; +const Word16 CRendBin_HOA3_HRIR_max_num_iterations_16kHz = 1; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz = 0; const float CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[16]={0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f}; const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; +const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -212,34 +212,34 @@ const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={N const Word32 CRendBin_Combined_BRIR_latency_s_fx = 313176;/*Q-31*/ /* Sample Rate = 48000 */ -const int16_t CRendBin_Combined_BRIR_max_num_iterations_48kHz = 22; -const uint16_t CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; -const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {40, 40}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]={{{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240},{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240}},{{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240},{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240}},{{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240},{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240}},{{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240},{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240}},{{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240},{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240}},{{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240},{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240}},{{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240},{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240}},{{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240},{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240}},{{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240},{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240}},{{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240},{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240}},{{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240},{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240}},{{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240},{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240}},{{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240},{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240}},{{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240},{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240}},{{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240},{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240}}}; -const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz = 98; +const Word16 CRendBin_Combined_BRIR_max_num_iterations_48kHz = 22; +const UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {40, 40}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]={{{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240},{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240}},{{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240},{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240}},{{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240},{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240}},{{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240},{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240}},{{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240},{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240}},{{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240},{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240}},{{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240},{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240}},{{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240},{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240}},{{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240},{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240}},{{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240},{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240}},{{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240},{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240}},{{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240},{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240}},{{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240},{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240}},{{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240},{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240}},{{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240},{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240}}}; +const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz = 98; const float CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[15]={0.224183f, 0.227455f, 0.241830f, 0.207155f, 0.218087f, 0.222942f, 0.232158f, 0.248203f, 0.249262f, 0.261591f, 0.246276f, 0.279163f, 0.285701f, 0.262541f, 0.271844f}; const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[15]={7346, 7453, 7924, 6788, 7146, 7305, 7607, 8133, 8167, 8571, 8069, 9147, 9361, 8602, 8907,}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98},{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98},{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98}}; /* Sample Rate = 32000 */ -const int16_t CRendBin_Combined_BRIR_max_num_iterations_32kHz = 22; -const uint16_t CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; -const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {40, 40}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]={{{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160},{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160}},{{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160},{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160}},{{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160},{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160}},{{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160},{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160}},{{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160},{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160}},{{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160},{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160}},{{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160},{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160}},{{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160},{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160}},{{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160},{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160}},{{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160},{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160}},{{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160},{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160}},{{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160},{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160}},{{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160},{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160}},{{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160},{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160}},{{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160},{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160}}}; -const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz = 97; +const Word16 CRendBin_Combined_BRIR_max_num_iterations_32kHz = 22; +const UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {40, 40}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]={{{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160},{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160}},{{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160},{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160}},{{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160},{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160}},{{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160},{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160}},{{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160},{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160}},{{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160},{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160}},{{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160},{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160}},{{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160},{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160}},{{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160},{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160}},{{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160},{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160}},{{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160},{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160}},{{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160},{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160}},{{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160},{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160}},{{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160},{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160}},{{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160},{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160}}}; +const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz = 97; const float CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[15]={0.224190f, 0.227445f, 0.241827f, 0.207131f, 0.218113f, 0.222941f, 0.232139f, 0.248192f, 0.249239f, 0.261572f, 0.246309f, 0.279145f, 0.285786f, 0.262528f, 0.271847f}; const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[15]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907,}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97},{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97},{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97}}; /* Sample Rate = 16000 */ -const int16_t CRendBin_Combined_BRIR_max_num_iterations_16kHz = 23; -const uint16_t CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23} }; -const uint16_t CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {40, 40}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]={{{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80},{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80}},{{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80},{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80}},{{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80},{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80}},{{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80},{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80}},{{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80},{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80}},{{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80},{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80}},{{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80},{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80}},{{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80},{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80}},{{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80},{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80}},{{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80},{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80}},{{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80},{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80}},{{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80},{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80}},{{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80},{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80}},{{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80},{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80}},{{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80},{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80}}}; -const uint16_t CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz = 77; +const Word16 CRendBin_Combined_BRIR_max_num_iterations_16kHz = 23; +const UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {40, 40}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]={{{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80},{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80}},{{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80},{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80}},{{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80},{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80}},{{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80},{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80}},{{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80},{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80}},{{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80},{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80}},{{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80},{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80}},{{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80},{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80}},{{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80},{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80}},{{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80},{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80}},{{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80},{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80}},{{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80},{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80}},{{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80},{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80}},{{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80},{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80}},{{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80},{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80}}}; +const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz = 77; const float CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[15]={0.223532f, 0.226827f, 0.248830f, 0.208782f, 0.220391f, 0.219790f, 0.231187f, 0.248730f, 0.251408f, 0.263698f, 0.243858f, 0.281483f, 0.283080f, 0.261660f, 0.273527f}; const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[15]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907}; -const uint16_t CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]={{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77},{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]={{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77},{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77}}; //BRIR and HRIR coeff tables in Q29 const Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][2955] ={ { diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index 54940355c..2b46ff611 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -49,9 +49,9 @@ const Word16 diffuse_response_CICP6_fx[5] = { 13824, 13824, 12137, 16495, 16495 const Word16 diffuse_response_CICP14_fx[7] = { 12507, 12507, 9237, 17691, 17691, 4977, 4977 };//Q15 const Word16 diffuse_response_CICP16_fx[9] = { 11324, 11324, 9945, 13513, 13513, 8853, 8853, 9905, 9905 };//Q15 -const int16_t ap_pre_delay[DIRAC_DECORR_NUM_SPLIT_BANDS] = { 7, 2, 1 }; +const Word16 ap_pre_delay[DIRAC_DECORR_NUM_SPLIT_BANDS] = { 7, 2, 1 }; -const int16_t ap_filter_length[DIRAC_DECORR_NUM_SPLIT_BANDS] = { 15, 6, 3 }; +const Word16 ap_filter_length[DIRAC_DECORR_NUM_SPLIT_BANDS] = { 15, 6, 3 }; const Word16 ap_lattice_delta_phi_fx[DIRAC_MAX_NUM_DECORR_FILTERS*DIRAC_MAX_DECORR_FILTER_LEN] /*Q14*/ = { @@ -91,11 +91,11 @@ const Word16 ap_split_frequencies_fx[DIRAC_DECORR_NUM_SPLIT_BANDS + 1]/*Q14*/ = 0 , 2048, 6144, 16384 }; -const int16_t sba_map_tc[11] = +const Word16 sba_map_tc[11] = { 0, 1, 2, 3, 4, 8, 9, 15, 5, 6, 7 }; -const int16_t sba_map_tc_512[11] = +const Word16 sba_map_tc_512[11] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15 }; @@ -121,11 +121,11 @@ const int16_t sba_map_tc_512[11] = * 13 = 135, 35 * 14 = -135, 35 */ -const int16_t channelIndex_CICP6[5] = { 0, 1, 2, 5, 6 }; -const int16_t channelIndex_CICP12[7] = { 0, 1, 2, 5, 6, 3, 4 }; -const int16_t channelIndex_CICP14[7] = { 0, 1, 2, 5, 6, 9, 10 }; -const int16_t channelIndex_CICP16[9] = { 0, 1, 2, 5, 6, 9, 10, 11, 12 }; -const int16_t channelIndex_CICP19[11] = { 0, 1, 2, 3, 4, 7, 8, 9, 10, 13, 14 }; +const Word16 channelIndex_CICP6[5] = { 0, 1, 2, 5, 6 }; +const Word16 channelIndex_CICP12[7] = { 0, 1, 2, 5, 6, 3, 4 }; +const Word16 channelIndex_CICP14[7] = { 0, 1, 2, 5, 6, 9, 10 }; +const Word16 channelIndex_CICP16[9] = { 0, 1, 2, 5, 6, 9, 10, 11, 12 }; +const Word16 channelIndex_CICP19[11] = { 0, 1, 2, 3, 4, 7, 8, 9, 10, 13, 14 }; const Word16 surCohEne_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] /* Q13 */ = { @@ -160,7 +160,7 @@ const Word32 diffuseFieldCoherenceDifferenceZ_fx[BINAURAL_COHERENCE_DIFFERENCE_B * TD ISM binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -const int16_t HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS] = +const Word16 HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS] = { 13, 12, 11 }; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 22ed7ed65..0a489600a 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -88,7 +88,7 @@ typedef enum IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN, } IVAS_REND_AudioConfigType; -typedef uint16_t IVAS_REND_InputId; +typedef UWord16 IVAS_REND_InputId; typedef enum _IVAS_REND_COMPLEXITY_LEVEL { -- GitLab From 0167cdeab304bc9403484dfd72e7a63bd3674971 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 09:30:57 +0530 Subject: [PATCH 070/358] Fix for 3GPP issue 1345: Decoder crash for Stereo at 32kbps in stereo_dft_dec_res_fx() Link #1345 --- lib_dec/ivas_stereo_dft_dec_fx.c | 41 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 8dcc7ada9..fb54476fa 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -1368,23 +1368,23 @@ void stereo_dft_dec_res_fx( /*Inverse MDCT*/ TCX_MDCT_Inverse( res_buf, q_res, win, STEREO_DFT_OVL_8k, L_FRAME8k - STEREO_DFT_OVL_8k, STEREO_DFT_OVL_8k, IVAS_CPE_DFT ); + scale_sig( win, L_FRAME8k + STEREO_DFT_OVL_8k, -1 ); + + Word16 q_shift = sub( hCPE->hStereoDft->q_res_cod_mem_fx, Q16 ); IF( !prev_bfi ) { /*OLA*/ /*overlapping parts*/ - Word16 q_shift = sub( hCPE->hStereoDft->q_res_cod_mem_fx, Q16 ); + FOR( i = 0; i < STEREO_DFT_OVL_8k; i++ ) { - win[i] = extract_h( L_add( hCPE->hStereoDft->res_cod_mem_fx[i], L_shl( L_mult( win[i], hCPE->hStereoDft->win_8k_fx[i] ), q_shift ) ) ); /* q_res_cod_mem_fx */ + win[i] = extract_h( L_add( L_shr( hCPE->hStereoDft->res_cod_mem_fx[i], 1 ), L_shl( L_mult( win[i], hCPE->hStereoDft->win_8k_fx[i] ), q_shift ) ) ); /* q_res_cod_mem_fx -17 (q_shift -1)*/ move16(); - hCPE->hStereoDft->res_cod_mem_fx[i] = L_mult( win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i] ); /* q_res_cod_mem_fx */ + hCPE->hStereoDft->res_cod_mem_fx[i] = L_shl( L_mult( win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i] ), 1 ); /* -1 +15 +1 +1 */ move32(); } - IF( q_shift != 0 ) - { - v_shr_16( &win[STEREO_DFT_OVL_8k], negate( q_shift ), &win[STEREO_DFT_OVL_8k], L_FRAME8k ); - } - hCPE->hStereoDft->q_res_cod_mem_fx = Q16; + + move16(); } ELSE @@ -1396,23 +1396,30 @@ void stereo_dft_dec_res_fx( move16(); FOR( i = 0; i < STEREO_DFT_OVL_8k; i++ ) { - win[i] = extract_h( Madd_32_16( Mpy_32_16_1( hCPE->hStereoDft->res_cod_mem_fx[i], sub( MAX_16, mult( fac, fac ) ) ), - L_mult( hCPE->hStereoDft->win_8k_fx[i], win[i] ), - sub( MAX_16, mult( sub( MAX_16, fac ), sub( MAX_16, fac ) ) ) ) ); /* Q0 */ + win[i] = extract_h( Madd_32_16( Mpy_32_16_1( L_shr( hCPE->hStereoDft->res_cod_mem_fx[i], 1 ), sub( MAX_16, mult( fac, fac ) ) ), + L_shl( L_mult( hCPE->hStereoDft->win_8k_fx[i], win[i] ), q_shift ), + sub( MAX_16, mult( sub( MAX_16, fac ), sub( MAX_16, fac ) ) ) ) ); /* Q(q_shift -1) */ move16(); - hCPE->hStereoDft->res_cod_mem_fx[i] = L_mult( win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i] ); /* Q16 */ + hCPE->hStereoDft->res_cod_mem_fx[i] = L_shl( L_mult( win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i] ), 1 ); /* Q16 */ move32(); fac = add( fac, step ); } } - Copy( win, out_16, L_FRAME8k ); /* Q0 */ + IF( q_shift != 0 ) + { + v_shr_16( &win[STEREO_DFT_OVL_8k], negate( q_shift ), &win[STEREO_DFT_OVL_8k], L_FRAME8k ); + } + + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; + + Copy( win, out_16, L_FRAME8k ); /* Q(q_shift -1 ) */ IF( hCPE->hCoreCoder[0]->core == ACELP_CORE ) { /* bass post-filter */ bass_psfilter_fx( hCPE->hStereoDft->hBpf, hCPE->hCoreCoder[0]->Opt_AMR_WB, out_16, L_FRAME8k, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx + ( L_FRAME8k / STEREO_DFT_L_SUBFR_8k ), hCPE->hCoreCoder[0]->bpf_off, - hCPE->hCoreCoder[0]->stab_fac_fx, &hCPE->hStereoDft->stab_fac_smooth_res_fx, hCPE->hCoreCoder[0]->last_coder_type, 0, bpf_error_signal_8k_16 ); + hCPE->hCoreCoder[0]->stab_fac_fx, &hCPE->hStereoDft->stab_fac_smooth_res_fx, hCPE->hCoreCoder[0]->last_coder_type, sub( q_shift, 1 ), bpf_error_signal_8k_16 ); Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_8k_16, bpf_error_signal_8k, L_FRAME8k, Q15 ); /* Q15 */ res_bpf_flag = res_bpf_adapt_ivas_fx( hCPE->hStereoDft, bpf_error_signal_8k, res_buf, q_res ); @@ -1430,7 +1437,7 @@ void stereo_dft_dec_res_fx( } } #ifdef FIX_ISSUE_1237 - Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, 15 ); /* Q15 */ + Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ #else Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ #endif @@ -1445,7 +1452,7 @@ void stereo_dft_dec_res_fx( hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; move16(); #ifdef FIX_ISSUE_1237 - Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, 15 ); /* Q15 */ + Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ #else Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ #endif @@ -1454,7 +1461,7 @@ void stereo_dft_dec_res_fx( { /* This step is needed to ensure output is properly populated with scaled values in all cases*/ #ifdef FIX_ISSUE_1237 - Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, 15 ); /* Q15 */ + Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ #else Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ #endif -- GitLab From 93562d4813418102900242d96160cabc25baa6fc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 12:49:24 +0530 Subject: [PATCH 071/358] Fix for 3GPP issue 1342: Decoder crash for Stereo at 48/64 kbps mono decoding in IMDCT_ivas_fx() Link #1342 --- lib_com/edct_fx.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 8d77da13a..b1e2a7dd9 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -592,11 +592,12 @@ void edxt_fx( const UWord16 synthesis /* i : nonzero for inverse Q0*/ ) { - Word16 k, m, fac; + Word16 k, m, fac, hdrm, tmp = 0; const Word16 *cosPtr, *sinPtr; Word16 n; n = 0; move16(); + move16(); cosPtr = NULL; sinPtr = NULL; IF( EQ_16( length, 512 ) ) @@ -735,7 +736,23 @@ void edxt_fx( IF( EQ_16( length, 512 ) ) { + /* Scaling down re and im buffers to avoid overflow in DoRTFTn_fx if the minimum headroom is less than 4 bits */ + hdrm = s_min( L_norm_arr( re, 512 ), L_norm_arr( im, 512 ) ); + IF( LT_16( hdrm, 4 ) ) + { + tmp = sub( hdrm, 4 ); + scale_sig32( re, 512, tmp ); + scale_sig32( im, 512, tmp ); + } + DoRTFTn_fx( re, im, 512 ); + + IF( LT_16( hdrm, 4 ) ) + { + tmp = negate( tmp ); + scale_sig32( re, 512, tmp ); + scale_sig32( im, 512, tmp ); + } } ELSE /* fft() doesn't support 512 */ { @@ -831,7 +848,23 @@ void edxt_fx( IF( EQ_16( length, 512 ) ) { + /* Scaling down re and im buffers to avoid overflow in DoRTFTn_fx if the minimum headroom is less than 4 bits */ + hdrm = s_min( L_norm_arr( re, 512 ), L_norm_arr( im, 512 ) ); + IF( LT_16( hdrm, 4 ) ) + { + tmp = sub( hdrm, 4 ); + scale_sig32( re, 512, tmp ); + scale_sig32( im, 512, tmp ); + } + DoRTFTn_fx( re, im, 512 ); + + IF( LT_16( hdrm, 4 ) ) + { + tmp = negate( tmp ); + scale_sig32( re, 512, tmp ); + scale_sig32( im, 512, tmp ); + } } ELSE /* fft() doesn't support 512 */ { -- GitLab From 75cc1287f4487be57d9ac79959c1b53a57cf4224 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 14:34:44 +0530 Subject: [PATCH 072/358] Fix for 3GPP issue 1327: Glitch when stereo is switching from TD to FD Link #1327 --- lib_com/options.h | 1 + lib_enc/ivas_stereo_switching_enc_fx.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 85d81ab5c..dab0c796c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,4 +174,5 @@ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ +#define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ #endif diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 6513a3fa7..cbdbc0501 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -680,6 +680,10 @@ void stereo_switching_enc_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { Copy( sts[n]->input_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl ); /* sts[n]->q_inp */ +#ifdef FIX_ISSUE_1327 + hCPE->q_input_mem[n] = sts[n]->q_inp; + move16(); +#endif } } -- GitLab From c92e3a4e29c5441e2ee2bd8d09aeac18c3090272 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 14:14:28 +0530 Subject: [PATCH 073/358] Fix for 3GPP issue 1048: Problem in stereo during bitrate switching and frame erasure Link #1048 --- lib_dec/er_dec_tcx_fx.c | 2 +- lib_dec/ivas_mdct_core_dec_fx.c | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 8c10e5f81..5cc06dabf 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1168,7 +1168,7 @@ void con_tcx_ivas_fx( /* apply pre-emphasis to the signal */ mem = synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )]; /*Q0*/ move16(); - Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); st->Mode2_lp_gainc = L_deposit_l( 0 ); st->Mode2_lp_gainp = get_gain2( synth - shl( L_subfr, 1 ), synth - add( shl( L_subfr, 1 ), Tc ), shl( L_subfr, 1 ) ); diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 7f079277a..a5855a0f6 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1282,11 +1282,6 @@ void ivas_mdct_core_reconstruct_fx( ELSE /*ACELP core for ACELP-PLC */ { assert( EQ_16( st->bfi, 1 ) ); - - Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( -2, q_syn ) ); // Q0 - Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( -2, q_syn ) ); // Q0 - q_syn = -2; - move16(); /* PLC: [TCX: TD PLC] */ IF( MCT_flag != 0 ) { @@ -1316,11 +1311,11 @@ void ivas_mdct_core_reconstruct_fx( IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || ( st->hTcxDec->tcxConceal_recalc_exc != 0 ) ) { - Scale_sig( synthFB_fx - add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), sub( q_syn, sub( st->Q_exc, 1 ) ) ); // 2 * q_syn - (st->Q_exc - 1) + Scale_sig( synthFB_fx - add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), sub( add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), 1 ), sub( q_syn, sub( st->Q_exc, 1 ) ) ); // 2 * q_syn - (st->Q_exc - 1) } ELSE { - Scale_sig( synthFB_fx - st->hTcxDec->L_frameTCX, st->hTcxDec->L_frameTCX, sub( q_syn, sub( st->Q_exc, 1 ) ) ); // 2 * q_syn - (st->Q_exc - 1) + Scale_sig( synthFB_fx - st->hTcxDec->L_frameTCX, sub( st->hTcxDec->L_frameTCX, 1 ), sub( q_syn, sub( st->Q_exc, 1 ) ) ); // 2 * q_syn - (st->Q_exc - 1) } lerp( synthFB_fx, synth_fx, st->L_frame, st->hTcxDec->L_frameTCX ); -- GitLab From b2ed1c2b5b03c24769e474416e0025a3a0b5d22a Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 14:07:06 +0530 Subject: [PATCH 074/358] Fix for 3GPP issue 1004: Modulation artifact in OMASA at 24 kbps using LTV 3ISM 2TC input and output to MONO Link #1004, #1363 Fixes 3GPP issue #1363: Assert in BASOP decoder function protoSignalComputation2_fx when fed with BASOP encoder MASA bitstream --- lib_rend/ivas_dirac_rend_fx.c | 94 +++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 36 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index e01b27767..aca51e01c 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1770,7 +1770,7 @@ void protoSignalComputation2_fx( Word32 min_sum_total_ratio_fx, min_sum_total_ratio_db_fx; Word32 sum_total_ratio_fx[MASA_SUM_FREQ_RANGE_BINS]; Word16 q_sum_total_ratio; - Word32 a_fx, b_fx; + Word32 a_fx, b_fx, a2_fx, b2_fx; Word16 interpolatorSpaced_fx, interpolatorDmx_fx; Word32 tempSpaced_fx, tempDmx_fx; Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; @@ -1778,7 +1778,7 @@ void protoSignalComputation2_fx( Word64 W_tmp1, W_tmp2; Word64 reference_power_64fx[CLDFB_NO_CHANNELS_MAX]; Word16 q_reference_power_64fx; - + Word16 head_room, q_Left_Right_power; /* Calculate maximum possible shift for the buffers RealBuffer_fx and ImagBuffer_fx */ min_q_shift = Q31; move16(); @@ -2020,8 +2020,10 @@ void protoSignalComputation2_fx( a_fx = 21474836; /*0.01 in Q31*/ /* Temporal smoothing coefficient */ move32(); b_fx = L_sub( ONE_IN_Q31, a_fx ); /* Temporal smoothing coefficient q31*/ - // a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ - // b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ + move32(); + a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ + move32(); + b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ IF( stereo_type_detect->interpolator > 0 ) { @@ -2044,6 +2046,23 @@ void protoSignalComputation2_fx( q_temp = sub( add( add( q_cldfb, min_q_shift ), add( q_cldfb, min_q_shift ) ), 31 ); q_temp2 = sub( add( add( q_cldfb, temp_q_shift ), add( q_cldfb, temp_q_shift ) ), 31 ); + head_room = 63; + move16(); + FOR( l = 0; l < num_freq_bands; l++ ) + { + 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 + + 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 ) ); + + head_room = s_min( head_room, W_norm( W_add( W_tmp1, W_tmp2 ) ) ); + } + head_room = sub( head_room, find_guarded_bits_fx( num_freq_bands ) ); + q_Left_Right_power = add( shl( add( q_cldfb, min_q_shift ), 1 ), sub( head_room, 32 ) ); + FOR( l = 0; l < num_freq_bands; l++ ) { re1 = L_shl( RealBuffer_fx[0][0][l], min_q_shift ); // q_cldfb+min_q_shift @@ -2058,26 +2077,26 @@ void protoSignalComputation2_fx( /* Compute reference power */ // Left_power_fx = Madd_32_32( Mpy_32_32( re1, re1 ), im1, im1 ); W_tmp1 = W_add( W_mult0_32_32( re1, re1 ), W_mult0_32_32( im1, im1 ) ); // 2*(q_cldfb+min_q_shift) - Left_power_fx = W_extract_l( W_shr( W_tmp1, 31 ) ); + Left_power_fx = W_extract_h( W_shl( W_tmp1, head_room ) ); // q_Left_Right_power // Right_power_fx = Madd_32_32( Mpy_32_32( re2, re2 ), im2, im2 ); W_tmp2 = W_add( W_mult0_32_32( re2, re2 ), W_mult0_32_32( im2, im2 ) ); // 2*(q_cldfb+min_q_shift) - Right_power_fx = W_extract_l( W_shr( W_tmp2, 31 ) ); + Right_power_fx = W_extract_h( W_shl( W_tmp2, head_room ) ); // q_Left_Right_power // reference_power_fx[l] = L_add( Left_power_fx, Right_power_fx ); reference_power_64fx[l] = W_add( W_tmp1, W_tmp2 ); // 2*(q_cldfb+min_q_shift) move64(); - left_bb_power_fx = L_add( left_bb_power_fx, Left_power_fx ); // 2*(q_cldfb+min_q_shift) -31 - right_bb_power_fx = L_add( right_bb_power_fx, Right_power_fx ); // 2*(q_cldfb+min_q_shift) -31 + 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_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 + 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 IF( GT_16( l, MASA_HI_FREQ_START_BIN ) ) { - left_hi_power_fx = L_add( left_hi_power_fx, Left_power_fx ); // 2*(q_cldfb+min_q_shift) -31 - right_hi_power_fx = L_add( right_hi_power_fx, Right_power_fx ); // 2*(q_cldfb+min_q_shift) -31 + left_hi_power_fx = L_add( left_hi_power_fx, Left_power_fx ); // q_Left_Right_power + right_hi_power_fx = L_add( right_hi_power_fx, Right_power_fx ); // q_Left_Right_power // total_hi_power_fx = L_add( total_hi_power_fx, reference_power_fx[l] ); - total_hi_power_fx = L_add( total_hi_power_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 + total_hi_power_fx = L_add( total_hi_power_fx, W_extract_h( W_shl( reference_power_64fx[l], head_room ) ) ); // q_Left_Right_power } IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) @@ -2114,12 +2133,17 @@ void protoSignalComputation2_fx( test(); IF( ( stereo_type_detect->sum_power_fx[l] == 0 ) && ( stereo_type_detect->total_power_fx[l] == 0 ) ) { - sum_total_ratio_fx[l] = MAX_16; // q15 + sum_total_ratio_fx[l] = MAX_32; // q15 + move32(); + } + ELSE IF( stereo_type_detect->total_power_fx[l] == 0 ) + { + sum_total_ratio_fx[l] = MAX_32; // q15 move32(); } ELSE { - sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], L_add( stereo_type_detect->total_power_fx[l], EPSILON_FX ), &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) + sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], stereo_type_detect->total_power_fx[l], &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) move32(); q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) ); sum_total_ratio_fx[l] = L_shl( sum_total_ratio_fx[l], sub( Q15, q_sum_total_ratio ) ); // q15 @@ -2490,45 +2514,45 @@ void protoSignalComputation2_fx( } } - temp = Mpy_32_32( a_fx, left_bb_power_fx ); // 2*(q_cldfb+min_q_shift) -31 - IF( LT_16( q_temp, stereo_type_detect->q_left_bb_power ) ) + temp = Mpy_32_32( a_fx, left_bb_power_fx ); // q_Left_Right_power + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ) { - stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_temp ) ) ); // q_temp + stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power move32(); - stereo_type_detect->q_left_bb_power = q_temp; + stereo_type_detect->q_left_bb_power = q_Left_Right_power; move16(); } ELSE { - stereo_type_detect->left_bb_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_left_bb_power ) ), Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ) ); // stereo_type_detect->q_left_bb_power + stereo_type_detect->left_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ), b_fx, stereo_type_detect->left_bb_power_fx ); // stereo_type_detect->q_left_bb_power move32(); } - temp = Mpy_32_32( a_fx, right_bb_power_fx ); // 2*(q_cldfb+min_q_shift) -31 - IF( LT_16( q_temp, stereo_type_detect->q_right_bb_power ) ) + temp = Mpy_32_32( a_fx, right_bb_power_fx ); // q_Left_Right_power + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ) { - stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_temp ) ) ); // q_temp + stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power move32(); - stereo_type_detect->q_right_bb_power = q_temp; + stereo_type_detect->q_right_bb_power = q_Left_Right_power; move16(); } ELSE { - stereo_type_detect->right_bb_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_right_bb_power ) ), Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ) ); // stereo_type_detect->q_right_bb_power + stereo_type_detect->right_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ), b_fx, stereo_type_detect->right_bb_power_fx ); // stereo_type_detect->q_right_bb_power move32(); } - temp = Mpy_32_32( a_fx, total_bb_power_fx ); // 2*(q_cldfb+min_q_shift) -31 - IF( LT_16( q_temp, stereo_type_detect->q_total_bb_power ) ) + temp = Mpy_32_32( a_fx, total_bb_power_fx ); // q_Left_Right_power + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ) { - stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_temp ) ) ); // q_temp + stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power move32(); - stereo_type_detect->q_total_bb_power = q_temp; + stereo_type_detect->q_total_bb_power = q_Left_Right_power; move16(); } ELSE { - stereo_type_detect->total_bb_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_total_bb_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ) ); // stereo_type_detect->q_total_bb_power + stereo_type_detect->total_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ), b_fx, stereo_type_detect->total_bb_power_fx ); // stereo_type_detect->q_total_bb_power move32(); } @@ -2546,8 +2570,7 @@ void protoSignalComputation2_fx( q_lr_bb_power = stereo_type_detect->q_right_bb_power; move16(); } - q_lr_bb_power = sub( q_lr_bb_power, 1 ); /* = (lr_bb_power_fx * 2) */ - + q_lr_bb_power = sub( q_lr_bb_power, 1 ); /* = (lr_bb_power_fx * 2) */ temp = BASOP_Util_Divide3232_Scale_cadence( lr_bb_power_fx, L_add( stereo_type_detect->total_bb_power_fx, EPSILON_FX ), &exp ); // Q(31-(exp+stereo_type_detect->q_total_bb_power-q_lr_bb_power)) exp = sub( 31, add( sub( 31, exp ), sub( q_lr_bb_power, stereo_type_detect->q_total_bb_power ) ) ); temp = BASOP_Util_Log2( temp ); // q25 @@ -2558,15 +2581,15 @@ void protoSignalComputation2_fx( // 20480 = 10 in Q11 lr_total_bb_ratio_fx = Mpy_32_16_1( temp, 20480 ); // Q21 - stereo_type_detect->left_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, left_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->left_hi_power_fx ), sub( 31, stereo_type_detect->q_left_hi_power ), &stereo_type_detect->q_left_hi_power ); + 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( a_fx, right_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->right_hi_power_fx ), sub( 31, stereo_type_detect->q_right_hi_power ), &stereo_type_detect->q_right_hi_power ); + 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( a_fx, total_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->total_hi_power_fx ), sub( 31, stereo_type_detect->q_total_hi_power ), &stereo_type_detect->q_total_hi_power ); + 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(); stereo_type_detect->q_total_hi_power = sub( 31, stereo_type_detect->q_total_hi_power ); move16(); @@ -2583,8 +2606,7 @@ void protoSignalComputation2_fx( move32(); q_lr_hi_power = stereo_type_detect->q_right_hi_power; } - q_lr_hi_power = sub( q_lr_hi_power, 1 ); /* = (q_lr_hi_power * 2) */ - + q_lr_hi_power = sub( q_lr_hi_power, 1 ); /* = (q_lr_hi_power * 2) */ temp = BASOP_Util_Divide3232_Scale_cadence( lr_hi_power_fx, L_add( stereo_type_detect->total_hi_power_fx, EPSILON_FX ), &exp ); // Q=31-(exp+ stereo_type_detect->q_total_hi_power-q_lr_hi_power) exp = sub( 31, add( sub( 31, exp ), sub( q_lr_hi_power, stereo_type_detect->q_total_hi_power ) ) ); temp = BASOP_Util_Log2( temp ); // q25 -- GitLab From 8b5fab74c4d8997d349af0ead331e012172ae097 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 19:34:14 +0530 Subject: [PATCH 075/358] Bug fixes, ivas_prot.h cleanup, Q documentation updates --- lib_com/bitstream.c | 1 - lib_com/core_com_config.c | 1 - lib_com/fft_fx.c | 20 + lib_com/gs_bitallocation_ivas_fx.c | 1 - lib_com/ivas_agc_com_fx.c | 1 - lib_com/ivas_arith_fx.c | 1 - lib_com/ivas_cov_smooth_fx.c | 1 - lib_com/ivas_dirac_com_fx.c | 1 - lib_com/ivas_entropy_coder_common_fx.c | 1 - lib_com/ivas_fb_mixer_fx.c | 1 - lib_com/ivas_filters_fx.c | 1 - lib_com/ivas_ism_com_fx.c | 1 - lib_com/ivas_lfe_com_fx.c | 1 - lib_com/ivas_masa_com_fx.c | 1 - lib_com/ivas_mc_com_fx.c | 1 - lib_com/ivas_mc_param_com_fx.c | 1 - lib_com/ivas_mcmasa_com-fx.c | 1 - lib_com/ivas_mct_com_fx.c | 2 +- lib_com/ivas_mdct_core_com_fx.c | 1 - lib_com/ivas_mdft_imdft_fx.c | 1 - lib_com/ivas_omasa_com_fx.c | 1 - lib_com/ivas_pca_tools_fx.c | 1 - lib_com/ivas_prot_fx.h | 817 ++++++++++++++++++ lib_com/ivas_qmetadata_com_fx.c | 1 - lib_com/ivas_qspherical_com_fx.c | 1 - lib_com/ivas_sba_config_fx.c | 1 - lib_com/ivas_sns_com_fx.c | 177 ++-- lib_com/ivas_spar_com_fx.c | 1 - lib_com/ivas_spar_com_quant_util_fx.c | 1 - lib_com/ivas_stereo_dft_com_fx.c | 1 - lib_com/ivas_stereo_eclvq_com_fx.c | 1 - lib_com/ivas_stereo_ica_com_fx.c | 1 - lib_com/ivas_stereo_mdct_bands_com_fx.c | 1 - lib_com/ivas_stereo_mdct_stereo_com_fx.c | 1 - lib_com/ivas_stereo_psychlpc_com_fx.c | 2 - lib_com/ivas_stereo_td_bit_alloc_fx.c | 1 - lib_com/ivas_tools_fx.c | 1 - lib_com/ivas_transient_det_fx.c | 1 - lib_com/mslvq_com.c | 1 - lib_com/prot_fx.h | 1 + lib_com/swb_tbe_com.c | 1 - lib_dec/ACcontextMapping_dec_fx.c | 1 - lib_dec/acelp_core_dec_ivas_fx.c | 1 - lib_dec/dec_tcx_fx.c | 1 - lib_dec/igf_dec_fx.c | 5 +- lib_dec/ivas_agc_dec_fx.c | 1 - lib_dec/ivas_binRenderer_internal_fx.c | 1 - lib_dec/ivas_core_dec_fx.c | 1 - lib_dec/ivas_corecoder_dec_reconfig_fx.c | 1 - lib_dec/ivas_cpe_dec_fx.c | 1 - lib_dec/ivas_decision_matrix_dec_fx.c | 1 - lib_dec/ivas_dirac_dec_fx.c | 1 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 1 - lib_dec/ivas_entropy_decoder_fx.c | 1 - lib_dec/ivas_init_dec.c | 1 - lib_dec/ivas_ism_dec_fx.c | 1 - lib_dec/ivas_ism_dtx_dec_fx.c | 1 - lib_dec/ivas_ism_metadata_dec_fx.c | 1 - lib_dec/ivas_ism_param_dec_fx.c | 1 - lib_dec/ivas_ism_renderer_fx.c | 1 - lib_dec/ivas_jbm_dec_fx.c | 1 - lib_dec/ivas_lfe_dec_fx.c | 1 - lib_dec/ivas_lfe_plc_fx.c | 1 - lib_dec/ivas_ls_custom_dec_fx.c | 1 - lib_dec/ivas_masa_dec_fx.c | 1 - lib_dec/ivas_mc_param_dec_fx.c | 1 - lib_dec/ivas_mc_paramupmix_dec_fx.c | 1 - lib_dec/ivas_mcmasa_dec_fx.c | 1 - lib_dec/ivas_mct_core_dec_fx.c | 1 - lib_dec/ivas_mct_dec_fx.c | 1 - lib_dec/ivas_mct_dec_mct_fx_fx.c | 1 - lib_dec/ivas_mdct_core_dec_fx.c | 1 - lib_dec/ivas_mono_dmx_renderer_fx.c | 1 - lib_dec/ivas_objectRenderer_internal_fx.c | 1 - lib_dec/ivas_omasa_dec_fx.c | 1 - lib_dec/ivas_osba_dec_fx.c | 1 - lib_dec/ivas_out_setup_conversion_fx.c | 1 - lib_dec/ivas_output_config_fx.c | 1 - lib_dec/ivas_pca_dec_fx.c | 1 - lib_dec/ivas_post_proc_fx.c | 1 - lib_dec/ivas_qmetadata_dec_fx.c | 1 - lib_dec/ivas_qspherical_dec_fx.c | 1 - lib_dec/ivas_range_uni_dec_fx.c | 1 - lib_dec/ivas_sba_dec_fx.c | 1 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 1 - lib_dec/ivas_sba_rendering_internal_fx.c | 1 - lib_dec/ivas_sce_dec_fx.c | 1 - lib_dec/ivas_sns_dec_fx.c | 1 - lib_dec/ivas_spar_decoder_fx.c | 1 - lib_dec/ivas_spar_md_dec_fx.c | 1 - lib_dec/ivas_stereo_adapt_GR_dec_fx.c | 1 - lib_dec/ivas_stereo_cng_dec.c | 1 - lib_dec/ivas_stereo_dft_dec.c | 1 - lib_dec/ivas_stereo_dft_dec_dmx_fx.c | 1 - lib_dec/ivas_stereo_dft_dec_fx.c | 1 - lib_dec/ivas_stereo_dft_plc_fx.c | 1 - lib_dec/ivas_stereo_eclvq_dec_fx.c | 1 - lib_dec/ivas_stereo_esf_dec_fx.c | 1 - lib_dec/ivas_stereo_ica_dec_fx.c | 1 - lib_dec/ivas_stereo_icbwe_dec_fx.c | 1 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 1 - lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 1 - lib_dec/ivas_stereo_switching_dec_fx.c | 1 - lib_dec/ivas_stereo_td_dec_fx.c | 40 - lib_dec/ivas_svd_dec_fx.c | 1 - lib_dec/ivas_tcx_core_dec_fx.c | 1 - lib_dec/ivas_td_low_rate_dec_fx.c | 1 - lib_dec/lib_dec_fx.c | 1 - lib_dec/lsf_dec_fx.c | 1 - lib_enc/ACcontextMapping_enc_fx.c | 1 - lib_enc/acelp_core_enc_fx.c | 1 - lib_enc/cod4t64_fast.c | 1 - lib_enc/cod_tcx_fx.c | 1 - lib_enc/ext_sig_ana_fx.c | 40 +- lib_enc/igf_enc.c | 1 - lib_enc/ivas_agc_enc_fx.c | 1 - lib_enc/ivas_core_enc_fx.c | 1 - lib_enc/ivas_core_pre_proc_front_fx.c | 1 - lib_enc/ivas_core_pre_proc_fx.c | 1 - lib_enc/ivas_corecoder_enc_reconfig_fx.c | 1 - lib_enc/ivas_cpe_enc_fx.c | 1 - lib_enc/ivas_decision_matrix_enc_fx.c | 1 - lib_enc/ivas_dirac_enc_fx.c | 1 - lib_enc/ivas_enc_cov_handler_fx.c | 1 - lib_enc/ivas_enc_fx.c | 1 - lib_enc/ivas_entropy_coder_fx.c | 1 - lib_enc/ivas_front_vad_fx.c | 25 - lib_enc/ivas_init_enc_fx.c | 1 - lib_enc/ivas_ism_dtx_enc_fx.c | 1 - lib_enc/ivas_ism_enc_fx.c | 1 - lib_enc/ivas_ism_metadata_enc_fx.c | 1 - lib_enc/ivas_ism_param_enc_fx.c | 1 - lib_enc/ivas_lfe_enc_fx.c | 1 - lib_enc/ivas_masa_enc_fx.c | 1 - lib_enc/ivas_mc_param_enc_fx.c | 1 - lib_enc/ivas_mc_paramupmix_enc_fx.c | 1 - lib_enc/ivas_mcmasa_enc_fx.c | 1 - lib_enc/ivas_mct_core_enc_fx.c | 1 - lib_enc/ivas_mct_enc_fx.c | 1 - lib_enc/ivas_mct_enc_mct_fx.c | 1 - lib_enc/ivas_mdct_core_enc_fx.c | 29 +- lib_enc/ivas_omasa_enc_fx.c | 1 - lib_enc/ivas_osba_enc_fx.c | 1 - lib_enc/ivas_pca_enc_fx.c | 1 - lib_enc/ivas_qmetadata_enc_fx.c | 1 - lib_enc/ivas_qspherical_enc_fx.c | 1 - lib_enc/ivas_range_uni_enc_fx.c | 1 - lib_enc/ivas_sba_enc_fx.c | 1 - lib_enc/ivas_sce_enc_fx.c | 1 - lib_enc/ivas_sns_enc_fx.c | 1 - lib_enc/ivas_spar_encoder_fx.c | 1 - lib_enc/ivas_spar_md_enc_fx.c | 1 - lib_enc/ivas_stereo_adapt_GR_enc_fx.c | 1 - lib_enc/ivas_stereo_classifier_fx.c | 1 - lib_enc/ivas_stereo_cng_enc_fx.c | 1 - lib_enc/ivas_stereo_dft_enc_fx.c | 1 - lib_enc/ivas_stereo_dft_enc_itd_fx.c | 1 - lib_enc/ivas_stereo_dft_td_itd_fx.c | 1 - lib_enc/ivas_stereo_dmx_evs_fx.c | 1 - lib_enc/ivas_stereo_eclvq_enc_fx.c | 1 - lib_enc/ivas_stereo_ica_enc_fx.c | 1 - lib_enc/ivas_stereo_icbwe_enc_fx.c | 1 - lib_enc/ivas_stereo_mdct_core_enc_fx.c | 1 - lib_enc/ivas_stereo_mdct_igf_enc_fx.c | 1 - lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 1 - lib_enc/ivas_stereo_switching_enc_fx.c | 1 - lib_enc/ivas_stereo_td_analysis_fx.c | 1 - lib_enc/ivas_stereo_td_enc_fx.c | 1 - lib_enc/ivas_tcx_core_enc_fx.c | 1 - lib_enc/ivas_td_low_rate_enc_fx.c | 1 - lib_enc/lib_enc.c | 1 - lib_enc/lp_exc_e_fx.c | 106 +-- lib_enc/lsf_enc_fx.c | 147 ++-- lib_enc/lsf_msvq_ma_enc.c | 27 +- lib_enc/lsf_msvq_ma_enc_fx.c | 52 +- lib_enc/ltd_stable_fx.c | 63 +- lib_enc/mdct_classifier_fx.c | 99 +-- lib_enc/mdct_selector_fx.c | 36 +- lib_enc/mslvq_enc_fx.c | 52 +- lib_enc/multi_harm_fx.c | 16 +- lib_enc/speech_music_classif_fx.c | 1 - lib_enc/swb_pre_proc_fx.c | 1 - lib_enc/swb_tbe_enc_fx.c | 1 - lib_rend/ivas_allrad_dec_fx.c | 1 - lib_rend/ivas_crend_fx.c | 1 - lib_rend/ivas_dirac_ana_fx.c | 1 - .../ivas_dirac_dec_binaural_functions_fx.c | 1 - lib_rend/ivas_dirac_decorr_dec_fx.c | 1 - lib_rend/ivas_dirac_onsets_dec_fx.c | 1 - lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 1 - lib_rend/ivas_dirac_rend_fx.c | 1 - lib_rend/ivas_efap_fx.c | 1 - lib_rend/ivas_hrtf_fx.c | 1 - lib_rend/ivas_masa_merge_fx.c | 1 - lib_rend/ivas_mcmasa_ana_fx.c | 1 - lib_rend/ivas_objectRenderer_fx.c | 1 - lib_rend/ivas_omasa_ana_fx.c | 1 - lib_rend/ivas_orient_trk_fx.c | 1 - lib_rend/ivas_output_init.c | 1 - lib_rend/ivas_output_init_fx.c | 1 - lib_rend/ivas_reflections_fx.c | 1 - lib_rend/ivas_reverb_delay_line_fx.c | 1 - lib_rend/ivas_sba_rendering_fx.c | 1 - lib_rend/ivas_td_decorr_fx.c | 1 - lib_rend/ivas_vbap_fx.c | 1 - lib_rend/lib_rend.c | 1 - lib_util/hrtf_file_reader.c | 1 - lib_util/ls_custom_file_reader.c | 2 +- lib_util/masa_file_reader.c | 1 - 209 files changed, 1267 insertions(+), 679 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 9c0a53f8f..90b49f8c2 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -43,7 +43,6 @@ #include "stat_dec.h" #include "rom_com.h" #include "mime.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index ed72605de..f0ee8efd8 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -40,7 +40,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #define FSCALE_DENOM_BY_12800_Q15 1311 diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 73ff582df..7b63e9c67 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7636,6 +7636,26 @@ Word16 norm_arr( Word16 *arr, Word16 size ) return q; } +Word16 W_norm_arr( Word64 *arr, Word16 size ) +{ + Word16 q = 63; + Word16 exp = 0; + move16(); + move16(); + FOR( Word16 i = 0; i < size; i++ ) + { + if ( arr[i] != 0 ) + { + exp = W_norm( arr[i] ); + } + if ( arr[i] != 0 ) + { + q = s_min( q, exp ); + } + } + return q; +} + Word16 get_min_scalefactor( Word32 x, Word32 y ) { #ifndef FIX_1104_OPT_GETMINSCALEFAC diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 0921dc88c..71b30ea75 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -6,7 +6,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "ivas_prot.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_agc_com_fx.c b/lib_com/ivas_agc_com_fx.c index 94e6b222f..3f6e181ef 100644 --- a/lib_com/ivas_agc_com_fx.c +++ b/lib_com/ivas_agc_com_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "cnst.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 006a31177..311bccff8 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "wmc_auto.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "stat_dec.h" diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index acc0df821..3a93ed1f5 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 9b60b2c5c..146587791 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_entropy_coder_common_fx.c b/lib_com/ivas_entropy_coder_common_fx.c index 99381d19a..f52d59859 100644 --- a/lib_com/ivas_entropy_coder_common_fx.c +++ b/lib_com/ivas_entropy_coder_common_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "math.h" #include "prot_fx.h" diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index 883861024..d5cd8d4f1 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_filters_fx.c b/lib_com/ivas_filters_fx.c index 7705deb6a..1e9aaf0c2 100644 --- a/lib_com/ivas_filters_fx.c +++ b/lib_com/ivas_filters_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_stat_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_ism_com_fx.c b/lib_com/ivas_ism_com_fx.c index f1201b06c..5f1a13afb 100644 --- a/lib_com/ivas_ism_com_fx.c +++ b/lib_com/ivas_ism_com_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index 7464c41c2..3d1e7aee6 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_stat_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "cnst.h" diff --git a/lib_com/ivas_masa_com_fx.c b/lib_com/ivas_masa_com_fx.c index fbe752aad..cfed06357 100644 --- a/lib_com/ivas_masa_com_fx.c +++ b/lib_com/ivas_masa_com_fx.c @@ -36,7 +36,6 @@ #include #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_mc_com_fx.c b/lib_com/ivas_mc_com_fx.c index 62d623b83..8201037a1 100644 --- a/lib_com/ivas_mc_com_fx.c +++ b/lib_com/ivas_mc_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mc_param_com_fx.c b/lib_com/ivas_mc_param_com_fx.c index a54abe7ab..4469e7f93 100644 --- a/lib_com/ivas_mc_param_com_fx.c +++ b/lib_com/ivas_mc_param_com_fx.c @@ -36,7 +36,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_mcmasa_com-fx.c b/lib_com/ivas_mcmasa_com-fx.c index da0b8f1c4..23a3800fb 100644 --- a/lib_com/ivas_mcmasa_com-fx.c +++ b/lib_com/ivas_mcmasa_com-fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "ivas_cnst.h" -#include "ivas_prot.h" #include "options.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mct_com_fx.c b/lib_com/ivas_mct_com_fx.c index 1f3c58153..81a56df14 100644 --- a/lib_com/ivas_mct_com_fx.c +++ b/lib_com/ivas_mct_com_fx.c @@ -33,8 +33,8 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_mdct_core_com_fx.c b/lib_com/ivas_mdct_core_com_fx.c index 000f3992f..fe313eecd 100644 --- a/lib_com/ivas_mdct_core_com_fx.c +++ b/lib_com/ivas_mdct_core_com_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mdft_imdft_fx.c b/lib_com/ivas_mdft_imdft_fx.c index b10444307..5d7bee1a6 100644 --- a/lib_com/ivas_mdft_imdft_fx.c +++ b/lib_com/ivas_mdft_imdft_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_omasa_com_fx.c b/lib_com/ivas_omasa_com_fx.c index ef6350285..1c1d4bf6c 100644 --- a/lib_com/ivas_omasa_com_fx.c +++ b/lib_com/ivas_omasa_com_fx.c @@ -33,7 +33,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_pca_tools_fx.c b/lib_com/ivas_pca_tools_fx.c index 1e36c5e8e..c84078a7d 100644 --- a/lib_com/ivas_pca_tools_fx.c +++ b/lib_com/ivas_pca_tools_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include #include diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 4a72b194a..6b23f8eed 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -5896,4 +5896,821 @@ void reset_metadata_spatial_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 nb_bits_metadata /* i : number of meatdata bits */ ); + +/*=============================================================================================*/ +/* clang-format off */ + +/*----------------------------------------------------------------------------------* + * General IVAS prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: number of channels to be analysed */ + +void copy_encoder_config_ivas_fx( + Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ + Encoder_State *st, /* o : encoder state structure */ + const Word16 flag_all /* i : flag 1==update all, 0=partial update Q0*/ +); + +ivas_error create_mct_enc_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void destroy_cpe_enc( + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ +); + +void ivas_mct_enc_close_fx( + MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ +); + +ivas_error pre_proc_front_ivas_fx( + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ + const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + const Word16 n, /* i : channel number Q0*/ + Word16 old_inp_12k8_fx[], /* o : buffer of old input signal Q_new-1*/ + Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz Q_new-1*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 *relE_fx, /* o : frame relative energy Q8*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* o : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* o : weighted A(z) unquantized for subframes Q12*/ + Word32 epsP_fx[M + 1], /* o : LP prediction errors epsP_fx_q*/ + Word16 *epsP_fx_q, + Word16 lsp_new_fx[M], /* o : LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* o : LSPs in the middle of the frame Q15*/ + Word16 *vad_hover_flag, /* o : VAD hangover flag Q0*/ + Word16 *attack_flag, /* o : flag signaling attack Q0*/ + Word32 realBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer Q(q_re_im_buf)*/ + Word32 imagBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer Q(q_re_im_buf)*/ + Word16 *q_re_im_buf, /* i/o: Q-factor of real and imag buffer */ + Word16 old_wsp_fx[], /* o : weighted input signal buffer q_old_wsp*/ + Word16 *q_old_wsp, + Word16 pitch_fr_fx[NB_SUBFR], /* o : fractional pitch values Q6*/ + Word16 voicing_fr_fx[NB_SUBFR], /* o : fractional pitch gains Q15*/ + Word16 *loc_harm, /* o : harmonicity flag Q0*/ + Word16 *cor_map_sum_fx, /* o : speech/music clasif. parameter Q8*/ + Word16 *vad_flag_dtx, /* o : HE-SAD flag with additional DTX HO Q0*/ + Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ + Word16 *enerBuffer_fx_exp, /* o : energy buffer */ + Word16 fft_buff_fx[2 * L_FFT], /* o : FFT buffer fft_buff_fx_q*/ + Word16 *fft_buff_fx_q, /* o : FFT buffer */ + const Word16 tdm_A_PCh_fx[M + 1], /* i : unq. LP coeff. of primary channel Q12*/ + const Word16 tdm_lsp_new_PCh_fx[M], /* i : unq. LSPs of primary channel Q15*/ + const Word16 currFlatness_fx, /* i : flatness parameter Q7*/ + const Word16 tdm_ratio_idx, /* i : Current Ratio_L index Q0*/ + Word32 fr_bands_LR_fx[][2 * NB_BANDS], /* i : energy in frequency bands (fr_bands_LR_fx_q) fr_bands_LR_fx_q*/ + Word16 fr_bands_LR_fx_q[CPE_CHANNELS], + const Word16 Etot_LR_fx[], /* i : total energy Left & Right channel Q8*/ + Word32 lf_E_LR_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels (lf_E_LR_fx_q)*/ + Word16 lf_E_LR_fx_q, + const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover, LR channels Q0*/ + Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN (band_energies_LR_fx_q)*/ + Word16 band_energies_LR_fx_q, + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ + const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ + const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ +#ifdef NONBE_1211_DTX_BR_SWITCHING + const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ +#endif + const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ + Word16 *Q_new +#ifdef DEBUG_MODE_INFO + , + const Word16 ch_idx +#endif +); +ivas_error pre_proc_ivas_fx( + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode Q0*/ + const Word32 element_brate, /* i : element bitrate Q0*/ + const Word32 last_element_brate, /* i : last element bitrate Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal Q_new-1 */ + Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new-1 */ + Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame Q_new*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes Q14*/ + Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q*/ + Word16 *epsP_fx_q, /* i : LP prediction errors */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ + Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_new-1*/ + Word16 *Voicing_flag, /* o : voicing flag for HQ FEC Q0*/ + Word16 old_wsp_fx[], /* i : weighted input signal buffer e_old_wsp*/ + Word16 e_old_wsp, + const Word16 loc_harm, /* i : harmonicity flag Q0*/ + const Word16 vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO Q0*/ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* e_enerBuffer */ + Word16 e_enerBuffer, + Word16 fft_buff_fx[2 * L_FFT], /* Qx */ + Word16 cor_map_sum_fx, /* Q8 */ + Word16 *Q_new +); +/*! r: number of clipped samples */ +void ivas_initialize_handles_enc_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +ivas_error ivas_init_encoder( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_destroy_enc_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +ivas_error ivas_initialize_MD_bstr_enc_fx( + BSTR_ENC_HANDLE *hBstr, /* o : encoder MD bitstream handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_destroy_MD_bstr_enc_fx( + BSTR_ENC_HANDLE *hMetaData /* i/o: encoder MD bitstream handle */ +); + +ivas_error ivas_init_decoder_front( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + + +void ivas_mct_dec_close( + MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ +); + +/*! r: number of channels to be synthesised */ + +void copy_decoder_config( + Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ + Decoder_State *st /* o : decoder state structure */ +); + +void ivas_initialize_handles_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_core_enc_fx( + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/ + Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/ + Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/ + Word16 Q_new[], + Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/ + Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/ + Word16 epsP_fx_q[], /* i : LP prediction errors */ + Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/ + const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/ + Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/ + Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/ + Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/ + Word16 *q_re_im_buf, + Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/ + Word16 e_old_wsp[], + const Word16 loc_harm[], /* i : harmonicity flag Q0*/ + const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/ + const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/ + Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/ + Word16 enerBuffer_fx_exp[], /* o : energy buffer */ + Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/ + const Word16 ivas_format, /* i : IVAS format Q0*/ + const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ +); + +void ivas_renderer_select( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_mc_enc_config_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +/*! r: flag indicating a valid bitrate */ +Word16 is_IVAS_bitrate_fx( + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +int16_t is_DTXrate( + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +); + + +/*----------------------------------------------------------------------------------* + * JBM prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_jbm_dec_set_discard_samples( + Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ +); + +TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( + Decoder_Struct *st_ivas /* i : IVAS decoder handle */ +); + +void ivas_jbm_dec_tc_buffer_close( + DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ +); + +void ivas_jbm_dec_td_renderers_adapt_subframes( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_jbm_dec_metadata_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_jbm_masa_sf_to_sf_map( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + + +/*----------------------------------------------------------------------------------* + * ISM prototypes + *----------------------------------------------------------------------------------*/ + +void bitbudget_to_brate( + const Word16 x[], /* i : bitbudgets Q0 */ + Word32 y[], /* o : bitrates Q0 */ + const Word16 N /* i : number of entries to be converted */ +); + +void ivas_ism_reset_metadata( + ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handles */ +); + +void ivas_ism_reset_metadata_enc( + ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ +); +void ivas_ism_reset_metadata_API( + ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handles */ +); + +/*! r: index of the winning codeword */ +Word16 ism_quant_meta_fx( + const Word32 val, /* i : scalar value to quantize Q22 */ + Word32 *valQ, /* o : quantized value Q22 */ + const Word32 borders_fx[], /* i : level borders Q22 */ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */ + const Word16 cbsize /* i : codebook size */ +); + +ivas_error ivas_ism_metadata_enc_create_fx( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 n_ISms, /* i : number of objects */ + Word32 element_brate_tmp[] /* o : element bitrate per object */ +); + +/*----------------------------------------------------------------------------------* + * Parametric ISM prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: ISM format mode */ + +ivas_error ivas_param_ism_enc_open_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_param_ism_enc_close_fx( + PARAM_ISM_CONFIG_HANDLE *hParamIsm, /* i/o: ParamISM handle */ + const Word32 input_Fs /* i : input sampling_rate */ +); + +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE hIsmMetaData[], /* i/o : object metadata handles */ + const Word16 first_idx /* i : index of first handle to deallocate */ +); + + +ivas_error ivas_ism_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +/*----------------------------------------------------------------------------------* + * ISM DTX prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_ism_dtx_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_ism_metadata_sid_enc_fx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const Word16 flag_noisy_speech, /* i : noisy speech flag */ + const Word16 nchan_ism, /* i : number of objects */ + const Word16 nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const Word16 sid_flag, /* i : indication of SID frame */ + const Word16 md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + Word16 nb_bits_metadata[] /* o : number of metadata bits */ +); + + + +void ivas_param_ism_compute_noisy_speech_flag_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +/*----------------------------------------------------------------------------------* + * DFT Stereo prototypes + *----------------------------------------------------------------------------------*/ + +void stereo_dft_dec_destroy( + STEREO_DFT_DEC_DATA_HANDLE *hStereoDft /* i/o: decoder DFT stereo handle */ +); + +/*----------------------------------------------------------------------------------* + * Range Coder prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: Read bit */ +UWord16 rc_uni_dec_read_bit( + RangeUniDecState *rc_st_dec /* i/o: RC state handle */ +); + +/*! r: Read bit */ +UWord16 rc_uni_dec_read_bit_prob_fast( + RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ + const Word16 freq0, /* i : Frequency for symbol 0 */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ +); + +/*! r: Read bits */ +UWord16 rc_uni_dec_read_bits( + RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ + const Word16 bits /* i : Number of bits */ +); + + +/*----------------------------------------------------------------------------------* + * TD Stereo prototypes + *----------------------------------------------------------------------------------*/ + +void tdm_bit_alloc( + const Word16 ivas_format, /* i : IVAS format */ + const Word16 ism_mode, /* i : ISM mode in combined format */ + const Word32 element_brate_wo_meta, /* i : element bitrate without metadata */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reusage flag */ + Word32 *total_brate_pri, /* o : Allocated primary channel bitrate */ + Word32 *total_brate_sec, /* o : Allocated secondary channel bitrate */ + Word16 *tdm_low_rate_mode, /* o : secondary channel low rate mode flag */ + const Word16 coder_type, /* i : secondary channel coder type */ + const Word16 ener_ratio_idx, /* i : correlation ratio indexe */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const Word16 bwidth_pri, /* i : bandwidth of the primary channel */ + const Word16 bwidth_sec, /* i : bandwidth of the secondary channel */ + const Word16 flag_ACELP16k_pri, /* i : ACELP@16kHz core flag, primary chan. */ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ + const Word16 tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ +); + + +/*! r: value of the indice */ +uint16_t get_indice_st( + Decoder_State *st, /* i/o: decoder state structure */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 pos, /* i : absolute position in the bitstream */ + const Word16 nb_bits /* i : number of bits to quantize the indice */ +); + +/*----------------------------------------------------------------------------------* + * MDCT Stereo prototypes + *----------------------------------------------------------------------------------*/ + +void stereo_mdct_core_enc_fx( + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/ + Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ + Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/ +); + +Word16 write_stereo_to_bitstream_fx +( + STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ + Encoder_State **sts, /* i/o: Encoder state structure */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) Q0*/ + BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ +); + +/*----------------------------------------------------------------------------------* + * Stereo CNG prototypes + *----------------------------------------------------------------------------------*/ +void stereo_cng_dec_update( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/ +); + + +/*----------------------------------------------------------------------------------* + * Framework general prototypes + *----------------------------------------------------------------------------------*/ + +void mvc2c( + const uint8_t x[], /* i : input vector */ + uint8_t y[], /* o : output vector */ + const int16_t n /* i : vector size */ +); + +void stereo_switching_dec( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/ +); + + +/*! r: number of bits written */ + + + +/*----------------------------------------------------------------------------------* + * MCT prototypes + *----------------------------------------------------------------------------------*/ +void ivas_mdct_core_whitening_enc_fx( + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples */ + Word16 old_wsp_fx[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ + Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ + Word32 *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ + Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */ + Word32 *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */ + Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ + Word16 p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 mct_on, /* i : flag mct block (1) or stereo (0) */ + const Word16 nChannels, /* i : total number of coded channels */ +Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV], +Word16 orig_spectrum_e[CPE_CHANNELS][NB_DIV] +); + +void splitAvailableBitsMCT_fx( + void **sts, /* i/o: encoder/decoder state structure */ + const Word16 total_bits, /* i : total number of available bits */ + const Word16 split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits Q0 */ + const Word16 enc_dec, /* i : encoder or decoder flag */ + const Word16 nchan /* i : number of channels */ +); + +void enc_prm_igf_mdct( + Encoder_State *st, /* i : Encoder state handle */ + BSTR_ENC_HANDLE hBstr /* i/o: Bitstream handle */ +); + +/*----------------------------------------------------------------------------------* + * Q Metadata prototypes for DirAC and MASA + *----------------------------------------------------------------------------------*/ +/*! r: number of bits written */ + +/*! r: number of bits read */ +Word16 ivas_qmetadata_dec_decode( + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ + const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +/*! r: number of bits read */ +Word16 ivas_qmetadata_dec_decode_hr_384_512( + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ + const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ + const Word16 bits_sph_idx, + const Word16 bits_sp_coh, + const UWord8 ncoding_bands_config +); + +/*! r: number of bits read */ +Word16 ivas_qmetadata_dec_sid_decode( + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + UWord16 *bitstream, /* i : bitstream */ + Word16 *index, /* i/o: bitstream position */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 *element_mode, /* o : element mode */ + const Word16 ivas_format /* i : IVAS format */ +); + + +UWord16 ivas_qmetadata_reorder_generic_fx( + const Word16 signed_value +); + +void ivas_sba_set_cna_cng_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +/*! r: number of ambisonics metadata channels */ + +void ivas_sba_dirac_stereo_config( + STEREO_DFT_CONFIG_DATA_HANDLE hConfig /* o : DFT stereo configuration */ +); + + +Word16 ivas_get_sba_dirac_stereo_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + + +/*----------------------------------------------------------------------------------* + * DirAC prototypes + *----------------------------------------------------------------------------------*/ + + +ivas_error ivas_dirac_enc_reconfigure( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); + +ivas_error ivas_mc_paramupmix_enc_open_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); + +void ivas_mc_paramupmix_enc_close_fx( + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + const int32_t input_Fs /* i : input sampling rate */ +); + +ivas_error ivas_mc_paramupmix_dec_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_mc_paramupmix_dec_close( + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ +); + +void ivas_mc_paramupmix_dec_read_BS( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + Word16 *nb_bits /* o : number of bits written */ +); + +void ivas_mc_paramupmix_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const Word16 nSamplesForRendering /* i : number of samples provided */ +); + +void ivas_param_mc_set_coded_bands_fx( + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ +); + +UWord16 ivas_param_mc_get_configuration_index_fx( + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +/*----------------------------------------------------------------------------------* + * SPAR prototypes + *----------------------------------------------------------------------------------*/ + +/* MD module */ + +/*! r: number of MD subframes */ +ivas_error ivas_spar_md_dec_open( + ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const Word16 num_channels, /* i : number of internal channels */ + const Word16 sba_order, /* i : SBA order */ + const Word16 sid_format, /* i : SID format */ + const Word32 last_active_ivas_total_brate /* i : IVAS last active bitrate */ +); + +void ivas_spar_md_dec_close( + ivas_spar_md_dec_state_t **hMdDec /* i/o: SPAR MD decoder handle */ +); + +ivas_error ivas_spar_md_dec_init( + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const Word16 num_channels, /* i : number of internal channels */ + const Word16 sba_order /* i : SBA order */ +); + +/* Transient detector module */ +ivas_error ivas_transient_det_open_fx( + ivas_trans_det_state_t **hTranDet, /* i/o: Transient detector handle */ + const Word32 sampling_rate /* i : sampling rate */ +); + +void ivas_transient_det_close_fx( + ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ +); + +void ivas_huffman_encode_fx( + ivas_huffman_cfg_t *huff_cfg, + Word16 in, + Word16 *hcode, + Word16 *hlen +); + +ivas_error ivas_huffman_decode( + ivas_huffman_cfg_t *huff_cfg, + Decoder_State *st0, + Word16 *dec_out +); + +void ivas_arith_decode_cmplx_cell_array( + ivas_arith_t *pArith_re, + ivas_arith_t *pArith_re_diff, + Decoder_State *st0, + ivas_cell_dim_t *pCell_dims, + Word16 *pDo_diff, const Word16 nB, + Word16 *pSymbol_re, + Word16 *pSymbol_re_old +); + +void ivas_map_prior_coeffs_quant( + ivas_spar_md_prev_t *pSpar_md_prior, + ivas_spar_md_com_cfg *pSpar_md_cfg, + const Word16 qsi, + const Word16 nB +); + +void ivas_clear_band_coeff_idx( + ivas_band_coeffs_ind_t *pband_coeff_idx, + const UWord16 num_bands +); + + +/*----------------------------------------------------------------------------------* + * MASA prototypes + *----------------------------------------------------------------------------------*/ +ivas_error ivas_masa_enc_open_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); + +void ivas_masa_enc_close_fx( + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ +); + +int16_t ivas_qmetadata_encode_extended_gr_length_fx( + const UWord16 value, + const UWord16 alphabet_size, + const Word16 gr_param); + +void ivas_qmetadata_encode_extended_gr_fx( + BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ + const UWord16 value, /* i : value to be encoded */ + const UWord16 alphabet_size, /* i : alphabet size */ + const Word16 gr_param); /* i : GR order */ + + +void ivas_set_qmetadata_maxbit_req_fx( + IVAS_QMETADATA_HANDLE hQMetaData, /* o : qmetadata structure where the requirement value is set */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ +); + + +/*---------------------------------------------------------------------------------* + * Binaural FastConv Renderer Prototypes +*-----------------------------------------------------------------------------------*/ + + +void ivas_binaural_hrtf_close( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ +); + +/*----------------------------------------------------------------------------------* + * renderer prototypes + *----------------------------------------------------------------------------------*/ + +void ivas_ism_renderer_close( + ISM_RENDERER_HANDLE *hIsmRendererData /* i/o: ISM renderer handle */ +); + + +/*----------------------------------------------------------------------------------* + * Amplitude Panning VBAP prototypes + *----------------------------------------------------------------------------------*/ + +void panning_wrap_angles( + const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ + const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ + float *azi_wrapped, /* o : wrapped azimuth component */ + float *ele_wrapped /* o : wrapped elevation component */ +); + + +/*----------------------------------------------------------------------------------* + * McMASA prototypes + *----------------------------------------------------------------------------------*/ + + +ivas_error ivas_mcmasa_dec_reconfig( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +); + +void ivas_mcmasa_dmx_modify_fx( + const Word16 n_samples, /* i : input frame length in samples */ + Word32 dmx_fx[][L_FRAME48k + NS2SA(48000, IVAS_FB_ENC_DELAY_NS)], /* i/o: downmix signal to be transformed into another format Qx*/ + Word16 dmx_Q[], /* i/o : Q of the intput signal which is being transformed*/ + const Word16 n_chnls_dmx_old, /* i : number of downmix channels in the old format Q0 */ + const Word16 n_chnls_dmx_new /* i : number of downmix channels in the target format Q0*/ +); + +ivas_error ivas_mono_dmx_renderer_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + + +void ivas_mono_dmx_renderer_close( + MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer /* i/ i/o: Mono downmix structure */ +); + + +/*----------------------------------------------------------------------------------* + * LFE encoder low pass filter prototypes + *----------------------------------------------------------------------------------*/ + +void ivas_lfe_lpf_enc_close_fx( + ivas_filters_process_state_t **hLfeLpf /* i/o: LFE LPF handle */ +); + + +/*----------------------------------------------------------------------------------* + * LFE Coding prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_create_lfe_enc_fx( + LFE_ENC_HANDLE *hLFE, /* o : IVAS LFE encoder structure */ + const Word32 input_Fs /* i : input sampling rate */ +); + +void ivas_lfe_enc_close_fx( + LFE_ENC_HANDLE *hLFE /* i/o: LFE encoder handle */ +); + +void ivas_filters_init_fx( + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order ) ; + +void ivas_filter_process_fx( + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ + const Word16 length, /* i : filter order */ + Word16 q_factor ); + +/*----------------------------------------------------------------------------------* + * OSBA prototypes + *----------------------------------------------------------------------------------*/ +ivas_error ivas_osba_enc_reconfig( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_set_surplus_brate_enc( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +#ifdef DEBUG_MODE_INFO + , + const int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif +); + +void ivas_set_surplus_brate_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int32_t *ism_total_brate /* i : ISM total bitrate */ +); + +ivas_error ivas_omasa_separate_object_renderer_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_omasa_separate_object_renderer_close( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +/*----------------------------------------------------------------------------------* + * Filter-bank (FB) Mixer + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_fb_set_cfg( + IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ + const Word16 ivas_format, /* i : IVAS format */ + const Word16 num_in_chans, /* i : number of FB input channels */ + const Word16 num_out_chans, /* i : number of FB output channels */ + const Word16 active_w_mixing, /* i : active_w_mixing flag */ + const Word32 sampling_Fs, /* i : sampling rate */ + const Word16 nachan_dirac_ana /* i : number of DirAR analysis channels */ +); + + +/*=============================================================================================*/ + #endif diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index 79a585e8b..c9ad84097 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -36,7 +36,6 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_qspherical_com_fx.c b/lib_com/ivas_qspherical_com_fx.c index 5caa850cb..6661026a8 100644 --- a/lib_com/ivas_qspherical_com_fx.c +++ b/lib_com/ivas_qspherical_com_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index 38785956c..b3a0806d4 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -38,7 +38,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index f35de8eb0..fa64b0092 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include @@ -61,12 +60,11 @@ void sns_compute_scf_fx( Word64 sum; Word32 L_tmp; const Word32 *pow_tilt; + Word16 q_shift, q_out, f_tmp; + Word16 bw, inv_bw, exp; const UWord8 nBands = pPsychParams->nBands; move16(); const UWord8 *bandLengths = pPsychParams->bandLengths; - Word8 bw = 0; - move16(); - Word16 q_shift; const Word16 w_0 = 2730; // (1.0f / 12.0f) in Q15 move16(); @@ -88,91 +86,83 @@ void sns_compute_scf_fx( IF( bandLengths == NULL ) { - bw = (Word8) shr( L_frame, 6 ); + bw = shr( L_frame, 6 ); move16(); + + exp = norm_s( bw ); + inv_bw = div_s( ONE_IN_Q14, shl( bw, exp ) ); // Q:15+14-exp = 29-exp + inv_bw = shl( inv_bw, sub( exp, 14 ) ); // Q15 + /* Energy per band */ k = 0; move16(); FOR( i = 0; i < nBands; ++i ) { - x_64[i] = 0; + sum = 0; move64(); FOR( n = 0; n < bw; ( ++n, ++k ) ) { - x_64[i] = W_add( x_64[i], W_deposit32_l( spectrum[k] ) ); // Q_in - move64(); + /* x[i] += spectrum[k]; + inv_bw is for x[i] /= bw; */ + sum = W_mac_32_16( sum, spectrum[k], inv_bw ); // Q_in+15+1 } + x_64[i] = sum; // Q_in+16 + move64(); } } ELSE { /* Energy per band */ k = 0; - move32(); + move16(); FOR( i = 0; i < nBands; ++i ) { - x_64[i] = 0; + exp = norm_s( bandLengths[i] ); + inv_bw = div_s( ONE_IN_Q14, shl( bandLengths[i], exp ) ); // Q:15+14-exp + inv_bw = shl( inv_bw, sub( exp, 14 ) ); // Q15 + + sum = 0; move64(); FOR( n = 0; n < bandLengths[i]; ( ++n, ++k ) ) { - x_64[i] = W_add( x_64[i], W_deposit32_l( spectrum[k] ) ); // Q_in - move64(); + /* x[i] += spectrum[k]; + inv_bw is for x[i] /= bandLengths[i]; */ + sum = W_mac_32_16( sum, spectrum[k], inv_bw ); // Q_in+15+1 } + x_64[i] = sum; // Q_in+16 + move64(); } } /* Move accumulated values to 32-bit */ - q_shift = 0; - move16(); - IF( x_64[0] != 0 ) + q_shift = W_norm_arr( x_64, nBands ); // W_norm_arr return 63 when all the values of the input buffer are zeroes + IF( EQ_16( q_shift, 63 ) ) { - q_shift = W_norm( x_64[0] ); - } - FOR( i = 1; i < nBands; ++i ) - { - IF( x_64[i] != 0 ) - { - q_shift = s_min( q_shift, W_norm( x_64[i] ) ); - } - } - FOR( i = 0; i < nBands; ++i ) - { - x[i] = W_extract_l( W_shl( x_64[i], sub( q_shift, 32 ) ) ); // Q_in + (q_shift - 32) - } + /* If all the values of x_64 are zeros, the scale factor (scf) values will be calculated as zeroes as per the below operations. + To avoid extra computations in such a case, set scf values as zeroes and return. */ - IF( bandLengths == NULL ) - { - Word16 inv_bw; - bw = (Word8) shr( L_frame, 6 ); - move16(); - inv_bw = div_l( ONE_IN_Q16 /*1 Q16*/, bw ); // Q15 - FOR( i = 0; i < nBands; ++i ) - { - x[i] = Mpy_32_16_1( x[i], inv_bw ); // Q_in + (q_shift - 32) - move32(); - } + set_zero_fx( scf, SNS_NPTS ); + + return; } - ELSE + + FOR( i = 0; i < nBands; ++i ) { - FOR( i = 0; i < nBands; ++i ) - { - Word16 inv_bw = div_l( ONE_IN_Q16 /*1 Q16*/, bandLengths[i] ); // Q15 - x[i] = Mpy_32_16_1( x[i], inv_bw ); // Q_in + (q_shift - 32) - move32(); - } + x[i] = W_extract_h( W_shl( x_64[i], q_shift ) ); // Q: Q_in+16+q_shift-32 = Q_in+q_shift-16 + move32(); } /* Smoothing */ - xs[0] = L_add( Mpy_32_16_1( x[0], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[1], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32) + xs[0] = Madd_32_16( Mpy_32_16_1( x[0], 24576 /* 0.75 in Q15 */ ), x[1], 8192 /* 0.25 in Q15 */ ); // Q_in+q_shift-16 move32(); FOR( i = 1; i < FDNS_NPTS - 1; i++ ) { - xs[i] = L_add( L_add( Mpy_32_16_1( x[i], 16384 /* 0.5 in Q15 */ ), Mpy_32_16_1( x[i - 1], 8192 /* 0.25 in Q15 */ ) ), Mpy_32_16_1( x[i + 1], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32) + xs[i] = Madd_32_16( Madd_32_16( Mpy_32_16_1( x[i], 16384 /* 0.5 in Q15 */ ), x[i - 1], 8192 /* 0.25 in Q15 */ ), x[i + 1], 8192 /* 0.25 in Q15 */ ); // Q_in+q_shift-16 move32(); } - xs[FDNS_NPTS - 1] = L_add( Mpy_32_16_1( x[FDNS_NPTS - 1], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[FDNS_NPTS - 2], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32) + xs[FDNS_NPTS - 1] = Madd_32_16( Mpy_32_16_1( x[FDNS_NPTS - 1], 24576 /* 0.75 in Q15 */ ), x[FDNS_NPTS - 2], 8192 /* 0.25 in Q15 */ ); // Q_in+q_shift-16 move32(); /* Pre-emphasis */ @@ -194,86 +184,83 @@ void sns_compute_scf_fx( FOR( i = 0; i < FDNS_NPTS; i++ ) { - xs[i] = Mpy_32_32( xs[i], pow_tilt[i] ); // Q_in + (q_shift - 32) + xs[i] = Mpy_32_32( xs[i], pow_tilt[i] ); // Q_in+q_shift-16+23-31 = Q_in+q_shift-24 move32(); } /* Noise floor at -40dB */ sum = 0; move64(); - FOR( Word16 ind = 0; ind < FDNS_NPTS; ind++ ) + FOR( i = 0; i < FDNS_NPTS; i++ ) { - sum = W_add( sum, W_deposit32_l( xs[ind] ) ); // Q_in + (q_shift - 32) + sum = W_mac_32_16( sum, xs[i], 1 ); // Q_in+q_shift-24+1 } - mean = W_extract_l( W_shr( sum, 6 ) ); // Q_in + (q_shift - 32) - nf = Mpy_32_32( mean, 214748 /* powf( 10.0f, -4.0f ) in Q31 */ ); // Q_in + (q_shift - 32) - nf = L_max( nf, 0 /* powf( 2.0f, -32.0f ) in Q31 */ ); // Q_in + (q_shift - 32) + q_out = sub( add( Q_in, q_shift ), 24 ); + + /* mean = sum / FDNS_NPTS; + -Q6 is for division with FDNS_NPTS and -Q1 is to reduce Q by one */ + mean = W_shl_sat_l( sum, -Q7 ); // q_out + nf = Mpy_32_32( mean, 214748 /* powf( 10.0f, -4.0f ) in Q31 */ ); // q_out + nf = L_max( nf, L_shl( 256, sub( q_out, 40 ) ) /* powf( 2.0f, -32.0f ) in Q40 */ ); // q_out FOR( i = 0; i < FDNS_NPTS; i++ ) { - if ( LT_32( xs[i], nf ) ) - { - xs[i] = nf; // Q_in + (q_shift - 32) - move32(); - } + xs[i] = L_max( xs[i], nf ); // q_out + move32(); } /* Log-domain */ FOR( i = 0; i < FDNS_NPTS; i++ ) { - Word16 e_tmp = norm_l( xs[i] ); - Word16 f_tmp = Log2_norm_lc( L_shl( xs[i], e_tmp ) ); /*Q16*/ - e_tmp = sub( sub( 34, e_tmp ), Q_in ); - /* Note: Mpy_32_16 is used temporarily for this computation, It needs to be replaced with appropriate BASOP. */ - xl[i] = Mpy_32_16( e_tmp, f_tmp, 16384 ); /* Q16 */ + /* xl[i] = logf( xs[i] ) * scale_log; + scale_log = INV_LOG_2 * 0.5f; */ + + exp = norm_l( xs[i] ); + f_tmp = Log2_norm_lc( L_shl( xs[i], exp ) ); // Q15 + exp = sub( sub( 30, exp ), q_out ); + L_tmp = L_mac( L_deposit_h( exp ), f_tmp, 1 ); // Q16 + xl[i] = L_shr( L_tmp, 1 ); // Q16 move32(); } /* Downsampling */ - L_tmp = L_deposit_l( 0 ); - L_tmp = Madd_32_16( L_tmp, xl[0], w_0 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[0], w_1 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[1], w_2 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[2], w_3 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[3], w_4 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[4], w_5 ); // Q16 - xl4[0] = L_tmp; // Q16 - move32(); + L_tmp = Madd_32_16( Mpy_32_16_1( xl[0], w_0 ), xl[0], w_1 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[1], w_2 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[2], w_3 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[3], w_4 ); // Q16 + xl4[0] = Madd_32_16( L_tmp, xl[4], w_5 ); // Q16 + FOR( n = 1; n < SNS_NPTS - 1; n++ ) { - Word16 n4 = shl( n, 2 ); - - L_tmp = L_deposit_l( 0 ); - L_tmp = Madd_32_16( L_tmp, xl[n4 - 1], w_0 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[n4], w_1 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[n4 + 1], w_2 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[n4 + 2], w_3 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[n4 + 3], w_4 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[n4 + 4], w_5 ); // Q16 - xl4[n] = L_tmp; // Q16 + L_tmp = Mpy_32_16_1( xl[4 * n - 1], w_0 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[4 * n], w_1 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[4 * n + 1], w_2 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[4 * n + 2], w_3 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[4 * n + 3], w_4 ); // Q16 + xl4[n] = Madd_32_16( L_tmp, xl[4 * n + 4], w_5 ); // Q16 move32(); } - L_tmp = L_deposit_l( 0 ); - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 5], w_0 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 4], w_1 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 3], w_2 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 2], w_3 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_4 ); // Q16 - L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_5 ); // Q16 - xl4[SNS_NPTS - 1] = L_tmp; // Q16 + L_tmp = Mpy_32_16_1( xl[FDNS_NPTS - 5], w_0 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 4], w_1 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 3], w_2 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 2], w_3 ); // Q16 + L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_4 ); // Q16 + xl4[SNS_NPTS - 1] = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_5 ); // Q16 move32(); /* Remove mean and scaling */ sum = 0; move64(); - FOR( Word16 ind = 0; ind < SNS_NPTS; ind++ ) + FOR( i = 0; i < SNS_NPTS; i++ ) { - sum = W_add( sum, W_deposit32_l( xl4[ind] ) ); // Q16 + sum = W_mac_32_16( sum, xl4[i], 1 ); // Q16+1 } - mean = W_extract_l( W_shr( sum, 4 ) ); // Q16 + /* mean = sum / SNS_NPTS; + -Q4 is for division with SNS_NPTS and -Q1 is to reduce Q by one */ + mean = W_shl_sat_l( sum, -Q5 ); // Q16 FOR( i = 0; i < SNS_NPTS; i++ ) { diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 96df64aa5..929eaa2c5 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -36,7 +36,6 @@ #include "basop_util.h" #include "ivas_stat_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "cnst.h" diff --git a/lib_com/ivas_spar_com_quant_util_fx.c b/lib_com/ivas_spar_com_quant_util_fx.c index 8292de5c1..cfd03a3b3 100644 --- a/lib_com/ivas_spar_com_quant_util_fx.c +++ b/lib_com/ivas_spar_com_quant_util_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "math.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_dft_com_fx.c b/lib_com/ivas_stereo_dft_com_fx.c index 80e64c0cc..6d63bc6d1 100644 --- a/lib_com/ivas_stereo_dft_com_fx.c +++ b/lib_com/ivas_stereo_dft_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_eclvq_com_fx.c b/lib_com/ivas_stereo_eclvq_com_fx.c index d0ffff39c..958781473 100644 --- a/lib_com/ivas_stereo_eclvq_com_fx.c +++ b/lib_com/ivas_stereo_eclvq_com_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c index 9aa880842..8548797a4 100644 --- a/lib_com/ivas_stereo_ica_com_fx.c +++ b/lib_com/ivas_stereo_ica_com_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_com/ivas_stereo_mdct_bands_com_fx.c b/lib_com/ivas_stereo_mdct_bands_com_fx.c index c21abcf8c..43f2f16c7 100644 --- a/lib_com/ivas_stereo_mdct_bands_com_fx.c +++ b/lib_com/ivas_stereo_mdct_bands_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_mdct_stereo_com_fx.c b/lib_com/ivas_stereo_mdct_stereo_com_fx.c index dd94358af..0a773169d 100644 --- a/lib_com/ivas_stereo_mdct_stereo_com_fx.c +++ b/lib_com/ivas_stereo_mdct_stereo_com_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include #include "prot_fx.h" diff --git a/lib_com/ivas_stereo_psychlpc_com_fx.c b/lib_com/ivas_stereo_psychlpc_com_fx.c index cb3c39df2..df5140895 100644 --- a/lib_com/ivas_stereo_psychlpc_com_fx.c +++ b/lib_com/ivas_stereo_psychlpc_com_fx.c @@ -33,9 +33,7 @@ #include #include "options.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_stereo_td_bit_alloc_fx.c b/lib_com/ivas_stereo_td_bit_alloc_fx.c index 9074473d7..b54c1d3de 100644 --- a/lib_com/ivas_stereo_td_bit_alloc_fx.c +++ b/lib_com/ivas_stereo_td_bit_alloc_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "stat_enc.h" #include "rom_com.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "prot_fx.h" diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index e15db9a15..04d6f7bf5 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_transient_det_fx.c b/lib_com/ivas_transient_det_fx.c index 97025b46f..3b9a8cfd7 100644 --- a/lib_com/ivas_transient_det_fx.c +++ b/lib_com/ivas_transient_det_fx.c @@ -36,7 +36,6 @@ #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_com.h" diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 6bd8026c4..12234a4c0 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -40,7 +40,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index d0f0efb72..db0953cd9 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4701,6 +4701,7 @@ Word16 find_guarded_bits_fx( Word32 n ); Word16 L_norm_arr( const Word32 *arr, Word16 size ); Word16 norm_arr( Word16 *arr, Word16 size ); +Word16 W_norm_arr( Word64 *arr, Word16 size ); Word16 get_min_scalefactor( Word32 x, Word32 y ); diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 1f112c911..7905c7145 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -41,7 +41,6 @@ #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 34e74a06f..22e9fff01 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -12,7 +12,6 @@ #include "prot_fx.h" #include "ivas_prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" /*-------------------------------------------------------------------* * ACcontextMapping_decode2_no_mem_s17_LC() diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 11379a62d..782654623 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -41,7 +41,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 191065855..d1ed7ad8c 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -10,7 +10,6 @@ #include "stl.h" #include "options.h" #include "math.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 907a4a350..c1b0ce93a 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -9,7 +9,6 @@ #include "options.h" #include "stl.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "cnst.h" #include "stat_dec.h" @@ -2932,14 +2931,14 @@ static void IGF_getWhiteSpectralData_ivas( { ak = 0; move32(); - move16(); FOR( j = i - level; j < stop; j++ ) { tmp_16 = extract_h( L_shl( in[j], s_l ) ); // e: in_e - s_l ak = L_mac( ak, tmp_16, tmp_16 ); // e: 2 * (in_e - s_l) } - ak = Mult_32_16( ak, quo ); + ak = L_deposit_h( BASOP_Util_Divide3216_Scale( ak, sub( stop, sub( i, level ) ), &tmp_e ) ); + ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15 n = sub( 30, add( norm_l( ak ), sub( 31, ak_e ) ) ); n = shr( n, 1 ); diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c index e73d89158..a196a1abd 100644 --- a/lib_dec/ivas_agc_dec_fx.c +++ b/lib_dec/ivas_agc_dec_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 3c234c098..8527e6703 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 5bb4736e9..7b4e5f267 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 697f9d715..25c0bea42 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -32,7 +32,6 @@ #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 9bf53f1de..6a6294377 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_decision_matrix_dec_fx.c b/lib_dec/ivas_decision_matrix_dec_fx.c index f7fd5e8e2..717bb3b93 100644 --- a/lib_dec/ivas_decision_matrix_dec_fx.c +++ b/lib_dec/ivas_decision_matrix_dec_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "stat_dec.h" #include "rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index d0c78b604..b8a7f61bb 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index e03913f8a..b247fd653 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -41,7 +41,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_entropy_decoder_fx.c b/lib_dec/ivas_entropy_decoder_fx.c index e637a6a93..f8bf3c091 100644 --- a/lib_dec/ivas_entropy_decoder_fx.c +++ b/lib_dec/ivas_entropy_decoder_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 8db782c4e..b11669460 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 664e3eeac..643874a82 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_ism_dtx_dec_fx.c b/lib_dec/ivas_ism_dtx_dec_fx.c index cbf088597..0f023a7ef 100644 --- a/lib_dec/ivas_ism_dtx_dec_fx.c +++ b/lib_dec/ivas_ism_dtx_dec_fx.c @@ -33,7 +33,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_ism_metadata_dec_fx.c b/lib_dec/ivas_ism_metadata_dec_fx.c index a6f5e47b6..3288903ab 100644 --- a/lib_dec/ivas_ism_metadata_dec_fx.c +++ b/lib_dec/ivas_ism_metadata_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index eae0e9069..3aed4d3b1 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -34,7 +34,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot_fx.h" #include "rom_com.h" diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index a19ba70ec..7cd93affa 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_stat_com.h" diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 428c817ef..210425b88 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index e68c0142d..672d3fbe6 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "rom_com.h" diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 018f99fe7..210c266eb 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_ls_custom_dec_fx.c b/lib_dec/ivas_ls_custom_dec_fx.c index 45f59d82f..5ad390f9a 100644 --- a/lib_dec/ivas_ls_custom_dec_fx.c +++ b/lib_dec/ivas_ls_custom_dec_fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include #include "options.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 806785c15..384865a1a 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index be2363469..697ae6345 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 9ea666237..3c2ba7587 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "prot_fx.h" #include "ivas_prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "rom_com.h" diff --git a/lib_dec/ivas_mcmasa_dec_fx.c b/lib_dec/ivas_mcmasa_dec_fx.c index c2228b610..1b1715c21 100644 --- a/lib_dec/ivas_mcmasa_dec_fx.c +++ b/lib_dec/ivas_mcmasa_dec_fx.c @@ -33,7 +33,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_mct_core_dec_fx.c b/lib_dec/ivas_mct_core_dec_fx.c index be457da47..fe39fd8e3 100644 --- a/lib_dec/ivas_mct_core_dec_fx.c +++ b/lib_dec/ivas_mct_core_dec_fx.c @@ -39,7 +39,6 @@ #include "cnst.h" #include "basop_proto_func.h" #include "stat_com.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 081eca88d..884a44c9e 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -38,7 +38,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 69f601724..c275820fb 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index a5855a0f6..35d38d03a 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -40,7 +40,6 @@ #include "cnst.h" #include "basop_proto_func.h" #include "stat_com.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" #include diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index bb5dead22..2eb8d84df 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -35,7 +35,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 391a27522..b88b68915 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index bf7fba094..afa604684 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -33,7 +33,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "ivas_prot_rend.h" diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 07ea14ea2..6f1a233c9 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -33,7 +33,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 4811911fd..84b6fe46d 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -35,7 +35,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index cb96d3b0d..3a0960960 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index 08ac17799..98611ab7c 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_post_proc_fx.c b/lib_dec/ivas_post_proc_fx.c index 397f26bbc..9357394a5 100644 --- a/lib_dec/ivas_post_proc_fx.c +++ b/lib_dec/ivas_post_proc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index 81768af44..c78c51c52 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_qspherical_dec_fx.c b/lib_dec/ivas_qspherical_dec_fx.c index d34b5402a..f6ac39a99 100644 --- a/lib_dec/ivas_qspherical_dec_fx.c +++ b/lib_dec/ivas_qspherical_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_range_uni_dec_fx.c b/lib_dec/ivas_range_uni_dec_fx.c index e629111ce..9a49680e8 100644 --- a/lib_dec/ivas_range_uni_dec_fx.c +++ b/lib_dec/ivas_range_uni_dec_fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_stat_dec.h" #include "cnst.h" diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index efd766f76..f04350366 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 573a9c17f..0c7544682 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index a42c67389..8748342ed 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 89581565c..a6be10c08 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 170256181..fd25e7ea7 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 812027468..34a194898 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -37,7 +37,6 @@ #include "ivas_stat_dec.h" #include "prot_fx.h" #include "string.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index bb79b956c..7f487a75c 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "math.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_adapt_GR_dec_fx.c b/lib_dec/ivas_stereo_adapt_GR_dec_fx.c index 8446af47d..2bade4786 100644 --- a/lib_dec/ivas_stereo_adapt_GR_dec_fx.c +++ b/lib_dec/ivas_stereo_adapt_GR_dec_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "prot_fx.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "rom_dec.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 4d50ba350..223860db0 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -35,7 +35,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 166ac72e5..f0fd1978b 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -38,7 +38,6 @@ #include "rom_com.h" #include "rom_dec.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c index 0781d49a6..e82005965 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index fb54476fa..1c18ffacb 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -38,7 +38,6 @@ #include "rom_com.h" #include "rom_dec.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index d3415a8eb..90d9c5823 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "math.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_eclvq_dec_fx.c b/lib_dec/ivas_stereo_eclvq_dec_fx.c index 693df8c77..dfa411145 100644 --- a/lib_dec/ivas_stereo_eclvq_dec_fx.c +++ b/lib_dec/ivas_stereo_eclvq_dec_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_stereo_esf_dec_fx.c b/lib_dec/ivas_stereo_esf_dec_fx.c index 80603f6c0..d4219f1e6 100644 --- a/lib_dec/ivas_stereo_esf_dec_fx.c +++ b/lib_dec/ivas_stereo_esf_dec_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index b49ab5399..694aad0b4 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 22a8c4a90..3b32072f3 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "wmc_auto.h" #include "rom_com.h" diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 04781a9cb..a6b350d33 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -37,7 +37,6 @@ #include "prot_fx.h" #include "cnst.h" #include "stat_com.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 69083a078..3f39bd9ac 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index e5e18083d..09b683a16 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_dec/ivas_stereo_td_dec_fx.c b/lib_dec/ivas_stereo_td_dec_fx.c index 8ab7da035..023c9a2e5 100644 --- a/lib_dec/ivas_stereo_td_dec_fx.c +++ b/lib_dec/ivas_stereo_td_dec_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "wmc_auto.h" @@ -338,45 +337,6 @@ void tdm_configure_dec_fx( return; } -/*-------------------------------------------------------------------* - * Function tdm_downmix_plain() - * - * downmix Left+Right to Primary+Secondary channel - *-------------------------------------------------------------------*/ - -void tdm_upmix_plain( - float Left[], /* o : left channel */ - float Right[], /* o : right channel */ - const float PCh_2_L[], /* i : primary channel */ - const float SCh_2_R[], /* i : secondary channel */ - const float LR_ratio, /* i : mixing ratio */ - const float inv_den_LR_ratio, /* i : inverse mixing ration */ - const int16_t start_index, /* i : start index */ - const int16_t end_index, /* i : end index */ - const int16_t plus_minus_flag /* i : plus/minus flag */ -) -{ - int16_t i; - - if ( plus_minus_flag == 1 ) - { - for ( i = start_index; i < end_index; i++ ) - { - Left[i] = ( LR_ratio * ( PCh_2_L[i] - SCh_2_R[i] ) + SCh_2_R[i] ) * inv_den_LR_ratio; - Right[i] = ( -LR_ratio * ( PCh_2_L[i] + SCh_2_R[i] ) + PCh_2_L[i] ) * inv_den_LR_ratio; - } - } - else - { - for ( i = start_index; i < end_index; i++ ) - { - Left[i] = ( LR_ratio * ( PCh_2_L[i] + SCh_2_R[i] ) - SCh_2_R[i] ) * inv_den_LR_ratio; - Right[i] = ( LR_ratio * ( PCh_2_L[i] - SCh_2_R[i] ) - PCh_2_L[i] ) * inv_den_LR_ratio; - } - } - - return; -} void tdm_upmix_plain_fx( Word32 Left_fx[], /* o : left channel Qx*/ Word32 Right_fx[], /* o : right channel Qx*/ diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 375dbdad0..1467687d8 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c908e4dc3..07eba9e64 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -40,7 +40,6 @@ #include "wmc_auto.h" #include "basop_proto_func.h" #include "stat_com.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------* diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index 63819b056..98c1a6a79 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -38,7 +38,6 @@ #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" void tdm_low_rate_dec_fx( diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 66109b555..ef3baee3c 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -35,7 +35,6 @@ #include #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index d263e6dd3..21e8705f3 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* * Local functions diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 44439540f..c52fddf97 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -13,7 +13,6 @@ #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "prot_fx_enc.h" -#include "ivas_prot.h" /* Range coder header file */ #define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) /* evaulated at compile time */ #define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) /* evaluated at run time */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 0f58bcdad..782006108 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -13,7 +13,6 @@ #include "rom_com_fx.h" /* Static table prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_enc/cod4t64_fast.c b/lib_enc/cod4t64_fast.c index a901690e3..0e4c02744 100644 --- a/lib_enc/cod4t64_fast.c +++ b/lib_enc/cod4t64_fast.c @@ -35,7 +35,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c54e8ccf4..7c28c3309 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -16,7 +16,6 @@ #include "prot_fx_enc.h" #ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" #endif diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 9e6318591..f546c3ef8 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -1165,18 +1165,30 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { + Word16 q_mdstWin, scale; L_subframe = idiv1616( L_frameTCX, nSubframes ); /* Q0 */ test(); IF( EQ_16( transform_type[frameno], TCX_20 ) && NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { wtda_ext_fx( hTcxEnc->new_speech_TCX, mdstWin, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX, 3 ); - Scale_sig( mdstWin, L_frameTCX, 1 ); + scale = sub( norm_arr( mdstWin, L_frameTCX ), 1 ); + scale = s_min( 1, scale ); // restricting the Q to zero or less + scale_sig( mdstWin, L_frameTCX, scale ); + q_mdstWin = add( -1, scale ); + move16(); } ELSE { + Word16 sig_len; /* Windowing for the MDST */ WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 ); + sig_len = add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ); + scale = sub( norm_arr( mdstWin, sig_len ), 1 ); + scale = s_min( 0, scale ); // restricting the Q to zero or less + scale_sig( mdstWin, sig_len, scale ); + q_mdstWin = scale; + move16(); } IF( EQ_16( transform_type[frameno], TCX_5 ) ) @@ -1184,7 +1196,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outer left folding */ FOR( i = 0; i < left_overlap / 2; i++ ) { - mdstWin[left_overlap / 2 + i] = add_sat( mdstWin[left_overlap / 2 + i], mdstWin[left_overlap / 2 - 1 - i] ); // Q0 + mdstWin[left_overlap / 2 + i] = add( mdstWin[left_overlap / 2 + i], mdstWin[left_overlap / 2 - 1 - i] ); // q_mdstWin } test(); @@ -1197,16 +1209,16 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - mdstWin[left_overlap + i] = add_sat( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - mdstWin[left_overlap + i] = add_sat( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } } @@ -1214,7 +1226,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outer right folding */ FOR( i = 0; i < right_overlap / 2; i++ ) { - mdstWin[L_subframe + left_overlap / 2 - 1 - i] = sub_sat( mdstWin[L_subframe + left_overlap / 2 - 1 - i], mdstWin[L_subframe + left_overlap / 2 + i] ); // Q0 + mdstWin[L_subframe + left_overlap / 2 - 1 - i] = sub( mdstWin[L_subframe + left_overlap / 2 - 1 - i], mdstWin[L_subframe + left_overlap / 2 + i] ); // q_mdstWin move16(); } @@ -1229,7 +1241,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 ); - spectrum_e[frameno] = 16; + spectrum_e[frameno] = sub( 16, q_mdstWin ); move16(); TCX_MDST( tcx5Win, spectrum[frameno] + i * tcx5SizeFB, &spectrum_e[frameno], left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); /* high-band gain control in case of BWS */ @@ -1250,14 +1262,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( } ELSE /* transform_type[frameno] != TCX_5 */ { - spectrum_e[frameno] = 16; + spectrum_e[frameno] = sub( 16, q_mdstWin ); test(); IF( EQ_16( transform_type[frameno], TCX_20 ) && NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { Word16 Q; Copy_Scale_sig_16_32_no_sat( mdstWin, L_tmpbuf, N_MAX + L_MDCT_OVLP_MAX, 16 ); - Q = 16; + Q = add( q_mdstWin, 16 ); move16(); edst_fx( L_tmpbuf, spectrum[frameno], L_subframe, &Q ); spectrum_e[frameno] = 31 - Q; @@ -1284,16 +1296,16 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - mdstWin[left_overlap + i] = add_sat( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - mdstWin[left_overlap + i] = add_sat( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } } diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index f6adb0f31..fc7c32fdb 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -39,7 +39,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "cnst.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index 104eeb998..d74e10bda 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 5f318e959..f88288ea1 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -36,7 +36,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 46de4e232..42920a46a 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -38,7 +38,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "prot_fx_enc.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 73403a848..8d00e608c 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "cnst.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 32e3e7107..f21c8e262 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -35,7 +35,6 @@ #include "ivas_cnst.h" #include "prot_fx.h" #include "prot_fx_enc.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "math.h" diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index a9d62a2b0..1152736f6 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "prot_fx_enc.h" #include "ivas_rom_com.h" #ifdef DEBUGGING diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index 1158f72fa..bd63553bd 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index 7bfa9f268..ac0ce9556 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 576bbb2c6..c05d59b90 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index 0a2d976e1..e8e1bc59e 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/ivas_entropy_coder_fx.c b/lib_enc/ivas_entropy_coder_fx.c index a95f2884c..3c8cf92e2 100644 --- a/lib_enc/ivas_entropy_coder_fx.c +++ b/lib_enc/ivas_entropy_coder_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "math.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index f1aeb5398..8b76b37a4 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "prot_fx_enc.h" #include #include "wmc_auto.h" @@ -433,30 +432,6 @@ ivas_error front_vad_create_fx( return IVAS_ERR_OK; } -/*-----------------------------------------------------------------------------------------* - * Function front_vad_destroy() - * - * Deallocate Standalone front-VAD module - *-----------------------------------------------------------------------------------------*/ - -void front_vad_destroy( - FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ -) -{ - IF( *hFrontVad != NULL ) - { - free( ( *hFrontVad )->hNoiseEst ); - ( *hFrontVad )->hNoiseEst = NULL; - - free( ( *hFrontVad )->hVAD ); - ( *hFrontVad )->hVAD = NULL; - - free( *hFrontVad ); - *hFrontVad = NULL; - } - - return; -} void front_vad_destroy_fx( FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ ) diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index c65c85356..b49fc9716 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_enc.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 64b8991d6..b29b0c15b 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 22bf88df8..1b648cc98 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index 4305e5bca..6a2e54db6 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "prot_fx.h" diff --git a/lib_enc/ivas_ism_param_enc_fx.c b/lib_enc/ivas_ism_param_enc_fx.c index e6b23fcfc..cda8cffd6 100644 --- a/lib_enc/ivas_ism_param_enc_fx.c +++ b/lib_enc/ivas_ism_param_enc_fx.c @@ -34,7 +34,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "cnst.h" diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index 11056b535..96959c9dd 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "math.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 21c23c34a..6960629c8 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 2797fa5e4..17fefec7e 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -38,7 +38,6 @@ #include "ivas_rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index abd09cbbd..fd5cb6217 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "basop_util.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index c4d3908ca..22f21dceb 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "options.h" #include "prot_fx.h" diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 439c227ae..71515571d 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "wmc_auto.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index d6bc4c7f0..56f5e44db 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 88d773b53..a8ba9a320 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 70b2b0034..3272768e9 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -37,7 +37,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" @@ -705,8 +704,8 @@ static void applyStereoPreProcessingCplx( } ELSE { - dmxR2_fx = L_sub( Mpy_32_32( valR1_fx, factIn_fx ), Mpy_32_32( valR2_fx, factDe_fx ) ); // Q = q_com + Q22 - 31 - dmxI2_fx = L_sub( Mpy_32_32( valI1_fx, factIn_fx ), Mpy_32_32( valI2_fx, factDe_fx ) ); // Q = q_com + Q22 - 31 + dmxR2_fx = L_sub( Mpy_32_32( valR2_fx, factDe_fx ), Mpy_32_32( valR1_fx, factIn_fx ) ); // Q = q_com + Q22 - 31 + dmxI2_fx = L_sub( Mpy_32_32( valI2_fx, factDe_fx ), Mpy_32_32( valI1_fx, factIn_fx ) ); // Q = q_com + Q22 - 31 } } ELSE @@ -1923,7 +1922,6 @@ void ivas_mdct_core_whitening_enc_fx( tcx_subframe_coded_lines = shr( tcx_subframe_coded_lines, shift ); /*tcx_subframe_coded_lines / nSubframes*/ Word16 q_pow = 62, q_pow_tmp = sub( 63, shl( mdst_spectrum_e[0][0], 1 ) ); // add( shl( sub( Q31, mdst_spectrum_e[0][0] ), 1 ), 1 ); move16(); - FOR( n = 0; n < nSubframes; n++ ) { IF( st->hTcxEnc->fUseTns[n] ) @@ -1932,34 +1930,19 @@ void ivas_mdct_core_whitening_enc_fx( { powerSpec_fx64[i] = W_mult_32_32( st->hTcxEnc->spectrum_fx[n][i], st->hTcxEnc->spectrum_fx[n][i] ); move64(); - IF( powerSpec_fx64[i] == 0 ) - { - q_pow = s_min( q_pow, 62 ); - } - ELSE - - { - q_pow = s_min( q_pow, W_norm( powerSpec_fx64[i] ) ); - } } + q_pow = W_norm_arr( powerSpec_fx64, L_subframeTCX ); } ELSE { FOR( i = 0; i < L_subframeTCX; i++ ) { - powerSpec_fx64[i] = W_add( W_mult_32_32( mdst_spectrum_fx[ch][n][i], mdst_spectrum_fx[ch][n][i] ), W_mult_32_32( st->hTcxEnc->spectrum_fx[n][i], st->hTcxEnc->spectrum_fx[n][i] ) ); + powerSpec_fx64[i] = W_mac_32_32( W_mult_32_32( mdst_spectrum_fx[ch][n][i], mdst_spectrum_fx[ch][n][i] ), st->hTcxEnc->spectrum_fx[n][i], st->hTcxEnc->spectrum_fx[n][i] ); move64(); - IF( powerSpec_fx64[i] == 0 ) - { - q_pow = s_min( q_pow, 62 ); - } - ELSE - - { - q_pow = s_min( q_pow, W_norm( powerSpec_fx64[i] ) ); - } } + q_pow = W_norm_arr( powerSpec_fx64, L_subframeTCX ); } + FOR( i = 0; i < L_subframeTCX; i++ ) { powerSpec_fx64[i] = W_shl( powerSpec_fx64[i], q_pow ); diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 7c8b78ffb..5d79265f4 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 1229624de..2a6944c50 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" diff --git a/lib_enc/ivas_pca_enc_fx.c b/lib_enc/ivas_pca_enc_fx.c index 410d5dd52..2cb347a02 100644 --- a/lib_enc/ivas_pca_enc_fx.c +++ b/lib_enc/ivas_pca_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include #include diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index b32c80404..2d6080995 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" diff --git a/lib_enc/ivas_qspherical_enc_fx.c b/lib_enc/ivas_qspherical_enc_fx.c index a6f40c8f0..2e7a289f9 100644 --- a/lib_enc/ivas_qspherical_enc_fx.c +++ b/lib_enc/ivas_qspherical_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_range_uni_enc_fx.c b/lib_enc/ivas_range_uni_enc_fx.c index cf32c644d..6c322a3d9 100644 --- a/lib_enc/ivas_range_uni_enc_fx.c +++ b/lib_enc/ivas_range_uni_enc_fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_stat_enc.h" diff --git a/lib_enc/ivas_sba_enc_fx.c b/lib_enc/ivas_sba_enc_fx.c index 8fdca5815..e630a70d9 100644 --- a/lib_enc/ivas_sba_enc_fx.c +++ b/lib_enc/ivas_sba_enc_fx.c @@ -39,7 +39,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "ivas_prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 8c2c945d6..2983ea2f0 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -38,7 +38,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "prot_fx_enc.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index e321f1c7c..93ee56461 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index 674a80549..3b380f2eb 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -33,7 +33,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 2ace35473..997581476 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "math.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c index 70c2165f8..8e79b2288 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index bfe683d6b..3e148a5ae 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -39,7 +39,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_stereo_cng_enc_fx.c b/lib_enc/ivas_stereo_cng_enc_fx.c index 255b6e938..aa7c2d0aa 100644 --- a/lib_enc/ivas_stereo_cng_enc_fx.c +++ b/lib_enc/ivas_stereo_cng_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index ede3d3ad9..3eb6c0e82 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -38,7 +38,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index 862102d3b..8a887de89 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -38,7 +38,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index 58e66a01a..df4fe3edd 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "prot_fx.h" #include "rom_com.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index c3cb68719..ae8a8203e 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_stereo_eclvq_enc_fx.c b/lib_enc/ivas_stereo_eclvq_enc_fx.c index f4962c802..3abc07811 100644 --- a/lib_enc/ivas_stereo_eclvq_enc_fx.c +++ b/lib_enc/ivas_stereo_eclvq_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 78c324cce..057798706 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 78891c5f7..bc84ba419 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 28b0e41b9..b68578542 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c index 57bb18e80..851df60d5 100644 --- a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c @@ -38,7 +38,6 @@ #include "cnst.h" #include "stat_enc.h" #include "ivas_stat_enc.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index b1213a750..a61b2b010 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index cbdbc0501..2fe8b6c84 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index efae1e80d..44c08efa8 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "rom_enc.h" diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 979978c03..d2ff2c0c2 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #ifdef DEBUGGING diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 28044b45d..1e66c1488 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -39,7 +39,6 @@ #include "rom_com.h" #include "basop_proto_func.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" #include "rom_com_fx.h" diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index 34215025f..2daa9ed50 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -39,7 +39,6 @@ #include "ivas_cnst.h" #include "prot_fx.h" #include "prot_fx_enc.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "wmc_auto.h" diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 9d4736368..9093ffc40 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -39,7 +39,6 @@ #include "debug.h" #endif #include "lib_enc.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 0887698f7..01005f641 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -53,7 +53,8 @@ Word16 lp_filt_exc_enc_fx( Word16 wtmp, wtmp1; Word32 Ltmp; - Word16 use_prev_sf_pit_gain = 0; + Word16 use_prev_sf_pit_gain = 0; // Q0 + move16(); gain1 = 0; move16(); @@ -66,7 +67,8 @@ Word16 lp_filt_exc_enc_fx( test(); IF( EQ_16( codec_mode, MODE2 ) && EQ_16( coder_type, 100 ) ) { - use_prev_sf_pit_gain = 1; + use_prev_sf_pit_gain = 1; // Q0 + move16(); } exp_ener = 0; move16(); @@ -75,7 +77,7 @@ Word16 lp_filt_exc_enc_fx( test(); IF( EQ_16( *lp_flag, FULL_BAND ) || EQ_16( *lp_flag, NORMAL_OPERATION ) ) { - wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); + wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener move16(); } @@ -89,7 +91,7 @@ Word16 lp_filt_exc_enc_fx( wtmp1 = 0; move16(); test(); - IF( ( EQ_16( *lp_flag, LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) + IF( ( ( *lp_flag == LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) { test(); IF( EQ_16( codec_mode, MODE2 ) && EQ_16( L_frame, L_FRAME16k ) ) @@ -100,6 +102,7 @@ Word16 lp_filt_exc_enc_fx( Ltmp = L_mac( Ltmp, 19005, exc[i + i_subfr] ); Ltmp = L_mac( Ltmp, 6881, exc[i + 1 + i_subfr] ); exc_tmp[i] = round_fx( Ltmp ); + move16(); } } ELSE @@ -110,20 +113,21 @@ Word16 lp_filt_exc_enc_fx( Ltmp = L_mac( Ltmp, 20972, exc[i + i_subfr] ); Ltmp = L_mac( Ltmp, 5898, exc[i + 1 + i_subfr] ); exc_tmp[i] = round_fx( Ltmp ); + move16(); } } - wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); + wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1 } if ( LT_16( exp_ener, exp_ener1 ) ) { - wtmp = shr( wtmp, 1 ); + wtmp = shr( wtmp, 1 ); // exp_ener + 1 } if ( GT_16( exp_ener, exp_ener1 ) ) { - wtmp1 = shr( wtmp1, 1 ); + wtmp1 = shr( wtmp1, 1 ); // exp_ener1 + 1 } /*-----------------------------------------------------------------* @@ -132,18 +136,18 @@ Word16 lp_filt_exc_enc_fx( test(); test(); - IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( EQ_16( *lp_flag, LOW_PASS ) ) ) + IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( ( *lp_flag == LOW_PASS ) ) ) { /* use the LP filter for pitch excitation prediction */ select = LOW_PASS; move16(); - Copy( exc_tmp, &exc[i_subfr], L_subfr ); - Copy( y1_tmp, y1, L_subfr ); - Copy( xn2_tmp, xn2, L_subfr ); + Copy( exc_tmp, &exc[i_subfr], L_subfr ); // Q_new + Copy( y1_tmp, y1, L_subfr ); // Q_new-1+shift + Copy( xn2_tmp, xn2, L_subfr ); // Q_new-1+shift IF( use_prev_sf_pit_gain == 0 ) { - *gain_pit = gain2; + *gain_pit = gain2; // Q14 move16(); g_corr[0] = g_corr2[0]; move16(); @@ -162,7 +166,7 @@ Word16 lp_filt_exc_enc_fx( move16(); IF( use_prev_sf_pit_gain == 0 ) { - *gain_pit = gain1; + *gain_pit = gain1; // Q14 move16(); } } @@ -193,7 +197,8 @@ Word16 lp_filt_exc_enc_ivas_fx( Word16 wtmp, wtmp1; Word32 Ltmp; - Word16 use_prev_sf_pit_gain = 0; + Word16 use_prev_sf_pit_gain = 0; // Q0 + move16(); gain1 = 0; move16(); @@ -206,7 +211,8 @@ Word16 lp_filt_exc_enc_ivas_fx( test(); IF( EQ_16( codec_mode, MODE2 ) && EQ_16( coder_type, 100 ) ) { - use_prev_sf_pit_gain = 1; + use_prev_sf_pit_gain = 1; // Q0 + move16(); } exp_ener = 0; move16(); @@ -215,13 +221,13 @@ Word16 lp_filt_exc_enc_ivas_fx( test(); IF( EQ_16( *lp_flag, FULL_BAND ) || EQ_16( *lp_flag, NORMAL_OPERATION ) ) { - IF( use_prev_sf_pit_gain == 1 ) + IF( EQ_16( use_prev_sf_pit_gain, 1 ) ) { - wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, gain_pit, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); + wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, gain_pit, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener } - else + ELSE { - wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); + wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener } } @@ -235,7 +241,7 @@ Word16 lp_filt_exc_enc_ivas_fx( wtmp1 = 0; move16(); test(); - IF( ( EQ_16( *lp_flag, LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) + IF( ( ( *lp_flag == LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) { test(); IF( EQ_16( codec_mode, MODE2 ) && EQ_16( L_frame, L_FRAME16k ) ) @@ -246,6 +252,7 @@ Word16 lp_filt_exc_enc_ivas_fx( Ltmp = L_mac( Ltmp, 19005, exc[i + i_subfr] ); Ltmp = L_mac( Ltmp, 6881, exc[i + 1 + i_subfr] ); exc_tmp[i] = round_fx( Ltmp ); + move16(); } } ELSE @@ -256,15 +263,16 @@ Word16 lp_filt_exc_enc_ivas_fx( Ltmp = L_mac( Ltmp, 20972, exc[i + i_subfr] ); Ltmp = L_mac( Ltmp, 5898, exc[i + 1 + i_subfr] ); exc_tmp[i] = round_fx( Ltmp ); + move16(); } } - IF( use_prev_sf_pit_gain == 1 ) + IF( EQ_16( use_prev_sf_pit_gain, 1 ) ) { - wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, gain_pit, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); + wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, gain_pit, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1 } ELSE { - wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); + wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1 } } @@ -284,18 +292,18 @@ Word16 lp_filt_exc_enc_ivas_fx( test(); test(); - IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( EQ_16( *lp_flag, LOW_PASS ) ) ) + IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( ( *lp_flag == LOW_PASS ) ) ) { /* use the LP filter for pitch excitation prediction */ select = LOW_PASS; move16(); - Copy( exc_tmp, &exc[i_subfr], L_subfr ); - Copy( y1_tmp, y1, L_subfr ); - Copy( xn2_tmp, xn2, L_subfr ); + Copy( exc_tmp, &exc[i_subfr], L_subfr ); // Q_new + Copy( y1_tmp, y1, L_subfr ); // Q_new-1+shift + Copy( xn2_tmp, xn2, L_subfr ); // Q_new-1+shift IF( use_prev_sf_pit_gain == 0 ) { - *gain_pit = gain2; + *gain_pit = gain2; // Q14 move16(); g_corr[0] = g_corr2[0]; move16(); @@ -314,7 +322,7 @@ Word16 lp_filt_exc_enc_ivas_fx( move16(); IF( use_prev_sf_pit_gain == 0 ) { - *gain_pit = gain1; + *gain_pit = gain1; // Q14 move16(); } } @@ -367,9 +375,9 @@ static Word16 adpt_enr_fx( /* o : adaptive excitation { FOR( i = 0; i < L_subfr; i++ ) { - exc_tmp[i] = mult( exc[i], 8192 ); + exc_tmp[i] = mult( exc[i], 8192 /*0.25.Q15*/ ); // Q_new move16(); - xn_tmp[i] = mult( xn[i], 8192 ); + xn_tmp[i] = mult( xn[i], 8192 /*0.25.Q15*/ ); // Q_new move16(); } Overflow = 0; @@ -383,14 +391,14 @@ static Word16 adpt_enr_fx( /* o : adaptive excitation test(); if ( EQ_16( clip_gain, 1 ) && GT_16( *gain, 15565 ) ) /* constant in Q14 */ { - *gain = 15565; + *gain = 15565; // 0.95.Q14 move16(); } test(); - if ( EQ_16( clip_gain, 2 ) && GT_16( *gain, 10650 ) ) + IF( EQ_16( clip_gain, 2 ) && GT_16( *gain, 10650 ) ) // 0.65.Q14 { - *gain = 10650; + *gain = 10650; // 0.65.Q14 move16(); } } @@ -403,14 +411,14 @@ static Word16 adpt_enr_fx( /* o : adaptive excitation /* could possibly happen in GSC */ Ltmp = Calc_Energy_Autoscaled( xn2, 0, L_subfr, exp_ener ); i = norm_l( Ltmp ); - ener = extract_h( L_shl( Ltmp, i ) ); + ener = extract_h( L_shl( Ltmp, i ) ); // exp_ener i = sub( 31, i ); *exp_ener = sub( i, *exp_ener ); move16(); } ELSE { - ener = extract_h( Dot_product12( xn2, xn2, L_SUBFR, exp_ener ) ); + ener = extract_h( Dot_product12( xn2, xn2, L_SUBFR, exp_ener ) ); // Q15 } return ener; @@ -424,9 +432,9 @@ static Word16 adpt_enr_fx( /* o : adaptive excitation *-------------------------------------------------------------------*/ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) */ - const Word16 xn_1[], /* i : target signal */ - const Word16 y1_1[], /* i : filtered adaptive codebook excitation */ - Word16 g_corr[], /* o : correlations and -2 */ + const Word16 xn_1[], /* i : target signal Q_new*/ + const Word16 y1_1[], /* i : filtered adaptive codebook excitation 12 bits*/ + Word16 g_corr[], /* o : correlations and -2 mant/exp*/ const Word16 L_subfr, /* i : vector length */ const Word16 norm_flag /* i : flag for constraining pitch contribution */ , @@ -446,7 +454,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) *----------------------------------------------------------------*/ /* Compute scalar product */ - Copy( xn_1, xn, L_subfr ); + Copy( xn_1, xn, L_subfr ); // Q_new Copy( y1_1, y1, L_subfr ); Overflow = 0; move16(); @@ -457,9 +465,9 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) { FOR( i = 0; i < L_subfr; i++ ) { - xn[i] = mult_r( xn_1[i], 4096 ); + xn[i] = mult_r( xn_1[i], 4096 /*0.125.Q15*/ ); // Q-new move16(); - y1[i] = mult_r( y1_1[i], 4096 ); + y1[i] = mult_r( y1_1[i], 4096 /*0.125.Q15*/ ); move16(); } @@ -484,7 +492,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) } ELSE { - yy = extract_h( Ltmp1 ); + yy = extract_h( Ltmp1 ); // exp_yy /* Ltmp1 = L_shr(Ltmp1, sub(30, exp_yy));*/ /* Compute scalar product */ @@ -499,7 +507,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) g_corr[1] = exp_yy; move16(); /* -2.0*temp1 + 0.01 is done in Gain_enc_2 function*/ - g_corr[2] = xy; + g_corr[2] = xy; // exp_xy move16(); g_corr[3] = exp_xy; move16(); @@ -510,8 +518,8 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) IF( xy >= 0 && NE_16( s_or( yy, xy ), 16384 ) ) { /* compute gain = xy/yy */ - xy = shr( xy, 1 ); /* be sure that xy < yy */ - gain = div_s( xy, yy ); + xy = shr( xy, 1 ); /* be sure that xy < yy */ + gain = div_s( xy, yy ); // Q15 i = sub( exp_xy, exp_yy ); gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ *Overflow_out |= Overflow; @@ -536,7 +544,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) /* gain_p_snr = sqrt(/) */ tmp = BASOP_Util_Divide1616_Scale( xx, yy, &exp_div ); exp_xx = add( sub( exp_xx, exp_yy ), exp_div ); - tmp = Sqrt16( tmp, &exp_xx ); + tmp = Sqrt16( tmp, &exp_xx ); // exp_xx /* Note: shl works as shl or shr. */ exp_xx = sub( exp_xx, 1 ); @@ -544,8 +552,8 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) gain_p_snr = round_fx_sat( L_shl_sat( Mpy_32_16_1( 1717986944l /*ACELP_GAINS_CONST Q31*/, tmp ), exp_xx ) ); BASOP_SATURATE_WARNING_ON_EVS - gain = s_min( gain, gain_p_snr ); + gain = s_min( gain, gain_p_snr ); // Q14 } - return gain; + return gain; // Q14 } diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 24179f375..6761dfb82 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -74,8 +74,10 @@ void lsf_enc_fx( const Word16 Q_new ) { Word16 nBits = 0; + move16(); Word16 int_fs; Word16 force_sf = 0; + move16(); Word16 fec_lsf[M], stab, i; Word32 L_tmp; Word16 coder_type, ppp_mode, nelp_mode; @@ -189,7 +191,7 @@ void lsf_enc_fx( lsf2lsp_fx( lsf_new, lsp_new, M, int_fs ); test(); - IF( EQ_16( st_fx->last_core, HQ_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) ) + IF( EQ_16( st_fx->last_core, HQ_CORE ) && ( st_fx->core == ACELP_CORE ) ) { /* don't use old LSF values if this is the first ACELP frame after HQ frames */ Copy( lsf_new, st_fx->lsf_old_fx, M ); @@ -216,7 +218,7 @@ void lsf_enc_fx( FEC_lsf_estim_enc_fx( st_fx, fec_lsf ); /* in case of FEC in decoder - calculate LSF stability */ - stab = lsf_stab_fx( lsf_new, fec_lsf, 0, st_fx->L_frame ); + stab = lsf_stab_fx( lsf_new, fec_lsf, 0, st_fx->L_frame ); // Q15 test(); test(); @@ -255,8 +257,8 @@ void lsf_enc_fx( if ( st_fx->rate_switching_reset ) { /*extrapolation in case of unstable LSF convert*/ - Copy( lsp_new, st_fx->lsp_old_fx, M ); - Copy( lsf_new, st_fx->lsf_old_fx, M ); + Copy( lsp_new, st_fx->lsp_old_fx, M ); // Q15 + Copy( lsf_new, st_fx->lsf_old_fx, M ); // Q15 } /* Mid-frame LSF encoding */ lsf_mid_enc_fx( st_fx->hBstr, st_fx->acelp_cfg.mid_lsf_bits, int_fs, st_fx->lsp_old_fx, lsp_new, lsp_mid, coder_type, st_fx->bwidth, st_fx->Bin_E_old_fx, st_fx->Bin_E_fx, Q_new + QSCALE - 2, ppp_mode, nelp_mode ); @@ -265,7 +267,7 @@ void lsf_enc_fx( IF( EQ_16( st_fx->last_core, HQ_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) ) { /* don't use old LSP/LSF values if this is the first ACELP frame after HQ frames */ - Copy( lsp_mid, st_fx->lsp_old_fx, M ); + Copy( lsp_mid, st_fx->lsp_old_fx, M ); // Q15 lsp2lsf_fx( lsp_mid, st_fx->lsf_old_fx, M, int_fs ); } @@ -299,10 +301,10 @@ void lsf_enc_fx( void lsf_enc_ivas_fx( Encoder_State *st, /* i/o: state structure */ - Word16 *lsf_new, /* o : quantized LSF vector */ - Word16 *lsp_new, /* i/o: LSP vector to quantize/quantized */ - Word16 *lsp_mid, /* i/o : mid-frame LSP vector */ - Word16 *Aq, /* o : quantized A(z) for 4 subframes */ + Word16 *lsf_new, /* o : quantized LSF vector Q(x2.56)*/ + Word16 *lsp_new, /* i/o: LSP vector to quantize/quantized Q15*/ + Word16 *lsp_mid, /* i/o : mid-frame LSP vector Q15*/ + Word16 *Aq, /* o : quantized A(z) for 4 subframes Q12*/ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ const Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ @@ -462,15 +464,15 @@ void lsf_enc_ivas_fx( IF( NE_16( st->last_L_frame, st->L_frame ) ) { /* FEC - in case of core switching, use old LSFs */ - Copy( st->lsf_old_fx, st->lsfoldbfi1_fx, M ); - Copy( st->lsf_old_fx, st->lsfoldbfi0_fx, M ); - Copy( st->lsf_old_fx, st->lsf_adaptive_mean_fx, M ); + Copy( st->lsf_old_fx, st->lsfoldbfi1_fx, M ); // Q15 + Copy( st->lsf_old_fx, st->lsfoldbfi0_fx, M ); // Q15 + Copy( st->lsf_old_fx, st->lsf_adaptive_mean_fx, M ); // Q15 } FEC_lsf_estim_enc_fx( st, fec_lsf ); /* in case of FEC in decoder - calculate LSF stability */ - stab = lsf_stab_ivas_fx( lsf_new, fec_lsf, 0, st->L_frame ); + stab = lsf_stab_ivas_fx( lsf_new, fec_lsf, 0, st->L_frame ); // Q15 test(); test(); @@ -509,8 +511,8 @@ void lsf_enc_ivas_fx( IF( st->rate_switching_reset ) { /*extrapolation in case of unstable LSF convert*/ - Copy( lsp_new, st->lsp_old_fx, M ); - Copy( lsf_new, st->lsf_old_fx, M ); + Copy( lsp_new, st->lsp_old_fx, M ); // Q15 + Copy( lsf_new, st->lsf_old_fx, M ); // Q15 } /* Mid-frame LSF encoding */ lsf_mid_enc_ivas_fx( st->hBstr, st->acelp_cfg.mid_lsf_bits, st->sr_core, st->lsp_old_fx, lsp_new, lsp_mid, coder_type, st->bwidth, st->Bin_E_old_fx, Q_new + QSCALE - 2, ppp_mode, nelp_mode ); @@ -529,9 +531,9 @@ void lsf_enc_ivas_fx( { IF( EQ_16( st->active_cnt, 1 ) ) { - Copy( lsp_mid, st->lsp_old_fx, M ); + Copy( lsp_mid, st->lsp_old_fx, M ); // Q15 lsp2lsf_fx( lsp_mid, st->lsf_old_fx, M, st->sr_core ); - Copy( lsp_new, lsp_mid, M ); + Copy( lsp_new, lsp_mid, M ); // Q15 } /* LSP interpolation and conversion of LSPs to A(z) - two-subframe mode */ @@ -546,7 +548,7 @@ void lsf_enc_ivas_fx( *------------------------------------------------------------------*/ IF( NE_32( st->core_brate, SID_2k40 ) ) { - st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new, st->lsf_old_fx, 0, st->L_frame ); + st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new, st->lsf_old_fx, 0, st->L_frame ); // Q15 } return; } @@ -847,8 +849,8 @@ static Word16 qlsf_Mode_Select_fx( /*========================================================================*/ void lsf_end_enc_fx( Encoder_State *st, /* i/o: encoder state structure */ - const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ - Word16 *qlsf, /* o : quantized LSF */ + const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) x2.56*/ + Word16 *qlsf, /* o : quantized LSF x2.56*/ const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ const Word16 coder_type_org, /* i : coding type */ Word16 Q_ener, /* i : Q valuen for Bin_Ener */ @@ -1008,7 +1010,7 @@ void lsf_end_enc_fx( IF( ( ( GT_16( st->pstreaklen, ( STREAKLEN + 3 ) ) ) && ( EQ_16( coder_type, VOICED ) ) ) || ( ( GT_16( st->pstreaklen, ( STREAKLEN ) ) ) && ( NE_16( coder_type, VOICED ) ) ) ) { /* update the adaptive scaling factor to become smaller with increasing number of concecutive predictive frames. */ - st->streaklimit_fx = mult( st->streaklimit_fx, STREAKMULT_FX ); + st->streaklimit_fx = mult( st->streaklimit_fx, STREAKMULT_FX ); // Q15 move16(); } @@ -1211,7 +1213,7 @@ void lsf_end_enc_fx( { lpc_param[i] = TCQIdx0[i]; move16(); - bits_param_lpc[i] = BC_TCVQ_BIT_ALLOC_40B[i]; + bits_param_lpc[i] = BC_TCVQ_BIT_ALLOC_40B[i]; // Q0 move16(); } } @@ -1352,8 +1354,8 @@ void lsf_end_enc_fx( void lsf_end_enc_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ - const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) */ - Word16 *qlsf, /* o : quantized LSF */ + const Word16 *lsf, /* i : LSF in the frequency domain (0..6400) x2.56*/ + Word16 *qlsf, /* o : quantized LSF x2.56*/ const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */ const Word16 coder_type_org, /* i : coding type */ Word16 Q_ener, /* i : Q valuen for Bin_Ener */ @@ -1944,10 +1946,10 @@ void lsf_end_enc_ivas_fx( static void first_VQstages( const Word16 *const *cb, - Word16 u[], /* i : vector to be encoded (prediction and mean removed) */ + Word16 u[], /* i : vector to be encoded (prediction and mean removed) x2.56*/ Word16 *levels, /* i : number of levels in each stage */ Word16 stagesVQ, /* i : number of stages */ - Word16 w[], /* i : weights */ + Word16 w[], /* i : weights Q8*/ Word16 N, /* i : vector dimension */ Word16 max_inner, /* i : maximum number of swaps in inner loop */ Word16 indices_VQstage[] ) @@ -2338,10 +2340,10 @@ static void first_VQstages_ivas_fx( static Word32 vq_lvq_lsf_enc( Word16 pred_flag, Word16 mode, - Word16 u[], + Word16 u[], // x2.56 Word16 *levels, Word16 stages, - Word16 w[], + Word16 w[], // Q8 Word16 Idx[], const Word16 *lsf, const Word16 *pred, @@ -2370,13 +2372,13 @@ static Word32 vq_lvq_lsf_enc( { cb = &Quantizers_fx[CB_lsf[mode]]; move16(); - mode_glb = add( offset_lvq_modes_SN_fx[mode], offset_in_lvq_mode_SN_fx[mode][sub( levels[stagesVQ], min_lat_bits_SN_fx[mode] )] ); + mode_glb = add( offset_lvq_modes_SN_fx[mode], offset_in_lvq_mode_SN_fx[mode][( levels[stagesVQ] - min_lat_bits_SN_fx[mode] )] ); // Q0 } ELSE /* predictive */ { cb = &Quantizers_p_fx[CB_p_lsf[mode]]; move16(); - mode_glb = add( offset_lvq_modes_pred_fx[mode], offset_in_lvq_mode_pred_fx[mode][sub( levels[stagesVQ], min_lat_bits_pred_fx[mode] )] ); + mode_glb = add( offset_lvq_modes_pred_fx[mode], offset_in_lvq_mode_pred_fx[mode][( levels[stagesVQ] - min_lat_bits_pred_fx[mode] )] ); // Q0 } IF( stagesVQ > 0 ) { @@ -2421,7 +2423,7 @@ static Word32 vq_lvq_lsf_enc( { L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ } - e[i] = L_tmp; + e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ move32(); } @@ -2447,10 +2449,10 @@ static Word32 vq_lvq_lsf_enc( static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 pred_flag, Word16 mode, - Word16 u[], + Word16 u[], // x2.56 Word16 *levels, Word16 stages, - Word16 w[], + Word16 w[], // Q8 Word16 Idx[], const Word16 *lsf, const Word16 *pred, @@ -2478,7 +2480,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( IF( LT_16( mode, 6 ) ) { move16(); - mode_glb = add( offset_lvq_modes_SN[mode], offset_in_lvq_mode_SN[mode][sub( levels[stagesVQ], min_lat_bits_SN[mode] )] ); + mode_glb = add( offset_lvq_modes_SN[mode], offset_in_lvq_mode_SN[mode][( levels[stagesVQ] - min_lat_bits_SN[mode] )] ); } ELSE { @@ -2492,7 +2494,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( IF( LT_16( mode, 6 ) || EQ_16( mode, 12 ) ) { move16(); - mode_glb = add( offset_lvq_modes_pred[mode], offset_in_lvq_mode_pred[mode][sub( levels[stagesVQ], min_lat_bits_pred_fx[mode] )] ); + mode_glb = add( offset_lvq_modes_pred[mode], offset_in_lvq_mode_pred[mode][( levels[stagesVQ] - min_lat_bits_pred_fx[mode] )] ); } ELSE { @@ -2572,7 +2574,7 @@ static void BcTcvq_1st_fx( Word16 c[][16], Word32 cDist_fx[][16], /*2.56*2.56*Q(-5 - 2)*/ Word16 Q_fx[][16][2], - Word16 W_fx[][2] /*Q10*/ + Word16 W_fx[][2] /*Q8*/ ) { Word16 state, prev_state; @@ -2633,7 +2635,7 @@ static void BcTcvq_2nd_fx( Word16 c[][16], Word32 cDist_fx[][16], /*2.56*2.56*Q(-5 - 2) */ Word16 Q_fx[][16][2], /*x2.56*/ - Word16 W_fx[][2], /*Q10*/ + Word16 W_fx[][2], /*Q8*/ const Word16 itc_fx[][2][2] /*Q15*/ ) { @@ -2921,12 +2923,12 @@ static Word32 BcTcvq_FixSearch_fx( Q_fx[stage][*prev_state][1] = add( CB_fx[stage4][bestCode][1], pred_fx[1] ); move16(); - minDist_fx = L_shr( minDist_fx, 2 ); + minDist_fx = L_shr( minDist_fx, 2 ); /*2.56*2.56*Q(-5 - 2)*/ return minDist_fx; } static Word16 optimalPath_fx( - Word32 cDist_fx[][16], - Word32 blockDist_fx[], + Word32 cDist_fx[][16], /*2.56*2.56*Q(-5 - 2)*/ + Word32 blockDist_fx[], /*2.56*2.56*Q(-5 - 2)*/ Word16 blockCodeword[][4], Word16 bestCodeword[], Word16 codeWord[][16], @@ -2985,10 +2987,11 @@ static Word16 optimalPath_fx( static void quantEnc_fx( Word16 *y_fx, Word16 c[], - const Word16 CB_SUB1_fx[][128][2], - const Word16 CB_SUB2_fx[][64][2], - const Word16 CB_SUB3_fx[][32][2], - const Word16 itc_fx[][2][2] ) + const Word16 CB_SUB1_fx[][128][2], /*x2.56*/ + const Word16 CB_SUB2_fx[][64][2], /*x2.56*/ + const Word16 CB_SUB3_fx[][32][2], /*x2.56*/ + const Word16 itc_fx[][2][2] // Q15 +) { Word16 i, j; Word16 stage; @@ -3103,9 +3106,9 @@ static void buildCode_fx( } static void BcTcvq_fx( Word16 snFlag, - const Word16 *x_fx, - Word16 *y_fx, - const Word16 *weight_fx, + const Word16 *x_fx, // x2.65 + Word16 *y_fx, // x2.65 + const Word16 *weight_fx, // Q8 Word16 *ind ) { Word16 X_fx[N_STAGE_VQ][N_DIM], W_fx[N_STAGE_VQ][N_DIM]; @@ -3162,9 +3165,9 @@ static void BcTcvq_fx( { FOR( j = 0; j < N_DIM; j++ ) { - X_fx[i][j] = x_fx[( N_DIM * i ) + j]; + X_fx[i][j] = x_fx[( N_DIM * i ) + j]; // x2.65 move16(); - W_fx[i][j] = weight_fx[( N_DIM * i ) + j]; + W_fx[i][j] = weight_fx[( N_DIM * i ) + j]; // x2.56 move16(); } } @@ -3259,10 +3262,10 @@ static void BcTcvq_fx( } static Word16 SVQ_2d_fx( - Word16 *x_fx, - Word16 *y_fx, - const Word16 *W_fx, - const Word16 CB_fx[][8], + Word16 *x_fx, // x2.65 + Word16 *y_fx, // x2.65 + const Word16 *W_fx, // Q8 + const Word16 CB_fx[][8], // x2.65 Word16 Size ) { Word16 i, j; @@ -3280,7 +3283,7 @@ static Word16 SVQ_2d_fx( { temp16_fx = sub( x_fx[j], CB_fx[i][j] ); distortion_fx = L_add( distortion_fx, - L_shr( Mult_32_16( L_mult( temp16_fx, temp16_fx ), W_fx[j] ), 1 ) ); + L_shr( Mult_32_16( L_mult( temp16_fx, temp16_fx ), W_fx[j] ), 1 ) ); // (2*x2.65 + Q1 + Q8) - Q15 - Q1 } IF( LT_32( distortion_fx, temp_fx ) ) @@ -3403,9 +3406,9 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( } static void FFT_Mid_Interpol_16k_fx( - Word32 Bin_Ener_old[], /* i/o: Old 2nd FFT Bin energy (128) */ - Word32 Bin_Ener[], /* i : Current 2nd FFT Bin energy (128) */ - Word32 Bin_Ener_mid[] /* o : LP weighting filter (numerator) */ + Word32 Bin_Ener_old[], /* i/o: Old 2nd FFT Bin energy (128) Q_ener*/ + Word32 Bin_Ener[], /* i : Current 2nd FFT Bin energy (128) Q_ener*/ + Word32 Bin_Ener_mid[] /* o : LP weighting filter (numerator) Q_ener*/ ) { Word16 i; @@ -3642,12 +3645,12 @@ static void lsf_mid_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 nb_bits, /* i : number of bits */ const Word32 int_fs, /* i : internal (ACELP) sampling frequency*/ - const Word16 qlsp0[], /* i : quantized LSPs from frame beginning*/ - const Word16 qlsp1[], /* i : quantized LSPs from frame end */ - Word16 lsp[], /* i/o: mid-frame LSP */ + const Word16 qlsp0[], /* i : quantized LSPs from frame beginning Q15*/ + const Word16 qlsp1[], /* i : quantized LSPs from frame end Q15*/ + Word16 lsp[], /* i/o: mid-frame LSP Q15*/ const Word16 coder_type, /* i : coding type */ const Word16 bwidth, /* i : input signal bandwidth */ - Word32 Bin_Ener[], /* i : per bin log energy spectrum */ + Word32 Bin_Ener[], /* i : per bin log energy spectrum Q_ener*/ Word16 Q_ener, /* i : Q value of Bin_ener */ Word16 ppp_mode, Word16 nelp_mode ) @@ -3681,19 +3684,19 @@ static void lsf_mid_enc_ivas_fx( { case 5: { - ratio = tbl_mid_voi_wb_5b_fx; + ratio = tbl_mid_voi_wb_5b_fx; // Q13 move16(); BREAK; } case 4: { - ratio = tbl_mid_voi_wb_4b_fx; + ratio = tbl_mid_voi_wb_4b_fx; // Q13 move16(); BREAK; } case 1: { - ratio = tbl_mid_voi_wb_1b_fx; + ratio = tbl_mid_voi_wb_1b_fx; // Q13 move16(); BREAK; } @@ -3701,7 +3704,7 @@ static void lsf_mid_enc_ivas_fx( } ELSE IF( EQ_16( coder_type, UNVOICED ) ) { - ratio = tbl_mid_unv_wb_5b_fx; + ratio = tbl_mid_unv_wb_5b_fx; // Q13 } ELSE { @@ -3710,19 +3713,19 @@ static void lsf_mid_enc_ivas_fx( { case 5: { - ratio = tbl_mid_gen_wb_5b_fx; + ratio = tbl_mid_gen_wb_5b_fx; // Q13 move16(); BREAK; } case 4: { - ratio = tbl_mid_gen_wb_4b_fx; + ratio = tbl_mid_gen_wb_4b_fx; // Q13 move16(); BREAK; } case 2: { - ratio = tbl_mid_gen_wb_2b_fx; + ratio = tbl_mid_gen_wb_2b_fx; // Q13 move16(); BREAK; } @@ -3734,7 +3737,7 @@ static void lsf_mid_enc_ivas_fx( } ELSE IF( EQ_16( ppp_mode, 1 ) ) { - ratio = tbl_mid_voi_wb_1b_fx; + ratio = tbl_mid_voi_wb_1b_fx; // Q13 move16(); nb_bits = 1; move16(); @@ -3743,7 +3746,7 @@ static void lsf_mid_enc_ivas_fx( } ELSE IF( EQ_16( nelp_mode, 1 ) ) { - ratio = tbl_mid_unv_wb_4b_fx; + ratio = tbl_mid_unv_wb_4b_fx; // Q13 move16(); nb_bits = 4; move16(); @@ -3765,7 +3768,7 @@ static void lsf_mid_enc_ivas_fx( FOR( j = 0; j < M; j++ ) { /* qlsf[j] = (1.0f - ratio[k*M+j]) * qlsf0[j] + ratio[k*M+j] * qlsf1[j]; */ - L_tmp = L_mult( sub( 0x2000, ratio[k1 + j] ), qlsf0[j] ); + L_tmp = L_mult( sub( 0x2000 /*1.Q13*/, ratio[k1 + j] ), qlsf0[j] ); L_tmp = L_mac( L_tmp, ratio[k1 + j], qlsf1[j] ); qlsf[j] = round_fx( L_shl( L_tmp, 2 ) ); @@ -3802,7 +3805,7 @@ static void lsf_mid_enc_ivas_fx( FOR( j = 0; j < M; j++ ) { /* qlsf[j] = (1.0f - ratio[idx*M+j]) * qlsf0[j] + ratio[idx*M+j] * qlsf1[j]; */ - L_tmp = L_mult( sub( 0x2000, ratio[idx * M + j] ), qlsf0[j] ); + L_tmp = L_mult( sub( 0x2000 /*1.Q13*/, ratio[idx * M + j] ), qlsf0[j] ); L_tmp = L_mac( L_tmp, ratio[idx * M + j], qlsf1[j] ); qlsf[j] = round_fx( L_shl( L_tmp, 2 ) ); diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 28e1a39de..60375ddcc 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -37,7 +37,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "rom_enc.h" @@ -93,7 +92,7 @@ Word16 msvq_stage1_dct_search_fx( Word32 *dist1_ptr_fx, /* o : resulting stage 1 MSEs in DCT-N domain */ Word16 *dist1_ptr_e ) { - Word32 dct_target_fx[FDCNG_VQ_DCT_MAXTRUNC]; + Word32 dct_target_fx[FDCNG_VQ_DCT_MAXTRUNC]; // Q20 Word32 u_mr_fx[FDCNG_VQ_MAX_LEN]; Word16 dist1_ptr_e_buf[2 * LSFMBEST_MAX]; Word64 mse_trunc_segm_fx[FDCNG_VQ_DCT_NSEGM]; @@ -127,7 +126,7 @@ Word16 msvq_stage1_dct_search_fx( tmp_e = s_max( 12, u_e ); FOR( i = 0; i < n_ana; i++ ) { - u_mr_fx[i] = L_sub( L_shl( u_fx[i], sub( u_e, tmp_e ) ), L_shl( midQ_truncQ_fx[i], sub( Q31 - Q10, tmp_e ) ) ); + u_mr_fx[i] = L_sub( L_shl( u_fx[i], sub( u_e, tmp_e ) ), L_shl( midQ_truncQ_fx[i], sub( Q31 - Q10, tmp_e ) ) ); // tmp_e move32(); } @@ -136,9 +135,9 @@ Word16 msvq_stage1_dct_search_fx( /* init search state ptr's at the top */ set32_fx( dist1_ptr_fx, MAX_32, maxC_st1 ); set16_fx( dist1_ptr_e_buf, 32, maxC_st1 ); - st1_mse_pair_fx = &( dist1_ptr_fx[0] ); /* req. ptr post upd +=2 */ - st1_mse_pair_e = &( dist1_ptr_e_buf[0] ); /* req. ptr post upd +=2 */ - st1_idx_pair = &( indices_st1_local[0] ); /* req. ptr post upd +=2 */ + st1_mse_pair_fx = &( dist1_ptr_fx[0] ); /* req. ptr post upd +=2 */ // st1_mse_pair_e + st1_mse_pair_e = &( dist1_ptr_e_buf[0] ); /* req. ptr post upd +=2 */ + st1_idx_pair = &( indices_st1_local[0] ); /* req. ptr post upd +=2 */ set64_fx( mse_trunc_segm_fx, 0, n_segm ); // set16_fx( mse_trunc_segm_e, u_e, FDCNG_VQ_DCT_NSEGM ); @@ -152,7 +151,7 @@ Word16 msvq_stage1_dct_search_fx( FOR( i = 0; i < trunc_dct_cols_per_segment[segm]; i++ ) { - mse_trunc_segm_fx[segm] = W_mac_32_32( mse_trunc_segm_fx[segm], dct_target_fx[cols_per_segment[segm] + i], dct_target_fx[cols_per_segment[segm] + i] ); + mse_trunc_segm_fx[segm] = W_mac_32_32( mse_trunc_segm_fx[segm], dct_target_fx[cols_per_segment[segm] + i], dct_target_fx[cols_per_segment[segm] + i] ); // Q41 move64(); } @@ -163,7 +162,7 @@ Word16 msvq_stage1_dct_search_fx( /* unweighted segmented search DCT domain loop */ j_full = add( j, cum_entries_per_segment[segm] ); /* or simply use j_full++ */ - mse_fx = mse_trunc_segm_fx[segm]; /* init mse with with common mse truncation part, in BASOP a move32() */ + mse_fx = mse_trunc_segm_fx[segm]; /* init mse with with common mse truncation part, in BASOP a move32() */ // Q41 move64(); dct_col_shift_tab = col_syn_shift[segm]; /* ptr init */ @@ -176,10 +175,10 @@ Word16 msvq_stage1_dct_search_fx( SHIFT( 1 ); ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ #undef WMC_TOOL_SKIP - mse_fx = W_mac_32_32( mse_fx, tmp_fx, tmp_fx ); /* L_mac or L_mac0() square Word16 -> Word32*/ + mse_fx = W_mac_32_32( mse_fx, tmp_fx, tmp_fx ); /* L_mac or L_mac0() square Word16 -> Word32*/ // Q41 } Word16 L_tmp = W_norm( mse_fx ); - st1_mse_ptr_fx[j_full] = W_extract_h( W_lshl( mse_fx, L_tmp ) ); /* save MSE in shared dynamic RAM, move32() in BASOP */ + st1_mse_ptr_fx[j_full] = W_extract_h( W_lshl( mse_fx, L_tmp ) ); /* save MSE in shared dynamic RAM, move32() in BASOP */ // st1_mse_ptr_e move32(); st1_mse_ptr_e[j_full] = sub( shl( tmp_e, 1 ), L_tmp ); move16(); @@ -362,9 +361,9 @@ Word16 msvq_stage1_dct_search_fx( /*! r: (updated p_max) */ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( - const Word32 *st1_syn_vec_ptr_fx, /* i : IDCT24 synthesis vectors */ + const Word32 *st1_syn_vec_ptr_fx, /* i : IDCT24 synthesis vectors st1_syn_vec_e*/ const Word16 st1_syn_vec_e, /* i : exp for IDCT24 synthesis vectors */ - const Word32 *u_fx, /* i : target signal */ + const Word32 *u_fx, /* i : target signal u_e*/ const Word16 u_e, /* i : exp for target signal */ const Word16 maxC_st1, /* i : number of candidates in stage1 */ Word32 *dist_ptr_fx, /* i/o: updated MSE vector for stage1 */ @@ -390,7 +389,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( /* for stage#1 use "u" instead of the shortened resid[0], to access the extended/extrapolated input target */ FOR( i = 0; i < FDCNG_VQ_MAX_LEN - FDCNG_VQ_MAX_LEN_WB; i++ ) { - high_diff_fx[i] = L_sub( L_shr( p2_fx[i], sub( tmp_e, st1_syn_vec_e ) ), L_shr( u_fx[FDCNG_VQ_MAX_LEN_WB + i], sub( tmp_e, u_e ) ) ); + high_diff_fx[i] = L_sub( L_shr( p2_fx[i], sub( tmp_e, st1_syn_vec_e ) ), L_shr( u_fx[FDCNG_VQ_MAX_LEN_WB + i], sub( tmp_e, u_e ) ) ); // tmp_e move32(); } acc = 0; @@ -457,7 +456,7 @@ void msvq_enc_ivas_fx( Word16 j; const Word16 *cbp, *cb_stage; Word32 resid_buf_fx[2 * LSFMBEST_MAX * M_MAX], *resid_fx[2]; - Word32 *pTmp, *p1, *p2; + Word32 *pTmp, *p1, *p2; // pTmp_e Word16 pTmp_e; Word16 *indices[2], m, s, c, c2, p_max, i; Word16 idx_buf[2 * LSFMBEST_MAX * MAX_VQ_STAGES_USED], parents[LSFMBEST_MAX]; diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index b81cc18e8..aa2255c68 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -36,10 +36,10 @@ val2 = shr( ( cbp )[2], 4 ); \ val3 = add( add( shr( lshl( ( cbp )[2], 12 ), 4 ), lshr( lshl( ( cbp )[1], 12 ), 8 ) ), s_and( ( cbp )[0], 0xF ) ); /*--------------------------------------------------------------------------* - * depack_mul_values() + * depack_mul_values_fx() * *--------------------------------------------------------------------------*/ -static Word32 depack_mul_values( Word16 *Tmp, const Word16 *w, const Word16 *cbp, const Word16 N ) +static Word32 depack_mul_values_fx( Word16 *Tmp, const Word16 *w, const Word16 *cbp, const Word16 N ) { Word16 i, val0, val1, val2, val3; Word32 en; @@ -69,7 +69,7 @@ static Word32 depack_mul_values( Word16 *Tmp, const Word16 *w, const Word16 *cbp * depack_sub_values() * *--------------------------------------------------------------------------*/ -static void depack_sub_values( Word16 *pTmp, const Word16 *p1, const Word16 *cbp, const Word16 N ) +static void depack_sub_values_fx( Word16 *pTmp, const Word16 *p1, const Word16 *cbp, const Word16 N ) { Word16 j, val0, val1, val2, val3; @@ -93,7 +93,7 @@ static void depack_sub_values( Word16 *pTmp, const Word16 *p1, const Word16 *cbp * * Unroll of inner search loop for maxC == 8 *--------------------------------------------------------------------------*/ -static Word16 msvq_enc_find_p_max_8( Word32 dist[] ) +static Word16 msvq_enc_find_p_max_8_fx( Word32 dist[] ) { Word16 p_max; @@ -144,7 +144,7 @@ static Word16 msvq_enc_find_p_max_8( Word32 dist[] ) * * Unroll of inner search loop for maxC == 6 *--------------------------------------------------------------------------*/ -static Word16 msvq_enc_find_p_max_6( Word32 dist[] ) +static Word16 msvq_enc_find_p_max_6_fx( Word32 dist[] ) { Word16 p_max; @@ -194,7 +194,7 @@ void msvq_enc_fx( const Word16 maxC, /* i : Tree search size (number of candidates kept from */ /* one stage to the next == M-best) */ const Word16 stages, /* i : Number of stages */ - const Word16 w[], /* i : Weights */ + const Word16 w[], /* i : Weights Q8*/ const Word16 N, /* i : Vector dimension */ const Word16 maxN, /* i : Codebook dimension */ Word16 Idx[] /* o : Indices */ @@ -231,11 +231,11 @@ void msvq_enc_fx( set16_fx( parents, 0, maxC ); - func_ptr = msvq_enc_find_p_max_6; + func_ptr = msvq_enc_find_p_max_6_fx; move16(); if ( EQ_16( maxC, 8 ) ) { - func_ptr = msvq_enc_find_p_max_8; + func_ptr = msvq_enc_find_p_max_8_fx; move16(); } @@ -326,7 +326,7 @@ void msvq_enc_fx( FOR( j = 0; j < levels[s]; j++ ) { /* Compute weighted codebook element and its energy */ - en = depack_mul_values( Tmp + start, w + start, cbp, n ); + en = depack_mul_values_fx( Tmp + start, w + start, cbp, n ); cbp += N34; /* pointer is incremented */ @@ -378,7 +378,7 @@ void msvq_enc_fx( move16(); Copy( p1, pTmp, start ); - depack_sub_values( pTmp + start, p1 + start, &cb[s][p2i * N34], n ); + depack_sub_values_fx( pTmp + start, p1 + start, &cb[s][p2i * N34], n ); Copy( p1 + start + n, pTmp + start + n, sub( N, add( start, n ) ) ); pTmp += N; @@ -407,12 +407,12 @@ void msvq_enc_fx( *--------------------------------------------------------------------------*/ void midlsf_enc_fx( - const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */ - const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */ - const Word16 lsf[], /* i: lsf coefficients (3Q12) */ - Word16 *idx, /* o: codebook index */ - const Word16 lpcorder, /* i: order of the lpc */ - const Word32 *Bin_Ener_128_fx, + const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */ + const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */ + const Word16 lsf[], /* i: lsf coefficients (3Q12) */ + Word16 *idx, /* o: codebook index */ + const Word16 lpcorder, /* i: order of the lpc */ + const Word32 *Bin_Ener_128_fx, // Q_ener const Word16 Q_ener, const Word8 narrowBand, const Word32 sr_core, @@ -502,8 +502,8 @@ void midlsf_enc_fx( * Returns: number of indices *--------------------------------------------------------------------------*/ Word16 Q_lsf_tcxlpc_fx( - /* const */ Word16 lsf[], /* i : original lsf */ - Word16 lsf_q[], /* o : quantized lsf */ + /* const */ Word16 lsf[], /* i : original lsf 14Q1 * 1.28 */ + Word16 lsf_q[], /* o : quantized lsf (14Q1*1.28)*/ Word16 lsp_q_ind[], /* o : quantized lsp (w/o MA prediction) */ Word16 indices[], /* o : VQ indices */ const Word16 lpcorder, /* i : LPC order */ @@ -511,7 +511,7 @@ Word16 Q_lsf_tcxlpc_fx( const Word16 cdk, /* i : codebook selector */ const Word16 mem_MA[], /* i : MA memory */ const Word16 coder_type, - const Word32 *Bin_Ener, + const Word32 *Bin_Ener, // Q_ener const Word16 Q_ener ) { Word16 weights[M + 1]; @@ -578,7 +578,7 @@ Word16 Q_lsf_tcxlpc_fx( FOR( i = 0; i < lpcorder; ++i ) { - lsf_q_ind[i] = lsf_q[i]; + lsf_q_ind[i] = lsf_q[i]; /*(14Q1*1.28)*/ move16(); } @@ -891,7 +891,7 @@ Word16 enc_lsf_tcxlpc_ivas_fx( Word16 lsf_msvq_ma_encprm_fx( BSTR_ENC_HANDLE hBstr, - Word16 *param_lpc, + Word16 *param_lpc, // Q0 Word16 core, Word16 acelp_mode, Word16 acelp_midLpc, @@ -916,7 +916,7 @@ Word16 lsf_msvq_ma_encprm_fx( IF( NE_16( acelp_mode, VOICED ) ) { test(); - IF( EQ_16( core, ACELP_CORE ) && acelp_midLpc ) + IF( ( core == ACELP_CORE ) && acelp_midLpc ) { push_next_indice_fx( hBstr, *param_lpc, bits_midlpc ); @@ -928,7 +928,7 @@ Word16 lsf_msvq_ma_encprm_fx( } Word16 lsf_msvq_ma_encprm_ivas_fx( BSTR_ENC_HANDLE hBstr, - const Word16 *param_lpc, + const Word16 *param_lpc, // Q0 const Word16 core, const Word16 acelp_mode, const Word16 acelp_midLpc, @@ -953,7 +953,7 @@ Word16 lsf_msvq_ma_encprm_ivas_fx( IF( NE_16( acelp_mode, VOICED ) ) { test(); - IF( EQ_16( core, ACELP_CORE ) && acelp_midLpc ) + IF( ( core == ACELP_CORE ) && acelp_midLpc ) { push_next_indice( hBstr, *param_lpc, bits_midlpc ); @@ -971,7 +971,7 @@ Word16 lsf_msvq_ma_encprm_ivas_fx( *--------------------------------------------------------------------------*/ Word16 lsf_bctcvq_encprm_fx( BSTR_ENC_HANDLE hBstr, - Word16 *param_lpc, + Word16 *param_lpc, // Q0 Word16 *bits_param_lpc, Word16 no_indices ) { @@ -990,7 +990,7 @@ Word16 lsf_bctcvq_encprm_fx( } Word16 lsf_bctcvq_encprm_ivas_fx( BSTR_ENC_HANDLE hBstr, - const Word16 *param_lpc, + const Word16 *param_lpc, // Q0 const Word16 *bits_param_lpc, const Word16 no_indices ) { diff --git a/lib_enc/ltd_stable_fx.c b/lib_enc/ltd_stable_fx.c index a6e3ae1cc..036fe2a7e 100644 --- a/lib_enc/ltd_stable_fx.c +++ b/lib_enc/ltd_stable_fx.c @@ -21,7 +21,7 @@ void ltd_stable_fx( VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ Word16 *ltd_stable_rate, /* o : time-domain stable rate*/ - const Word32 frame_energy, /* i : current frame energy*/ + const Word32 frame_energy, /* i : current frame energy Q_frames_power*/ const Word16 frameloop, /* i : amount of frames*/ const Word16 Q_frames_power /* i : the Scaling of frames_power*/ ) @@ -57,7 +57,7 @@ void ltd_stable_fx( move16(); Q_apow = 0; move16(); - frames_power_32 = hVAD_CLDFB->frames_power_32; + frames_power_32 = hVAD_CLDFB->frames_power_32; // Q_frames_power_last_32 Q_frames_power_last_32 = hVAD_CLDFB->Q_frames_power_32; move16(); leadingzero_midamp = 31; @@ -76,7 +76,7 @@ void ltd_stable_fx( IF( GE_16( Q_frames_power32, 40 ) ) { zerop001 = L_shr( CNT0P001, 1 ); - frame_energy_Sqr32 = L_shr( frame_energy_Sqr32, sub( Q_frames_power32, 39 ) ); + frame_energy_Sqr32 = L_shr( frame_energy_Sqr32, sub( Q_frames_power32, 39 ) ); // Q_frames_power32 Q_frames_power32 = 39; move16(); } @@ -86,14 +86,14 @@ void ltd_stable_fx( frame_energy_Sqr32 = L_shr( frame_energy_Sqr32, 1 ); zerop001 = L_shr( CNT0P001, sub( 40, Q_frames_power32 ) ); } - frames_power_32[0] = L_add( frame_energy_Sqr32, zerop001 ); + frames_power_32[0] = L_add( frame_energy_Sqr32, zerop001 ); // Q_frames_power32 move32(); IF( LT_16( frameloop, 3 ) ) { FOR( i = 1; i < 40; i++ ) { - frames_power_32[i] = frames_power_32[0]; + frames_power_32[i] = frames_power_32[0]; // Q_frames_power32 move32(); } } @@ -104,7 +104,7 @@ void ltd_stable_fx( move32(); FOR( i = 1; i < 40; i++ ) { - maxVal = L_max( maxVal, frames_power_32[i] ); + maxVal = L_max( maxVal, frames_power_32[i] ); // Q_frames_power32 } leadingzero = 31; move16(); @@ -119,7 +119,7 @@ void ltd_stable_fx( scale1 = sub( scale1, leadingzero ); FOR( i = 1; i < 40; i++ ) { - frames_power_32[i] = L_shr( frames_power_32[i], scale1 ); + frames_power_32[i] = L_shr( frames_power_32[i], scale1 ); // Q_frames_power32 move32(); } } @@ -140,7 +140,7 @@ void ltd_stable_fx( FOR( i = 0; i < 20; i++ ) { - mid_frame_ampadd32[i] = L_add( L_shr( frames_power_32[2 * i], 1 ), L_shr( frames_power_32[2 * i + 1], 1 ) ); + mid_frame_ampadd32[i] = L_add( L_shr( frames_power_32[2 * i], 1 ), L_shr( frames_power_32[2 * i + 1], 1 ) ); // Q_frames_power32 move32(); } @@ -148,16 +148,18 @@ void ltd_stable_fx( move32(); FOR( i = 0; i < 20; i++ ) { - maxVal = L_max( maxVal, mid_frame_ampadd32[i] ); + maxVal = L_max( maxVal, mid_frame_ampadd32[i] ); // Q_frames_power32 } leadingzero_midamp = 31; move16(); if ( maxVal ) + { leadingzero_midamp = norm_l( maxVal ); + } FOR( i = 0; i < 20; i++ ) { - mid_frame_amp32[i] = L_shl( mid_frame_ampadd32[i], leadingzero_midamp ); + mid_frame_amp32[i] = L_shl( mid_frame_ampadd32[i], leadingzero_midamp ); // Q_frames_power32 + leadingzero_midamp move32(); } @@ -165,19 +167,19 @@ void ltd_stable_fx( move32(); FOR( i = 0; i < 20; i++ ) { - seg_amp32 = L_add( seg_amp32, L_shr( mid_frame_amp32[i], 5 ) ); + seg_amp32 = L_add( seg_amp32, L_shr( mid_frame_amp32[i], 5 ) ); // Q_frames_power32 + leadingzero_midamp - 5 } - seg_amp32 = MUL_F( seg_amp32, 0x0666 ); + seg_amp32 = MUL_F( seg_amp32, 0x0666 /*(1/20).Q15*/ ); dif32 = 0; move32(); apow32 = 0; move32(); - seg_amp32tmp = L_shl( seg_amp32, 5 ); + seg_amp32tmp = L_shl( seg_amp32, 5 ); // Q_frames_power32 + leadingzero_midamp FOR( i = 0; i < 20; i++ ) { - tmp32[i] = L_sub( mid_frame_amp32[i], seg_amp32tmp ); + tmp32[i] = L_sub( mid_frame_amp32[i], seg_amp32tmp ); // Q_frames_power32 + leadingzero_midamp move32(); } @@ -185,22 +187,24 @@ void ltd_stable_fx( move32(); FOR( i = 0; i < 20; i++ ) { - maxVal = L_max( maxVal, L_abs( tmp32[i] ) ); + maxVal = L_max( maxVal, L_abs( tmp32[i] ) ); // Q_frames_power32 + leadingzero_midamp - 5 } leadingzero_tmp32 = 31; move16(); if ( maxVal ) + { leadingzero_tmp32 = norm_l( maxVal ); + } FOR( i = 0; i < 20; i++ ) { - tmp16[i] = extract_h( L_shl( tmp32[i], leadingzero_tmp32 ) ); + tmp16[i] = extract_h( L_shl( tmp32[i], leadingzero_tmp32 ) ); //// Q_frames_power32 + leadingzero_midamp + leadingzero_tmp32 - 16 } FOR( i = 0; i < 20; i++ ) { - tmp_mul = L_mult_sat( tmp16[i], tmp16[i] ); - tmp_mul = L_shr( tmp_mul, 5 ); + tmp_mul = L_mult_sat( tmp16[i], tmp16[i] ); // 2 * (Q_frames_power32 + leadingzero_midamp + leadingzero_tmp32 - 16) + 1 + tmp_mul = L_shr( tmp_mul, 5 ); // 2 * (Q_frames_power32 + leadingzero_midamp + leadingzero_tmp32 - 16) - 4 dif32 = L_add( dif32, tmp_mul ); tmp = extract_h( mid_frame_amp32[i] ); @@ -244,7 +248,9 @@ void ltd_stable_fx( leadingzero_midamp = 31; move16(); if ( maxVal ) + { leadingzero_midamp = norm_l( maxVal ); + } FOR( i = 0; i < 14; i++ ) { @@ -256,15 +262,15 @@ void ltd_stable_fx( move32(); FOR( i = 0; i < 14; i++ ) { - seg_amp32 = L_add( seg_amp32, L_shr( mid_frame_amp32[i], 4 ) ); + seg_amp32 = L_add( seg_amp32, L_shr( mid_frame_amp32[i], 4 ) ); // Q_frames_power32 - 4 } - seg_amp32 = MUL_F( seg_amp32, 0x0924 ); + seg_amp32 = MUL_F( seg_amp32, 0x0924 /*(1/14).Q15*/ ); dif32 = 0; move32(); apow32 = 0; move32(); - seg_amp32tmp = L_shl( seg_amp32, 4 ); + seg_amp32tmp = L_shl( seg_amp32, 4 ); // Q_frames_power32 FOR( i = 0; i < 14; i++ ) { tmp32[i] = L_sub( mid_frame_amp32[i], seg_amp32tmp ); @@ -280,7 +286,9 @@ void ltd_stable_fx( leadingzero_tmp32 = 31; move16(); if ( maxVal ) + { leadingzero_tmp32 = norm_l( maxVal ); + } FOR( i = 0; i < 14; i++ ) { @@ -367,8 +375,10 @@ void ltd_stable_fx( } leadingzero_midamp = 31; move16(); - if ( maxVal ) + IF( maxVal ) + { leadingzero_midamp = norm_l( maxVal ); + } FOR( i = 0; i < 8; i++ ) { @@ -382,7 +392,7 @@ void ltd_stable_fx( { seg_amp32 = L_add( seg_amp32, L_shr( mid_frame_amp32[i], 3 ) ); } - seg_amp32 = MUL_F( seg_amp32, 0x1000 ); + seg_amp32 = MUL_F( seg_amp32, 0x1000 /*(1/8).Q15*/ ); dif32 = 0; move32(); @@ -403,9 +413,10 @@ void ltd_stable_fx( } leadingzero_tmp32 = 31; move16(); - if ( maxVal ) + IF( maxVal ) + { leadingzero_tmp32 = norm_l( maxVal ); - + } FOR( i = 0; i < 8; i++ ) { tmp32[i] = L_shl( tmp32[i], leadingzero_tmp32 ); @@ -482,7 +493,7 @@ void ltd_stable_fx( ltd_stable_rate[2] = shr( ltd_stable_rate[2], ltd_stable_rate_Qtmp ); move16(); - ltd_stable_rate[3] = add( mult( ltd_stable_rate[3], 0x7333 ), mult( ltd_stable_rate[2], 0x0ccc ) ); + ltd_stable_rate[3] = add( mult( ltd_stable_rate[3], 0x7333 /*0.9.Q15*/ ), mult( ltd_stable_rate[2], 0x0ccc /*0.1.Q15*/ ) ); move16(); FOR( i = 55; i > 0; i-- ) diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c index eec85c254..a4e19e040 100644 --- a/lib_enc/mdct_classifier_fx.c +++ b/lib_enc/mdct_classifier_fx.c @@ -46,7 +46,7 @@ * Square magnitude of fft spectrum *----------------------------------------------------------------------------*/ static void dft_mag_square_fx( - const Word16 x[], /* i : Input vector: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */ + const Word16 x[], /* i : Input vector: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] Qx*/ Word32 magSq[], /* o : Magnitude square spectrum */ const Word16 n /* i : Input vector length */ ) @@ -57,7 +57,7 @@ static void dft_mag_square_fx( /* Magnitude square at 0. */ pMagSq = &magSq[0]; - pRe = &x[0]; + pRe = &x[0]; // Qx *pMagSq++ = L_mult0( *pRe, *pRe ); pRe++; move32(); @@ -70,13 +70,13 @@ static void dft_mag_square_fx( { acc = L_mult0( *pRe, *pRe ); pRe++; - *pMagSq++ = L_mac0( acc, *pIm, *pIm ); + *pMagSq++ = L_mac0( acc, *pIm, *pIm ); // 2*Qx pIm--; move32(); } /* The magnitude square at N/2 */ - *pMagSq = L_mult0( *pRe, *pRe ); + *pMagSq = L_mult0( *pRe, *pRe ); // 2*Qx move32(); return; } @@ -89,7 +89,7 @@ static void dft_mag_square_fx( Word16 mdct_classifier_fx( /* o: MDCT A/B decision */ const Word16 *fft_buff, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */ Encoder_State *st_fx, /* i/o: Encoder state variable */ - Word32 *cldfbBuf_Ener, + Word32 *cldfbBuf_Ener, // enerBuffer_exp Word16 enerBuffer_exp, const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ ) @@ -260,7 +260,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision { IF( max_i > 0 ) { - IF( GT_16( np, 0 ) ) + IF( ( np > 0 ) ) { d_acc = sub( add( d_acc, max_i ), pos_last ); } @@ -277,7 +277,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision IF( pe != 0 ) { expo = norm_l( pe ); - man = L_shl( pe, expo ); + man = L_shl( pe, expo ); // expo Mpy_32_32_ss( man, man, &man, &lsb32 ); /* pe square */ expo = shl( expo, 1 ); /* Multiply by 2 due to squaring. */ floating_point_add( &p_energy_man, &p_energy_exp, man, expo ); @@ -309,35 +309,35 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision /* gain11 = 8*(gain1 - cldfbBuf_Ener[0]/8)/7; */ acc = L_shr( cldfbBuf_Ener[0], 3 ); acc = L_sub( gain1, acc ); - acc = Mult_32_16( acc, 4681 ); + acc = Mult_32_16( acc, 4681 /*(1/7).Q15*/ ); gain11 = L_shl( acc, 3 ); gain4 = L_deposit_l( 0 ); FOR( k = 0; k < 12; k++ ) { - gain4 = L_add( gain4, Mult_32_16( cldfbBuf_Ener[k + 12], 2731 ) ); + gain4 = L_add( gain4, Mult_32_16( cldfbBuf_Ener[k + 12], 2731 /*(1/12).Q15*/ ) ); } peak_H1 = L_add( cldfbBuf_Ener[25], 0 ); - Mpy_32_16_ss( cldfbBuf_Ener[25], 6554, &avrg_H1, &lsb16 ); + Mpy_32_16_ss( cldfbBuf_Ener[25], 6554 /*0.4.Q15*/, &avrg_H1, &lsb16 ); FOR( k = 1; k < 5; k++ ) { IF( GT_32( cldfbBuf_Ener[k + 25], peak_H1 ) ) { peak_H1 = L_add( cldfbBuf_Ener[k + 25], 0 ); } - avrg_H1 = L_add( avrg_H1, Mult_32_16( cldfbBuf_Ener[k + 25], 6554 ) ); + avrg_H1 = L_add( avrg_H1, Mult_32_16( cldfbBuf_Ener[k + 25], 6554 /*0.4.Q15*/ ) ); } peak_H2 = L_add( cldfbBuf_Ener[20], 0 ); - Mpy_32_16_ss( cldfbBuf_Ener[20], 6554, &avrg_H2, &lsb16 ); + Mpy_32_16_ss( cldfbBuf_Ener[20], 6554 /*0.4.Q15*/, &avrg_H2, &lsb16 ); FOR( k = 1; k < 5; k++ ) { IF( GT_32( cldfbBuf_Ener[k + 20], peak_H2 ) ) { peak_H2 = L_add( cldfbBuf_Ener[k + 20], 0 ); } - avrg_H2 = L_add( avrg_H2, Mult_32_16( cldfbBuf_Ener[k + 20], 6554 ) ); + avrg_H2 = L_add( avrg_H2, Mult_32_16( cldfbBuf_Ener[k + 20], 6554 /*0.4.Q15*/ ) ); } // End peak_l = L_deposit_l( 0 ); @@ -400,7 +400,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision condition4 = 0; move16(); - L_tmp = Mult_32_16( peak_h, 12603 ); + L_tmp = Mult_32_16( peak_h, 12603 /*1/2.56.Q15*/ ); IF( GT_32( peak_l, L_tmp ) ) { exp = norm_l( peak_l ); @@ -418,7 +418,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision exp1 = norm_l( avrg_l ); } - L_tmp1 = Mult_32_16( peak_l, 12603 ); + L_tmp1 = Mult_32_16( peak_l, 12603 /*1/2.56.Q15*/ ); IF( GT_32( peak_h, L_tmp1 ) ) { exp2 = norm_l( peak_h ); @@ -438,7 +438,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision move16(); } - L_tmp = Mult_32_16( peak_h, 12800 ); + L_tmp = Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ); IF( GT_32( peak_l, L_tmp ) ) { exp = norm_l( peak_l ); @@ -448,7 +448,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision exp = norm_l( L_tmp ); } - L_tmp1 = Mult_32_16( peak_l, 6400 ); + L_tmp1 = Mult_32_16( peak_l, 6400 /*(1/5.12).Q15*/ ); IF( GT_32( peak_h, L_tmp1 ) ) { exp2 = norm_l( peak_h ); @@ -476,7 +476,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision test(); test(); test(); - IF( ( GT_32( gain4, Mult_32_16( gain11, 26214 ) ) && GT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 ), exp ), L_shl( avrg_l, exp1 ) ) ) && LT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 6400 ), exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) || ( GT_32( gain4, Mult_32_16( gain11, 9830 ) ) && LT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) && LT_32( Mult_32_16( peak_H2, 21845 ), avrg_H2 ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 ), exp ), L_shl( avrg_l, exp1 ) ) ) && GT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) ) || ( GT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 12800 ), exp3 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp3 ), L_shl( avrg_l, exp1 ) ) ) > 0 && LT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) ) ) + IF( ( GT_32( gain4, Mult_32_16( gain11, 26214 /*0.8.Q15*/ ) ) && GT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ), exp ), L_shl( avrg_l, exp1 ) ) ) && LT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 6400 /*(1/5.12).Q15*/ ), exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) || ( GT_32( gain4, Mult_32_16( gain11, 9830 /*0.3.Q15*/ ) ) && LT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) && LT_32( Mult_32_16( peak_H2, 21845 /*(1/1.5).Q15*/ ), avrg_H2 ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ), exp ), L_shl( avrg_l, exp1 ) ) ) && GT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) ) || ( GT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 12800 /*(1/2.56).Q15*/ ), exp3 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp3 ), L_shl( avrg_l, exp1 ) ) ) > 0 && LT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) ) ) { condition4 = 1; move16(); @@ -498,21 +498,21 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision } /* Smooth decision from instantaneous decision*/ - acc = L_mult( hTcxEnc->clas_sec_old_fx, MDCT_CLASSIFER_SMOOTH_FILT_COEFF ); /* st_fx->clas_sec_old_fx in Q13 */ - clas_sec = mac_r( acc, c, 0x7fff - MDCT_CLASSIFER_SMOOTH_FILT_COEFF ); /* clas_sec and c are in Q13 */ + acc = L_mult( hTcxEnc->clas_sec_old_fx, MDCT_CLASSIFER_SMOOTH_FILT_COEFF ); /* st_fx->clas_sec_old_fx in Q13 */ + clas_sec = mac_r( acc, c, 0x7fff /*1.Q15*/ - MDCT_CLASSIFER_SMOOTH_FILT_COEFF ); /* clas_sec and c are in Q13 */ /* Do thresholding with hysteresis */ IF( GT_16( st_fx->last_enerBuffer_exp, enerBuffer_exp ) ) { - gain1_tmp = L_shr( gain1, sub( st_fx->last_enerBuffer_exp, enerBuffer_exp ) ); + gain1_tmp = L_shr( gain1, sub( st_fx->last_enerBuffer_exp, enerBuffer_exp ) ); // st_fx->last_enerBuffer_exp move32(); - gain2_tmp = L_shr( gain2, sub( st_fx->last_enerBuffer_exp, enerBuffer_exp ) ); + gain2_tmp = L_shr( gain2, sub( st_fx->last_enerBuffer_exp, enerBuffer_exp ) ); // st_fx->last_enerBuffer_exp move32(); } ELSE { - hTcxEnc->last_gain1 = L_shr( hTcxEnc->last_gain1, sub( enerBuffer_exp, st_fx->last_enerBuffer_exp ) ); + hTcxEnc->last_gain1 = L_shr( hTcxEnc->last_gain1, sub( enerBuffer_exp, st_fx->last_enerBuffer_exp ) ); // enerBuffer_exp move32(); - hTcxEnc->last_gain2 = L_shr( hTcxEnc->last_gain2, sub( enerBuffer_exp, st_fx->last_enerBuffer_exp ) ); + hTcxEnc->last_gain2 = L_shr( hTcxEnc->last_gain2, sub( enerBuffer_exp, st_fx->last_enerBuffer_exp ) ); // enerBuffer_exp move32(); gain1_tmp = gain1; move32(); @@ -582,10 +582,11 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision return clas_final; /* Q0 */ } + Word16 mdct_classifier_ivas_fx( Encoder_State *st, /* i/o: Encoder state variable */ const Word16 *fft_buff, /* i : FFT spectrum from fft_rel */ - const Word32 enerBuffer[], /* i : energy buffer */ + const Word32 enerBuffer[], /* i : energy buffer enerBuffer_exp*/ Word16 enerBuffer_exp, const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */ ) @@ -772,7 +773,7 @@ Word16 mdct_classifier_ivas_fx( IF( pe != 0 ) { expo = norm_l( pe ); - man = L_shl( pe, expo ); + man = L_shl( pe, expo ); // expo Mpy_32_32_ss( man, man, &man, &lsb32 ); /* pe square */ expo = shl( expo, 1 ); /* Multiply by 2 due to squaring. */ floating_point_add( &p_energy_man, &p_energy_exp, man, expo ); @@ -795,32 +796,32 @@ Word16 mdct_classifier_ivas_fx( { IF( EQ_16( gain2_start, GAIN2_START_SWB ) ) { - gain1 = L_add( gain1, L_shr( enerBuffer[i], 3 ) ); - gain2 = L_add( gain2, L_shr( enerBuffer[gain2_start + i], 3 ) ); - gain3 = L_add( gain3, L_shr( enerBuffer[gain3_start + i], 3 ) ); + gain1 = L_add( gain1, L_shr( enerBuffer[i], 3 ) ); // enerBuffer_exp - 3 + gain2 = L_add( gain2, L_shr( enerBuffer[gain2_start + i], 3 ) ); // enerBuffer_exp - 3 + gain3 = L_add( gain3, L_shr( enerBuffer[gain3_start + i], 3 ) ); // enerBuffer_exp - 3 } ELSE { - gain1 = L_add( gain1, Mult_32_16( enerBuffer[i], 5461 ) ); - gain2 = L_add( gain2, Mult_32_16( enerBuffer[gain2_start + i], 5461 ) ); - gain3 = L_add( gain3, Mult_32_16( enerBuffer[gain3_start + i], 5461 ) ); + gain1 = L_add( gain1, Mult_32_16( enerBuffer[i], 5461 ) ); // enerBuffer_exp + gain2 = L_add( gain2, Mult_32_16( enerBuffer[gain2_start + i], 5461 /*0.16.Q15*/ ) ); // enerBuffer_exp + gain3 = L_add( gain3, Mult_32_16( enerBuffer[gain3_start + i], 5461 /*0.16.Q15*/ ) ); // enerBuffer_exp } } IF( EQ_16( gain2_start, GAIN2_START_SWB ) ) { - acc = L_shr( enerBuffer[0], 3 ); - acc = L_sub( gain1, acc ); - acc = Mult_32_16( acc, 4681 ); - gain11 = L_shl( acc, 3 ); + acc = L_shr( enerBuffer[0], 3 ); // enerBuffer_exp - 3 + acc = L_sub( gain1, acc ); // enerBuffer_exp - 3 + acc = Mult_32_16( acc, 4681 /*(1/7).Q15*/ ); // enerBuffer_exp - 3 + gain11 = L_shl( acc, 3 ); // enerBuffer_exp gain4 = L_deposit_l( 0 ); } ELSE { - acc = Mult_32_16( enerBuffer[0], 5461 ); - acc = L_sub( gain1, acc ); - acc = Mult_32_16( acc, 6553 ); + acc = Mult_32_16( enerBuffer[0], 5461 /*0.16.Q15*/ ); // enerBuffer_exp + acc = L_sub( gain1, acc ); // enerBuffer_exp + acc = Mult_32_16( acc, 6553 /*0.4.Q15*/ ); // enerBuffer_exp gain11 = (Word32) W_mult_32_16( acc, 6 ); gain4 = L_deposit_l( 0 ); } @@ -830,28 +831,28 @@ Word16 mdct_classifier_ivas_fx( { IF( EQ_16( gain4_start, GAIN4_START_SWB ) ) { - gain4 = L_add( gain4, Mult_32_16( enerBuffer[gain4_start + i], 2731 ) ); + gain4 = L_add( gain4, Mult_32_16( enerBuffer[gain4_start + i], 2731 /*(1/12).Q15*/ ) ); } ELSE { - gain4 = L_add( gain4, Mult_32_16( enerBuffer[gain4_start + i], 3641 ) ); + gain4 = L_add( gain4, Mult_32_16( enerBuffer[gain4_start + i], 3641 /*(1/9).Q1.15*/ ) ); } } - peak_H1 = enerBuffer[H1_start]; + peak_H1 = enerBuffer[H1_start]; // enerBuffer_exp move32(); - avrg_H1 = enerBuffer[H1_start]; + avrg_H1 = enerBuffer[H1_start]; // enerBuffer_exp move32(); FOR( i = 1; i < H_length; i++ ) { IF( GT_32( enerBuffer[H1_start + i], peak_H1 ) ) { - peak_H1 = enerBuffer[H1_start + i]; + peak_H1 = enerBuffer[H1_start + i]; // enerBuffer_exp move32(); } - avrg_H1 = L_add( avrg_H1, enerBuffer[H1_start + i] ); + avrg_H1 = L_add( avrg_H1, enerBuffer[H1_start + i] ); // enerBuffer_exp } peak_H2 = enerBuffer[H2_start]; @@ -969,7 +970,7 @@ Word16 mdct_classifier_ivas_fx( move16(); } - L_tmp = Mult_32_16( peak_h, 12800 ); + L_tmp = Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ); IF( GT_32( peak_l, L_tmp ) ) { exp = norm_l( peak_l ); @@ -979,7 +980,7 @@ Word16 mdct_classifier_ivas_fx( exp = norm_l( L_tmp ); } - L_tmp1 = Mult_32_16( peak_l, 6400 ); + L_tmp1 = Mult_32_16( peak_l, 6400 /*(1/5.12).Q15*/ ); IF( GT_32( peak_h, L_tmp1 ) ) { exp2 = norm_l( peak_h ); @@ -1007,8 +1008,8 @@ Word16 mdct_classifier_ivas_fx( test(); test(); test(); - IF( ( GT_32( gain4, Mult_32_16( gain11, 26214 ) ) && GT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 ), exp ), L_shl( avrg_l, exp1 ) ) ) && LT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 6400 ), exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) || ( GT_32( gain4, Mult_32_16( gain11, 9830 ) ) && LT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) && LT_32( Mult_32_16( peak_H2, 21845 ), avrg_H2 ) ) || - ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 ), exp ), L_shl( avrg_l, exp1 ) ) ) && GT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) ) || ( GT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 12800 ), exp3 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp3 ), L_shl( avrg_l, exp1 ) ) ) > 0 && LT_32( Mult_32_16( peak_h, 21845 ), avrg_h ) ) ) + IF( ( GT_32( gain4, Mult_32_16( gain11, 26214 /*0.8.Q15*/ ) ) && GT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ), exp ), L_shl( avrg_l, exp1 ) ) ) && LT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 6400 /*(1/5.12).Q15*/ ), exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) || ( GT_32( gain4, Mult_32_16( gain11, 9830 /*0.3.Q15*/ ) ) && LT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) && LT_32( Mult_32_16( peak_H2, 21845 /*(1/1.5).Q15*/ ), avrg_H2 ) ) || + ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( Mult_32_16( peak_h, 12800 /*(1/2.56).Q15*/ ), exp ), L_shl( avrg_l, exp1 ) ) ) && GT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) ) || ( GT_32( Mult_32_32( L_shl( Mult_32_16( peak_l, 12800 /*(1/2.56).Q15*/ ), exp3 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp3 ), L_shl( avrg_l, exp1 ) ) ) > 0 && LT_32( Mult_32_16( peak_h, 21845 /*(1/1.5).Q15*/ ), avrg_h ) ) ) { condition4 = 1; move16(); diff --git a/lib_enc/mdct_selector_fx.c b/lib_enc/mdct_selector_fx.c index 52c30f7ef..c4cc7d0db 100644 --- a/lib_enc/mdct_selector_fx.c +++ b/lib_enc/mdct_selector_fx.c @@ -62,14 +62,14 @@ static Word16 get_sparseness( /* Returns sparseness measur FOR( i = 1; i < n - 1; ++i ) { - if ( GT_16( Bin_E[i], s_max( s_max( Bin_E[i - 1], Bin_E[i + 1] ), thr ) ) ) + IF( GT_16( Bin_E[i], s_max( s_max( Bin_E[i - 1], Bin_E[i + 1] ), thr ) ) ) { num_max = add( num_max, 1 ); } } n = shr( sub( n, 2 ), 1 ); - return div_s( sub( n, num_max ), n ); + return div_s( sub( n, num_max ), n ); // Q15 } /*--------------------------------------------------------------------------* * get_mean_ener() @@ -78,7 +78,7 @@ static Word16 get_sparseness( /* Returns sparseness measur *--------------------------------------------------------------------------*/ static Word16 get_mean_ener( /* Returns mean energy in dB (Q8) */ - const Word32 enerBuffer[], /* i : CLDFB buffers */ + const Word32 enerBuffer[], /* i : CLDFB buffers enerBuffer_exp*/ Word16 enerBuffer_exp, /* i : exponent of enerBuffer */ Word16 n /* i : number of bins */ ) @@ -87,8 +87,10 @@ static Word16 get_mean_ener( /* Returns mean energy i Word16 i, shift, frac_nrg, exp_nrg; shift = sub( 14, norm_s( n ) ); - if ( LT_16( shl( 1, shift ), n ) ) + IF( LT_16( shl( 1, shift ), n ) ) + { shift = add( shift, 1 ); + } L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < n; ++i ) @@ -104,7 +106,7 @@ static Word16 get_mean_ener( /* Returns mean energy i exp_nrg = sub( add( exp_nrg, shift ), sub( 31, enerBuffer_exp ) ); L_tmp = Mpy_32_16( exp_nrg, frac_nrg, 9864 ); /* log10(2) in Q15 */ - return round_fx( L_shl( L_tmp, 8 ) ); + return round_fx( L_shl( L_tmp, 8 ) ); // Q8 } /*--------------------------------------------------------------------------* * MDCT_selector_fx() @@ -117,7 +119,7 @@ void MDCT_selector_fx( Word16 sp_floor, /* i : Noise floor estimate Q7 */ const Word16 Etot, /* i : Total energy Q8 */ const Word16 cor_map_sum, /* i : harmonicity factor Q8 */ - const Word32 enerBuffer[], /* i : CLDFB buffers */ + const Word32 enerBuffer[], /* i : CLDFB buffers enerBuffer_exp*/ const Word16 enerBuffer_exp /* i : exponent of enerBuffer */ ) { @@ -135,7 +137,7 @@ void MDCT_selector_fx( sp_floor = shl( sp_floor, 1 ); /* convert to Q8 */ - IF( EQ_16( st->bwidth, NB ) ) + IF( ( st->bwidth == NB ) ) { lob_cldfb = 3200 / 400; move16(); @@ -188,7 +190,7 @@ void MDCT_selector_fx( frame_voicing = add( shr( st->voicing_fx[0], 1 ), shr( st->voicing_fx[1], 1 ) ); /* Spectral sparseness */ - sparseness = get_sparseness( st->lgBin_E_fx, lob_fft, sub( Etot, MDCT_SW_SIG_PEAK_THR ) ); + sparseness = get_sparseness( st->lgBin_E_fx, lob_fft, sub( Etot, MDCT_SW_SIG_PEAK_THR ) ); // Q15 /* Hi band energy */ hi_ener = get_mean_ener( &enerBuffer[lob_cldfb], enerBuffer_exp, sub( hib_cldfb, lob_cldfb ) ); @@ -255,23 +257,23 @@ void MDCT_selector_fx( IF( EQ_16( st->mdct_sw_enable, MODE1 ) ) { - sig_lo_level_thr = MDCT_SW_1_SIG_LO_LEVEL_THR; + sig_lo_level_thr = MDCT_SW_1_SIG_LO_LEVEL_THR; // Q8 move16(); - sig_hi_level_thr = MDCT_SW_1_SIG_HI_LEVEL_THR; + sig_hi_level_thr = MDCT_SW_1_SIG_HI_LEVEL_THR; // Q8 move16(); - cor_thr = MDCT_SW_1_COR_THR; + cor_thr = MDCT_SW_1_COR_THR; // Q8 move16(); - cor_thr2 = MDCT_SW_1_COR_THR2; + cor_thr2 = MDCT_SW_1_COR_THR2; // Q8 move16(); - voicing_thr = MDCT_SW_1_VOICING_THR; + voicing_thr = MDCT_SW_1_VOICING_THR; // Q15 move16(); - voicing_thr2 = MDCT_SW_1_VOICING_THR2; + voicing_thr2 = MDCT_SW_1_VOICING_THR2; // Q15 move16(); - sparseness_thr = MDCT_SW_1_SPARSENESS_THR; + sparseness_thr = MDCT_SW_1_SPARSENESS_THR; // Q15 move16(); - sparseness_thr2 = MDCT_SW_1_SPARSENESS_THR2; + sparseness_thr2 = MDCT_SW_1_SPARSENESS_THR2; // Q15 move16(); - hi_ener_lo_thr = MDCT_SW_1_HI_ENER_LO_THR; + hi_ener_lo_thr = MDCT_SW_1_HI_ENER_LO_THR; // Q8 move16(); } ELSE /* st->mdct_sw_enable == MODE2 */ diff --git a/lib_enc/mslvq_enc_fx.c b/lib_enc/mslvq_enc_fx.c index 771ef480b..af5a82b69 100644 --- a/lib_enc/mslvq_enc_fx.c +++ b/lib_enc/mslvq_enc_fx.c @@ -58,19 +58,19 @@ Word32 mslvq_fx( IF( pred_flag == 0 ) { - p_sigma = sigma_MSLVQ_fx[mode]; + p_sigma = sigma_MSLVQ_fx[mode]; // Qlog2(2.56) /* inverse sigma is precomputed to save complexity */ - p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; - p_scales = scales_fx[mode_glb]; - p_no_lead = no_lead_fx[mode_glb]; + p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; // Q15 + p_scales = scales_fx[mode_glb]; // Q11 + p_no_lead = no_lead_fx[mode_glb]; // Q0 } ELSE { - p_sigma = sigma_p_fx[mode]; + p_sigma = sigma_p_fx[mode]; // Qlog2(2.56) /* inverse sigma is precomputed to save complexity */ - p_inv_sigma = inv_sigma_p_fx[mode]; - p_scales = scales_p_fx[mode_glb]; - p_no_lead = no_lead_p_fx[mode_glb]; + p_inv_sigma = inv_sigma_p_fx[mode]; // Q15 + p_scales = scales_p_fx[mode_glb]; // Q11 + p_no_lead = no_lead_p_fx[mode_glb]; // Q0 } /* first subvector */ @@ -184,15 +184,15 @@ Word32 mslvq_cng_fx( mode_glb = add( START_CNG, idx_cv ); move16(); - p_sigma = sigma_MSLVQ_fx[mode]; + p_sigma = sigma_MSLVQ_fx[mode]; // x2.56 move16(); - p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; + p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; // Q15 move16(); - p_scales = scales_fx[mode_glb]; + p_scales = scales_fx[mode_glb]; // Q11 move16(); - p_no_lead = no_lead_fx[mode_glb]; + p_no_lead = no_lead_fx[mode_glb]; // Q0 move16(); - p_no_scales = &no_scales[shl( mode_glb, 1 )]; + p_no_scales = &no_scales[( mode_glb << 1 )]; move16(); /* check if LSF component permutation is needed or not */ @@ -247,11 +247,11 @@ Word32 mslvq_cng_ivas_fx( mode_glb = add( START_CNG, idx_cv ); move16(); - p_sigma = sigma_MSLVQ_fx[mode]; + p_sigma = sigma_MSLVQ_fx[mode]; // x2.56 move16(); - p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; + p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; // Q15 move16(); - p_scales = scales_fx[mode_glb]; + p_scales = scales_fx[mode_glb]; // Q11 move16(); no_scales[0] = 0; @@ -773,7 +773,7 @@ static void sort_desc_ind_fx( move16(); } sorted = 0; - FOR( k = sub( len, 1 ); k > 0; k-- ) + FOR( k = ( len - 1 ); k > 0; k-- ) { IF( sorted ) { @@ -837,7 +837,7 @@ void index_lvq_fx( /* for first subvector */ IF( GT_16( idx_scale[0], -1 ) ) { - index1 = L_add( encode_comb_fx( quant, idx_lead[0] ), L_add( table_no_cv_fx[idx_lead[0]], p_offset_scale1[i_mult2( mode, len_offset ) + idx_scale[0]] ) ); + index1 = L_add( encode_comb_fx( quant, idx_lead[0] ), L_add( table_no_cv_fx[idx_lead[0]], p_offset_scale1[( mode * len_offset ) + idx_scale[0]] ) ); } /* for second subvector */ @@ -845,7 +845,7 @@ void index_lvq_fx( IF( GT_16( idx_scale[1], -1 ) ) { - index2 = L_add( encode_comb_fx( &quant[LATTICE_DIM], idx_lead[1] ), L_add( table_no_cv_fx[idx_lead[1]], p_offset_scale2[i_mult2( mode, len_offset ) + idx_scale[1]] ) ); + index2 = L_add( encode_comb_fx( &quant[LATTICE_DIM], idx_lead[1] ), L_add( table_no_cv_fx[idx_lead[1]], p_offset_scale2[( mode * len_offset ) + idx_scale[1]] ) ); } idx64 = W_mult0_32_32( index1, p_offset_scale2[mode * len_offset + p_no_scales[mode * 2 + 1]] ); index2_64 = W_deposit32_l( index2 ); @@ -854,9 +854,9 @@ void index_lvq_fx( /* convert to 3 short */ index[0] = ( ( idx64 ) & ( 0x7fff ) ); move16(); - index[1] = ( idx64 >> 15 ) & ( 0x7fff ); + index[1] = ( W_shr( idx64, 15 ) ) & ( 0x7fff ); move16(); - index[2] = ( idx64 >> 30 ) & ( 0x7fff ); + index[2] = ( W_shr( idx64, 30 ) ) & ( 0x7fff ); move16(); return; } @@ -900,9 +900,9 @@ void index_lvq_ivas_fx( /* convert to 3 short */ index[0] = ( ( idx64 ) & ( 0x7fff ) ); move16(); - index[1] = ( idx64 >> 15 ) & ( 0x7fff ); + index[1] = ( W_shr( idx64, 15 ) ) & ( 0x7fff ); move16(); - index[2] = ( idx64 >> 30 ) & ( 0x7fff ); + index[2] = ( W_shr( idx64, 30 ) ) & ( 0x7fff ); move16(); return; @@ -1059,7 +1059,7 @@ static Word16 encode_sign_pc1_fx( /* o : index of signs IF( cv[i] < 0 ) { idx_sign = add( idx_sign, ( shl( 1, cnt ) ) ); - cnt++; + cnt = add( cnt, 1 ); } if ( cv[i] > 0 ) @@ -1091,7 +1091,7 @@ static void take_out_val_fx( FOR( i = 0; i < len; i++ ) { - IF( NE_16( v[i], val ) ) + if ( NE_16( v[i], val ) ) { v_out[cnt++] = v[i]; move16(); @@ -1125,7 +1125,7 @@ Word16 c2idx_fx( /* o: index */ move16(); FOR( i = 1; i <= p[0]; i++ ) { - skip = add( skip, C_VQ[sub( n, i )][sub( k, 1 )] ); + skip = add( skip, C_VQ[( n - i )][( k - 1 )] ); // Q0 } p0 = p[0]; diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c index 78ef81c60..1bae597b6 100644 --- a/lib_enc/multi_harm_fx.c +++ b/lib_enc/multi_harm_fx.c @@ -53,7 +53,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity /* length of the useful part of the spectrum (up to 6.4kHz) */ L = L_FFT / 2; move16(); - if ( EQ_16( bwidth, NB ) ) + if ( ( bwidth == NB ) ) { /* length of the useful part of the spectrum (up to 3.6kHz) */ L = 76; @@ -170,14 +170,14 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity mean_dyn = round_fx( L_acc ); /*Q7*/ test(); - IF( LT_16( mean_dyn, 1229 ) /*9.6f*/ && *cor_strong_limit != 0 ) + IF( LT_16( mean_dyn, 1229 ) /*9.6f.Q7*/ && *cor_strong_limit != 0 ) { *cor_strong_limit = 0; move16(); *st_last_sw_dyn = mean_dyn; move16(); } - ELSE IF( GT_16( sub( mean_dyn, *st_last_sw_dyn ), 576 ) /*4.5f*/ ) + ELSE IF( GT_16( sub( mean_dyn, *st_last_sw_dyn ), 576 ) /*4.5f.Q7*/ ) { *cor_strong_limit = 1; move16(); @@ -290,7 +290,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity cor_strong = 0; move16(); - pt1 = cor_map_LT; + pt1 = cor_map_LT; // Q15 move16(); pt2 = cor_map; move16(); @@ -306,7 +306,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity /* cor_map_LT_sum += *pt1 */ Lcor_map_LT_sum = L_add( Lcor_map_LT_sum, *pt1 ); /* cor_map_LT_sum in Q15; max value is 128) */ - if ( GT_16( *pt1, 31130 ) /*0.95f*/ ) + if ( GT_16( *pt1, 31130 ) /*0.95f.Q15*/ ) { cor_strong = 1; move16(); @@ -316,7 +316,7 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity pt2++; } - IF( EQ_16( bwidth, NB ) ) + IF( ( bwidth == NB ) ) { /* cor_map_LT_sum *= 1.53f; */ /* tmp2 *= 1.53f; */ @@ -396,7 +396,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni /* length of the useful part of the spectrum (up to 6.4kHz) */ L = L_FFT / 2; move16(); - if ( EQ_16( bwidth, NB ) ) + if ( ( bwidth == NB ) ) { /* length of the useful part of the spectrum (up to 3.6kHz) */ L = 76; @@ -654,7 +654,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni } tmp2 = extract_l( L_shr_sat( tmp2_32, 7 ) ); // q15-> q8 - IF( EQ_16( bwidth, NB ) ) + IF( ( bwidth == NB ) ) { /* cor_map_LT_sum *= 1.53f; */ /* tmp2 *= 1.53f; */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 353de8ec9..e04f5172b 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -17,7 +17,6 @@ #include "debug.h" #endif #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index 7bbc54780..5c96a2f29 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -10,7 +10,6 @@ #include "rom_com.h" #include "stl.h" #include "prot_fx.h" /* Function prototypes */ -#include "ivas_prot.h" /* Function prototypes */ #include "ivas_prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 61ca9b101..ba8ee5aa8 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -10,7 +10,6 @@ #include "rom_com.h" #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ -#include "ivas_prot.h" /* Function prototypes */ #include "stl.h" #include "ivas_prot_fx.h" diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 008e27d6c..770b62764 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -36,7 +36,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index 81437c49d..e50ad32e1 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 9cc764afb..93a100e17 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -34,7 +34,6 @@ #include #include "ivas_cnst.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 730705ffd..0deb14c9b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -35,7 +35,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_binauralRenderer.h" diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index e89414542..b8b3c3ac7 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_onsets_dec_fx.c b/lib_rend/ivas_dirac_onsets_dec_fx.c index 4eae9c286..e9af8483a 100644 --- a/lib_rend/ivas_dirac_onsets_dec_fx.c +++ b/lib_rend/ivas_dirac_onsets_dec_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 983343bba..748b82d5c 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index aca51e01c..b092443be 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 52ca3e6f9..7a74e62da 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -36,7 +36,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_hrtf_fx.c b/lib_rend/ivas_hrtf_fx.c index 5d53d2ae3..e3965fbff 100644 --- a/lib_rend/ivas_hrtf_fx.c +++ b/lib_rend/ivas_hrtf_fx.c @@ -36,7 +36,6 @@ #include "ivas_prot_rend.h" #include "ivas_error.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 8b7e6575d..430fab2c7 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "lib_rend.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 25fddaa80..8b56b6855 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "options.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 93fe67436..7b1e1fe91 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index d7387ecd4..2c28b32bd 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -35,7 +35,6 @@ #include #include "ivas_cnst.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "prot_fx.h" #include "ivas_stat_rend.h" diff --git a/lib_rend/ivas_orient_trk_fx.c b/lib_rend/ivas_orient_trk_fx.c index bb6f26346..a124bf4bd 100644 --- a/lib_rend/ivas_orient_trk_fx.c +++ b/lib_rend/ivas_orient_trk_fx.c @@ -33,7 +33,6 @@ #include "common_api_types.h" #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 054e5e981..6fba496d5 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -37,7 +37,6 @@ #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------------------* diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index bbe6ae4b5..74be74497 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -1,6 +1,5 @@ #include "ivas_prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #ifdef FIX_DISCLAIMER #include diff --git a/lib_rend/ivas_reflections_fx.c b/lib_rend/ivas_reflections_fx.c index a02a29d0d..d6e397234 100644 --- a/lib_rend/ivas_reflections_fx.c +++ b/lib_rend/ivas_reflections_fx.c @@ -39,7 +39,6 @@ #include "ivas_prot_rend.h" #include "ivas_stat_rend.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "debug.h" diff --git a/lib_rend/ivas_reverb_delay_line_fx.c b/lib_rend/ivas_reverb_delay_line_fx.c index 44550803a..ab41b43c2 100644 --- a/lib_rend/ivas_reverb_delay_line_fx.c +++ b/lib_rend/ivas_reverb_delay_line_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "prot_fx.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_sba_rendering_fx.c b/lib_rend/ivas_sba_rendering_fx.c index 4323fc96f..d544acd13 100644 --- a/lib_rend/ivas_sba_rendering_fx.c +++ b/lib_rend/ivas_sba_rendering_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_td_decorr_fx.c b/lib_rend/ivas_td_decorr_fx.c index 6d5b23f12..0fc5c21df 100644 --- a/lib_rend/ivas_td_decorr_fx.c +++ b/lib_rend/ivas_td_decorr_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "prot_fx.h" #include "ivas_prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "math.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index 06cbd83a6..b90b3a456 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -35,7 +35,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac856e90c..60fbd5ec6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -33,7 +33,6 @@ #include "options.h" #include "lib_rend.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 930bb79dc..0316d8b30 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -34,7 +34,6 @@ #include #include "prot_fx.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*---------------------------------------------------------------------* diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 90d47b7c9..f4f43e496 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -33,7 +33,7 @@ #include "ls_custom_file_reader.h" #include #include -#include "ivas_prot.h" +#include "ivas_prot_fx.h" #include "prot_fx.h" diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 9351d9bc9..efab80b79 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "masa_file_reader.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include #include -- GitLab From 79e96be01a409e9e6e2d690fa04afaa6e22b8d8d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 19:41:16 +0530 Subject: [PATCH 076/358] Clang formatting changes --- lib_com/gs_bitallocation_ivas_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 71b30ea75..9243f640e 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -2,11 +2,11 @@ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -#include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" /* Function prototypes */ -#include "assert.h" /* Debug prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_com.h" /* Static table prototypes */ +#include "prot_fx.h" /* Function prototypes */ +#include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" -- GitLab From 935c2b486099e3ac2794e2560befb36618a6e2ef Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 12:52:44 +0530 Subject: [PATCH 077/358] USAN fix for decoder --- lib_dec/ivas_lfe_plc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 210c266eb..8ed450435 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -387,7 +387,7 @@ static Word16 lfeplc_lev_dur_fx( s = W_extract_h( W_shl( s_fx, exp1 ) ); s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( -s, err_fx, &temp_q2 ), 1 ); + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate(s), err_fx, &temp_q2 ), 1 ); move32(); rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); move16(); -- GitLab From c76b22a8b6f106799e8fe0ccc2a5011decbf8c8b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 12:55:14 +0530 Subject: [PATCH 078/358] Clang formatting changes --- lib_dec/ivas_lfe_plc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 8ed450435..d98603d2a 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -387,7 +387,7 @@ static Word16 lfeplc_lev_dur_fx( s = W_extract_h( W_shl( s_fx, exp1 ) ); s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate(s), err_fx, &temp_q2 ), 1 ); + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate( s ), err_fx, &temp_q2 ), 1 ); move32(); rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); move16(); -- GitLab From caa91ea0d326115d9d48a9f5f81dfc929a6a6597 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 11:52:47 +0530 Subject: [PATCH 079/358] Fix for 3GPP issue 1373: Decoder crash for stereo at 80kbps JBM decoding to Mono in get_scaling_quality_fx() Link #1373 --- lib_dec/jbm_pcmdsp_apa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index ac6a28b86..fc793dff0 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -900,7 +900,7 @@ UWord8 apa_exec_ivas_fx( UWord32 statsResetThreshold, statsResetShift; Word16 Q_a_out; - Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 ); + Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 - Q1 ); statsResetThreshold = 1637; move32(); statsResetShift = 2; -- GitLab From 8f5c6fa08d6044004b3e9b21815b1c248646132a Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 12:32:57 +0530 Subject: [PATCH 080/358] Fix for 3GPP issue 1341: Usage of open/deleteCldfb() functions - multiple variants Link #1341 --- lib_com/cldfb.c | 107 +++-------------------- lib_com/cnst.h | 6 +- lib_com/prot_fx.h | 15 +--- lib_dec/init_dec_fx.c | 6 +- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 +- lib_dec/ivas_init_dec.c | 4 +- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 +- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +-- lib_enc/init_enc_fx.c | 4 +- lib_enc/ivas_masa_enc_fx.c | 4 +- lib_enc/ivas_omasa_enc_fx.c | 4 +- lib_enc/ivas_stereo_switching_enc_fx.c | 10 +-- lib_enc/ivas_stereo_td_enc_fx.c | 8 +- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 +- 19 files changed, 53 insertions(+), 147 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 38195b65d..7fc8026b5 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1364,8 +1364,8 @@ ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -) + CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ + CODE_TYPE code_type ) { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,7 +1379,14 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - configureCldfb_ivas_fx( hs, sampling_rate ); + IF( code_type == IVAS_ENC ) + { + configureCldfb_ivas_enc_fx( hs, sampling_rate ); + } + ELSE + { + configureCldfb_ivas_fx( hs, sampling_rate ); + } hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1413,65 +1420,6 @@ ivas_error openCldfb_ivas_fx( return IVAS_ERR_OK; } -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -) -{ - HANDLE_CLDFB_FILTER_BANK hs; - Word16 buf_len; - - IF( ( hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); - } - - hs->type = type; - move32(); - hs->prototype = prototype; - move32(); - - configureCldfb_ivas_enc_fx( hs, sampling_rate ); - hs->memory_length = 0; - move32(); - - IF( type == CLDFB_ANALYSIS ) - { - buf_len = sub( hs->p_filter_length, hs->no_channels ); - hs->FilterStates = (Word16 *) malloc( ( 9 + 16 ) * CLDFB_getNumChannels( sampling_rate ) * sizeof( Word16 ) ); - hs->FilterStates_eg = 0; - move16(); - } - ELSE - { - buf_len = hs->p_filter_length; - move16(); - hs->FilterStates = (Word16 *) malloc( 2 * ( 9 + 16 ) * CLDFB_getNumChannels( sampling_rate ) * sizeof( Word16 ) ); - hs->FilterStates_eg = 0; - move16(); - } - - if ( ( hs->cldfb_state_fx = (Word32 *) malloc( buf_len * sizeof( Word32 ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); - } - hs->cldfb_state_length = buf_len; // Temporarily added to store the length of buffer - move16(); - hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ - move16(); - set32_fx( hs->cldfb_state_fx, 0, buf_len ); - hs->Q_cldfb_state = 0; - move16(); - set16_fx( hs->FilterStates, 0, i_mult( 9 + 16, hs->no_channels ) ); - set16_fx( hs->FilterStates_e, 0, sizeof( hs->FilterStates_e ) / sizeof( hs->FilterStates_e[0] ) ); - - *h_cldfb = hs; - - return IVAS_ERR_OK; -} - /*-------------------------------------------------------------------* * resampleCldfb_ivas() * @@ -1563,41 +1511,6 @@ void analysisCldfbEncoder_ivas_fx( return; } - -/*-------------------------------------------------------------------* - * GetEnergyCldfb_ivas() - * - * Remove handle - *--------------------------------------------------------------------*/ - -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -) -{ - HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; - - test(); - IF( h_cldfb == NULL || *h_cldfb == NULL ) - { - return; - } - - IF( hs->cldfb_state_fx ) - { - free( hs->cldfb_state_fx ); - } - - IF( hs->FilterStates ) - { - free( hs->FilterStates ); - } - - free( hs ); - *h_cldfb = NULL; - - return; -} - void deleteCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ ) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 4e14b310d..8f716f18e 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -806,7 +806,11 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; - +typedef enum +{ + IVAS_ENC, + IVAS_DEC_REND +} CODE_TYPE; typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index db0953cd9..c1aefbe36 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9803,8 +9803,8 @@ ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); + CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ + CODE_TYPE code_type ); Word32 rand_gauss_fx( Word32 *x, @@ -11944,13 +11944,6 @@ ivas_error openCldfb_ivas( CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ ); -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); - void resampleCldfb_ivas( HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ const Word32 newSamplerate /* i : new samplerate to operate */ @@ -11960,10 +11953,6 @@ ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -); - /*! r: flag indicating a valid bitrate */ Word16 is_EVS_bitrate( const Word32 ivas_total_brate, /* i : EVS total bitrate */ diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 3865cd61c..4e0cfda18 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 25c0bea42..111c0be0e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b11669460..236eaad54 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index a6be10c08..cc3980b12 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 3f39bd9ac..c8dde0837 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 09b683a16..34eef94ed 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 615ca1b33..f0338b461 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 6960629c8..9fdebed7a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -260,7 +260,7 @@ void ivas_masa_enc_close_fx( FOR( i = 0; i < ( *hMasa )->data.num_Cldfb_instances; i++ ) { - deleteCldfb_ivas( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); + deleteCldfb_ivas_fx( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } IF( ( *hMasa )->data.hOmasaData != NULL ) diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 5d79265f4..50fb49355 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_enc( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -227,7 +227,7 @@ void ivas_omasa_enc_close_fx( FOR( i = 0; i < ( *hOMasa )->num_Cldfb_instances; i++ ) { - deleteCldfb_ivas( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); + deleteCldfb_ivas_fx( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); } FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 2fe8b6c84..6c7a1e68d 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -366,8 +366,8 @@ ivas_error stereo_memory_enc_fx( IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) && ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) || EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) ) { /* Deallocate MDCT CNG structures */ - deleteCldfb_ivas( &hCPE->hCoreCoder[0]->cldfbAnaEnc ); - deleteCldfb_ivas( &hCPE->hCoreCoder[1]->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &hCPE->hCoreCoder[0]->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &hCPE->hCoreCoder[1]->cldfbAnaEnc ); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index d2ff2c0c2..de9bc09b5 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -263,7 +263,7 @@ ivas_error stereo_set_tdm_fx( /* deallocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc != NULL ) { - deleteCldfb_ivas( &st->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &st->cldfbAnaEnc ); } /* deallocate BWEs for secondary channel */ @@ -275,7 +275,7 @@ ivas_error stereo_set_tdm_fx( st->hBWE_TD = NULL; } - deleteCldfb_ivas( &st->cldfbSynTd ); + deleteCldfb_ivas_fx( &st->cldfbSynTd ); IF( st->hBWE_FD != NULL ) { @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 93a100e17..5dd3f8384 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 430fab2c7..3aa9f62a9 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 8b56b6855..d56ba2685 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 2c28b32bd..1d849a90f 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 60fbd5ec6..ed513e91a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From a79e6da8ef6a41749574d8a382a62353a7f05bde Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 11:42:57 +0530 Subject: [PATCH 081/358] Address review comments --- lib_com/cldfb.c | 10 ++++++---- lib_com/cnst.h | 6 +----- lib_com/prot_fx.h | 2 +- lib_dec/init_dec_fx.c | 6 +++--- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 ++-- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +++++----- lib_enc/init_enc_fx.c | 4 ++-- lib_enc/ivas_masa_enc_fx.c | 2 +- lib_enc/ivas_omasa_enc_fx.c | 2 +- lib_enc/ivas_stereo_switching_enc_fx.c | 6 +++--- lib_enc/ivas_stereo_td_enc_fx.c | 4 ++-- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 ++-- 19 files changed, 38 insertions(+), 40 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 7fc8026b5..246a8a8e8 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1365,7 +1365,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ) + const Word16 enc_dec ) /* i : encoder/decoder flag */ { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,14 +1379,17 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - IF( code_type == IVAS_ENC ) + IF( enc_dec == ENC ) { configureCldfb_ivas_enc_fx( hs, sampling_rate ); + hs->Q_cldfb_state = 0; } ELSE { configureCldfb_ivas_fx( hs, sampling_rate ); + hs->Q_cldfb_state = Q11; } + move16(); hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1412,8 +1415,7 @@ ivas_error openCldfb_ivas_fx( hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); - hs->Q_cldfb_state = Q11; - move16(); + *h_cldfb = hs; move16(); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 8f716f18e..4e14b310d 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -806,11 +806,7 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; -typedef enum -{ - IVAS_ENC, - IVAS_DEC_REND -} CODE_TYPE; + typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c1aefbe36..9fe14b5bd 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9804,7 +9804,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ); + const Word16 enc_dec ); /* i : encoder/decoder flag */ Word32 rand_gauss_fx( Word32 *x, diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 4e0cfda18..bd8a2cbd3 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 111c0be0e..8333f146f 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 236eaad54..1ab797ded 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index cc3980b12..12549f49d 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index c8dde0837..5b1378a89 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 34eef94ed..c70e606ac 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index f0338b461..cd5db5377 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 9fdebed7a..da1f836df 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 50fb49355..b5258712b 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 6c7a1e68d..0a526561a 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index de9bc09b5..1544aab76 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 5dd3f8384..1a5013059 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 3aa9f62a9..c74477365 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index d56ba2685..e17b2f9f6 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 1d849a90f..5e175fae5 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ed513e91a..29030ca0c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From 9f43bf8e9b079b8d78258958d49505d0a356d468 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 11:49:56 +0530 Subject: [PATCH 082/358] Fix for 3GPP issue 1361: Assert in BASOP decoder function ivas_dirac_dec_render_sf_fx for LTV MASA bitstream Link #1361 --- lib_dec/ivas_cpe_dec_fx.c | 4 ---- lib_dec/ivas_dirac_dec_fx.c | 37 ++++++++++++++++++++------------ lib_dec/ivas_stereo_dft_dec_fx.c | 3 ++- lib_rend/ivas_dirac_rend_fx.c | 2 ++ 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 6a6294377..9e934cc88 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -352,10 +352,6 @@ ivas_error ivas_cpe_dec_fx( { sts[0]->total_brate = hCPE->element_brate; /* Only mono downmix was transmitted in this case */ move32(); -#ifdef MSAN_FIX - hCPE->hStereoDft->frame_sid_nodata = 0; - move16(); -#endif } ELSE { diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index b8a7f61bb..ac29a23e0 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2204,13 +2204,15 @@ void ivas_dirac_dec_render_sf_fx( Word32 Cldfb_RealBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word16 cldfb_buf_q; - Word16 offset, buff_len; + Word16 offset = 0, buff_len = 0; + move16(); + move16(); Word16 q_cldfb, q_temp_cldfb = 0; move16(); Word16 proto_length = 0; move16(); - Word16 q_proto_direct_buffer[CLDFB_SLOTS_PER_SUBFRAME]; - Word16 q_proto_diffuse_buffer[CLDFB_SLOTS_PER_SUBFRAME]; + Word16 q_proto_direct_buffer[CLDFB_SLOTS_PER_SUBFRAME + 1]; + Word16 q_proto_diffuse_buffer[CLDFB_SLOTS_PER_SUBFRAME + 1]; Word16 size, size_ho; DIRAC_DEC_STACK_MEM DirAC_mem; @@ -2263,8 +2265,8 @@ void ivas_dirac_dec_render_sf_fx( } q_cldfb = Q11; move16(); - set16_fx( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); - set16_fx( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); + set16_fx( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME + 1 ); + set16_fx( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME + 1 ); set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) @@ -3477,22 +3479,21 @@ void ivas_dirac_dec_render_sf_fx( } } - minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); + minimum_s( q_proto_direct_buffer, add( hSpatParamRendCom->subframe_nbslots[subframe_idx], 1 ), &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - minimum_s( q_proto_diffuse_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q ); + minimum_s( q_proto_diffuse_buffer, add( hSpatParamRendCom->subframe_nbslots[subframe_idx], 1 ), &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q ); } FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ); - buff_len = i_mult( 2, i_mult( nchan_transport, hSpatParamRendCom->num_freq_bands ) ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); // proto_direct_buffer_f_q - offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); buff_len = i_mult( 2, i_mult( hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, q_proto_diffuse_buffer[slot_idx] ) ); // proto_diffuse_buffer_f_q + offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ); + buff_len = i_mult( 2, i_mult( nchan_transport, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); // proto_direct_buffer_f_q } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { @@ -3532,10 +3533,18 @@ void ivas_dirac_dec_render_sf_fx( BREAK; } } - q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; - move16(); } - + test(); + IF( EQ_16( slot_idx, hSpatParamRendCom->subframe_nbslots[subframe_idx] ) && sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len, add( offset, buff_len ) ) > 0 ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + add( offset, buff_len ), sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len, add( offset, buff_len ) ), sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); // proto_direct_buffer_f_q + offset = i_mult( i_mult( sub( slot_idx, 1 ), 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + buff_len = i_mult( 2, i_mult( hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands ) ); + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) && sub( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, add( offset, buff_len ) ) > 0 ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + add( offset, buff_len ), sub( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, add( offset, buff_len ) ), sub( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, q_proto_diffuse_buffer[slot_idx] ) ); // proto_direct_buffer_f_q + } + } ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); size = i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 1c18ffacb..3d9e58ad1 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -258,7 +258,8 @@ void stereo_dft_dec_reset_fx( move16(); hStereoDft->ipd_xfade_prev_fx = 0; move32(); - + hStereoDft->frame_sid_nodata = 0; + move16(); #ifdef MSAN_FIX FOR( b = 0; b < 2 * IVAS_MAX_NUM_BANDS; b++ ) { diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index b092443be..d438dc7f2 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -882,6 +882,8 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_protos_dir ), num_freq_bands ); move16(); + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = Q31; + move16(); IF( hDirACRend->proto_signal_decorr_on ) { -- GitLab From 4dc8bbbd784951ca74eabf63e230c640b3b60ad5 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 07:28:01 +0530 Subject: [PATCH 083/358] Clean up of prot.h file --- lib_com/core_com_config.c | 1 + lib_com/gs_bitallocation_ivas_fx.c | 11 ++++++----- lib_com/ivas_arith_fx.c | 1 + lib_com/ivas_dirac_com_fx.c | 1 + lib_com/ivas_fb_mixer_fx.c | 1 + lib_com/ivas_ism_com_fx.c | 1 + lib_com/ivas_lfe_com_fx.c | 1 + lib_com/ivas_mc_com_fx.c | 1 + lib_com/ivas_mct_com_fx.c | 2 +- lib_com/ivas_mdct_core_com_fx.c | 1 + lib_com/ivas_mdft_imdft_fx.c | 1 + lib_com/ivas_qmetadata_com_fx.c | 1 + lib_com/ivas_qspherical_com_fx.c | 1 + lib_com/ivas_sba_config_fx.c | 1 + lib_com/ivas_stereo_dft_com_fx.c | 1 + lib_com/ivas_stereo_psychlpc_com_fx.c | 2 ++ lib_com/ivas_tools_fx.c | 1 + lib_com/ivas_transient_det_fx.c | 1 + lib_com/mslvq_com.c | 1 + lib_com/prot_fx.h | 15 +++++++++++++++ lib_dec/igf_dec_fx.c | 1 + lib_dec/ivas_binRenderer_internal_fx.c | 1 + lib_dec/ivas_core_dec_fx.c | 1 + lib_dec/ivas_cpe_dec_fx.c | 1 + lib_dec/ivas_decision_matrix_dec_fx.c | 1 + lib_dec/ivas_dirac_dec_fx.c | 1 + lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 1 + lib_dec/ivas_entropy_decoder_fx.c | 1 + lib_dec/ivas_ism_dec_fx.c | 1 + lib_dec/ivas_jbm_dec_fx.c | 1 + lib_dec/ivas_ls_custom_dec_fx.c | 1 + lib_dec/ivas_mc_param_dec_fx.c | 1 + lib_dec/ivas_mct_dec_fx.c | 1 + lib_dec/ivas_mct_dec_mct_fx_fx.c | 1 + lib_dec/ivas_objectRenderer_internal_fx.c | 1 + lib_dec/ivas_osba_dec_fx.c | 1 + lib_dec/ivas_out_setup_conversion_fx.c | 1 + lib_dec/ivas_pca_dec_fx.c | 1 + lib_dec/ivas_sba_dec_fx.c | 1 + lib_dec/ivas_sba_rendering_internal_fx.c | 1 + lib_dec/ivas_sns_dec_fx.c | 1 + lib_dec/ivas_spar_md_dec_fx.c | 1 + lib_dec/ivas_stereo_cng_dec.c | 1 + lib_dec/ivas_stereo_dft_dec_dmx_fx.c | 1 + lib_dec/ivas_stereo_ica_dec_fx.c | 1 + lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 1 + lib_dec/ivas_stereo_switching_dec_fx.c | 1 + lib_dec/ivas_svd_dec_fx.c | 1 + lib_dec/ivas_tcx_core_dec_fx.c | 1 + lib_enc/cod_tcx_fx.c | 1 + lib_enc/igf_enc.c | 1 + lib_enc/ivas_agc_enc_fx.c | 1 + lib_enc/ivas_cpe_enc_fx.c | 1 + lib_enc/ivas_decision_matrix_enc_fx.c | 1 + lib_enc/ivas_enc_cov_handler_fx.c | 1 + lib_enc/ivas_enc_fx.c | 1 + lib_enc/ivas_front_vad_fx.c | 1 + lib_enc/ivas_init_enc_fx.c | 1 + lib_enc/ivas_ism_dtx_enc_fx.c | 1 + lib_enc/ivas_ism_enc_fx.c | 1 + lib_enc/ivas_lfe_enc_fx.c | 1 + lib_enc/ivas_mc_paramupmix_enc_fx.c | 1 + lib_enc/ivas_mct_core_enc_fx.c | 1 + lib_enc/ivas_mct_enc_fx.c | 1 + lib_enc/ivas_mdct_core_enc_fx.c | 1 + lib_enc/ivas_osba_enc_fx.c | 1 + lib_enc/ivas_pca_enc_fx.c | 1 + lib_enc/ivas_qmetadata_enc_fx.c | 1 + lib_enc/ivas_sns_enc_fx.c | 1 + lib_enc/ivas_stereo_adapt_GR_enc_fx.c | 1 + lib_enc/ivas_stereo_classifier_fx.c | 1 + lib_enc/ivas_stereo_cng_enc_fx.c | 1 + lib_enc/ivas_stereo_dft_enc_fx.c | 1 + lib_enc/ivas_stereo_ica_enc_fx.c | 1 + lib_enc/ivas_stereo_icbwe_enc_fx.c | 1 + lib_enc/ivas_stereo_switching_enc_fx.c | 1 + lib_enc/ivas_stereo_td_analysis_fx.c | 1 + lib_enc/ivas_stereo_td_enc_fx.c | 1 + lib_enc/lsf_msvq_ma_enc.c | 1 + lib_rend/ivas_allrad_dec_fx.c | 1 + lib_rend/ivas_crend_fx.c | 1 + lib_rend/ivas_dirac_ana_fx.c | 1 + lib_rend/ivas_dirac_decorr_dec_fx.c | 1 + lib_rend/ivas_dirac_onsets_dec_fx.c | 1 + lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 1 + lib_rend/ivas_dirac_rend_fx.c | 1 + lib_rend/ivas_mcmasa_ana_fx.c | 1 + lib_rend/ivas_objectRenderer_fx.c | 1 + lib_rend/ivas_vbap_fx.c | 1 + lib_util/hrtf_file_reader.c | 1 + lib_util/ls_custom_file_reader.c | 2 +- 91 files changed, 111 insertions(+), 7 deletions(-) diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index f0ee8efd8..ed72605de 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -40,6 +40,7 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #define FSCALE_DENOM_BY_12800_Q15 1311 diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 9243f640e..0921dc88c 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -2,11 +2,12 @@ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -#include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" /* Function prototypes */ -#include "assert.h" /* Debug prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_com.h" /* Static table prototypes */ +#include "prot_fx.h" /* Function prototypes */ +#include "ivas_prot.h" /* Function prototypes */ +#include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 311bccff8..006a31177 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include "wmc_auto.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "stat_dec.h" diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 146587791..9b60b2c5c 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -36,6 +36,7 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index d5cd8d4f1..883861024 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -35,6 +35,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_ism_com_fx.c b/lib_com/ivas_ism_com_fx.c index 5f1a13afb..f1201b06c 100644 --- a/lib_com/ivas_ism_com_fx.c +++ b/lib_com/ivas_ism_com_fx.c @@ -36,6 +36,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index 3d1e7aee6..7464c41c2 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "ivas_stat_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "cnst.h" diff --git a/lib_com/ivas_mc_com_fx.c b/lib_com/ivas_mc_com_fx.c index 8201037a1..62d623b83 100644 --- a/lib_com/ivas_mc_com_fx.c +++ b/lib_com/ivas_mc_com_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mct_com_fx.c b/lib_com/ivas_mct_com_fx.c index 81a56df14..1f3c58153 100644 --- a/lib_com/ivas_mct_com_fx.c +++ b/lib_com/ivas_mct_com_fx.c @@ -33,8 +33,8 @@ #include #include "options.h" #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" -#include "ivas_prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_mdct_core_com_fx.c b/lib_com/ivas_mdct_core_com_fx.c index fe313eecd..000f3992f 100644 --- a/lib_com/ivas_mdct_core_com_fx.c +++ b/lib_com/ivas_mdct_core_com_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mdft_imdft_fx.c b/lib_com/ivas_mdft_imdft_fx.c index 5d7bee1a6..b10444307 100644 --- a/lib_com/ivas_mdft_imdft_fx.c +++ b/lib_com/ivas_mdft_imdft_fx.c @@ -34,6 +34,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index c9ad84097..79a585e8b 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -36,6 +36,7 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_qspherical_com_fx.c b/lib_com/ivas_qspherical_com_fx.c index 6661026a8..5caa850cb 100644 --- a/lib_com/ivas_qspherical_com_fx.c +++ b/lib_com/ivas_qspherical_com_fx.c @@ -36,6 +36,7 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index b3a0806d4..38785956c 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -38,6 +38,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_dft_com_fx.c b/lib_com/ivas_stereo_dft_com_fx.c index 6d63bc6d1..80e64c0cc 100644 --- a/lib_com/ivas_stereo_dft_com_fx.c +++ b/lib_com/ivas_stereo_dft_com_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_psychlpc_com_fx.c b/lib_com/ivas_stereo_psychlpc_com_fx.c index df5140895..cb3c39df2 100644 --- a/lib_com/ivas_stereo_psychlpc_com_fx.c +++ b/lib_com/ivas_stereo_psychlpc_com_fx.c @@ -33,7 +33,9 @@ #include #include "options.h" #include "ivas_rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 04d6f7bf5..e15db9a15 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_transient_det_fx.c b/lib_com/ivas_transient_det_fx.c index 3b9a8cfd7..97025b46f 100644 --- a/lib_com/ivas_transient_det_fx.c +++ b/lib_com/ivas_transient_det_fx.c @@ -36,6 +36,7 @@ #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_cnst.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_com.h" diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 12234a4c0..6bd8026c4 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -40,6 +40,7 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 9fe14b5bd..c9ef0e87a 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -72,6 +72,10 @@ #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif +#ifndef TRUNC +#define TRUNC( x ) ( (int16_t) ( ( ( x ) >= 32767. ? 32767 : ( ( x ) <= -32768. ? -32768 : ( x ) ) ) + 0.5 ) ) +#endif + #define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) #define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) @@ -11944,6 +11948,13 @@ ivas_error openCldfb_ivas( CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ ); +ivas_error openCldfb_ivas_enc( + HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ + CLDFB_TYPE type, /* i : analysis or synthesis */ + const Word32 sampling_rate, /* i : sampling rate */ + CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ +); + void resampleCldfb_ivas( HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ const Word32 newSamplerate /* i : new samplerate to operate */ @@ -11953,6 +11964,10 @@ ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); +void deleteCldfb_ivas( + HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ +); + /*! r: flag indicating a valid bitrate */ Word16 is_EVS_bitrate( const Word32 ivas_total_brate, /* i : EVS total bitrate */ diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index c1b0ce93a..582169c85 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -9,6 +9,7 @@ #include "options.h" #include "stl.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "cnst.h" #include "stat_dec.h" diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 8527e6703..3c234c098 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 7b4e5f267..5bb4736e9 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 9e934cc88..3749fb3fa 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -37,6 +37,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_decision_matrix_dec_fx.c b/lib_dec/ivas_decision_matrix_dec_fx.c index 717bb3b93..f7fd5e8e2 100644 --- a/lib_dec/ivas_decision_matrix_dec_fx.c +++ b/lib_dec/ivas_decision_matrix_dec_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include "stat_dec.h" #include "rom_com.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index ac29a23e0..776d0c8bb 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index b247fd653..e03913f8a 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -41,6 +41,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_entropy_decoder_fx.c b/lib_dec/ivas_entropy_decoder_fx.c index f8bf3c091..e637a6a93 100644 --- a/lib_dec/ivas_entropy_decoder_fx.c +++ b/lib_dec/ivas_entropy_decoder_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 643874a82..664e3eeac 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 210425b88..428c817ef 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -36,6 +36,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_ls_custom_dec_fx.c b/lib_dec/ivas_ls_custom_dec_fx.c index 5ad390f9a..45f59d82f 100644 --- a/lib_dec/ivas_ls_custom_dec_fx.c +++ b/lib_dec/ivas_ls_custom_dec_fx.c @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include #include "options.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 697ae6345..be2363469 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -37,6 +37,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 884a44c9e..081eca88d 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -38,6 +38,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index c275820fb..69f601724 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index b88b68915..391a27522 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 6f1a233c9..07ea14ea2 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -33,6 +33,7 @@ #include "options.h" #include #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 84b6fe46d..4811911fd 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -35,6 +35,7 @@ #include #include #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index 98611ab7c..08ac17799 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index f04350366..efd766f76 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index 8748342ed..a42c67389 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index fd25e7ea7..170256181 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index 7f487a75c..bb79b956c 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include "math.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 223860db0..4d50ba350 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -35,6 +35,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c index e82005965..0781d49a6 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index 694aad0b4..b49ab5399 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 5b1378a89..6412f315e 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -35,6 +35,7 @@ #include #include "options.h" #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index c70e606ac..90fa9e175 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -35,6 +35,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 1467687d8..375dbdad0 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 07eba9e64..c908e4dc3 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -40,6 +40,7 @@ #include "wmc_auto.h" #include "basop_proto_func.h" #include "stat_com.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------* diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 7c28c3309..c54e8ccf4 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -16,6 +16,7 @@ #include "prot_fx_enc.h" #ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" #endif diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index fc7c32fdb..f6adb0f31 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -39,6 +39,7 @@ #include "options.h" #include #include "prot_fx.h" +#include "ivas_prot.h" #include "cnst.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index d74e10bda..104eeb998 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -35,6 +35,7 @@ #include #include #include "options.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 1152736f6..a9d62a2b0 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -37,6 +37,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "prot_fx_enc.h" #include "ivas_rom_com.h" #ifdef DEBUGGING diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index bd63553bd..1158f72fa 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -36,6 +36,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index c05d59b90..576bbb2c6 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index e8e1bc59e..0a2d976e1 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -37,6 +37,7 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 8b76b37a4..0c3852bd5 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -37,6 +37,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "prot_fx_enc.h" #include #include "wmc_auto.h" diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index b49fc9716..c65c85356 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_enc.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index b29b0c15b..64b8991d6 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 1b648cc98..22bf88df8 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index 96959c9dd..11056b535 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -34,6 +34,7 @@ #include "options.h" #include "math.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index fd5cb6217..abd09cbbd 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -37,6 +37,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "basop_util.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 71515571d..439c227ae 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "rom_com.h" #include "wmc_auto.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index 56f5e44db..d6bc4c7f0 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 3272768e9..f67660902 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -37,6 +37,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 2a6944c50..1229624de 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -35,6 +35,7 @@ #include #include #include "ivas_cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" diff --git a/lib_enc/ivas_pca_enc_fx.c b/lib_enc/ivas_pca_enc_fx.c index 2cb347a02..410d5dd52 100644 --- a/lib_enc/ivas_pca_enc_fx.c +++ b/lib_enc/ivas_pca_enc_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include #include diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 2d6080995..b32c80404 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -36,6 +36,7 @@ #include #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 93ee56461..e321f1c7c 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c index 8e79b2288..70c2165f8 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 3e148a5ae..bfe683d6b 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -39,6 +39,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_stereo_cng_enc_fx.c b/lib_enc/ivas_stereo_cng_enc_fx.c index aa7c2d0aa..255b6e938 100644 --- a/lib_enc/ivas_stereo_cng_enc_fx.c +++ b/lib_enc/ivas_stereo_cng_enc_fx.c @@ -37,6 +37,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 3eb6c0e82..ede3d3ad9 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -38,6 +38,7 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 057798706..78c324cce 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index bc84ba419..78891c5f7 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 0a526561a..2f38045eb 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -35,6 +35,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 44c08efa8..efae1e80d 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "rom_enc.h" diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 1544aab76..2b550d3e9 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #ifdef DEBUGGING diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 60375ddcc..6055bb0d1 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -37,6 +37,7 @@ #include #include "options.h" #include "cnst.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 770b62764..008e27d6c 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -36,6 +36,7 @@ #include #include #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index e50ad32e1..81437c49d 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -34,6 +34,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 1a5013059..c21ffd979 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -34,6 +34,7 @@ #include #include "ivas_cnst.h" #include "ivas_prot_rend.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index b8b3c3ac7..e89414542 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_onsets_dec_fx.c b/lib_rend/ivas_dirac_onsets_dec_fx.c index e9af8483a..4eae9c286 100644 --- a/lib_rend/ivas_dirac_onsets_dec_fx.c +++ b/lib_rend/ivas_dirac_onsets_dec_fx.c @@ -35,6 +35,7 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 748b82d5c..983343bba 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index d438dc7f2..1822b0132 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -36,6 +36,7 @@ #include #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index e17b2f9f6..9b3b062b8 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -36,6 +36,7 @@ #include "ivas_cnst.h" #include "options.h" #include "ivas_prot_rend.h" +#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 7b1e1fe91..93fe67436 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -34,6 +34,7 @@ #include #include "options.h" #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index b90b3a456..06cbd83a6 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -35,6 +35,7 @@ #include #include #include "prot_fx.h" +#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 0316d8b30..930bb79dc 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -34,6 +34,7 @@ #include #include "prot_fx.h" #include "ivas_prot_rend.h" +#include "ivas_prot.h" #include "ivas_prot_fx.h" /*---------------------------------------------------------------------* diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index f4f43e496..90d47b7c9 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -33,7 +33,7 @@ #include "ls_custom_file_reader.h" #include #include -#include "ivas_prot_fx.h" +#include "ivas_prot.h" #include "prot_fx.h" -- GitLab From 3ac57f17c097e625f3c2047f37c05f61e72fead4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 10:13:00 +0530 Subject: [PATCH 084/358] Fix for 3GPP issue 1140: Missing conversion of some flt. pt. functions in the BASOP code Link #1140 --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index d1ed7ad8c..f231a077b 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3806,7 +3806,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 + *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } -- GitLab From fff2f5b6c2bfcbd2aae16a5bef95589d9213071d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 7 Mar 2025 14:58:16 +0530 Subject: [PATCH 085/358] Fix for LTV crash issue Fix for LTV crash : 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM IR out, random FER at 5% --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index f231a077b..d1ed7ad8c 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3806,7 +3806,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); - *nf_seed = add_o( *nf_seed, shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ), &Overflow ); // abs( tmp32 ) * i * 2 + *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 move16(); } } -- GitLab From 96fd6e2b4d0446831883e4500d6a776e8fad859b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 09:48:48 +0530 Subject: [PATCH 086/358] Fix for 3GPP issue 1037: Wrong variable type used in the fixed-point code - 1 Link #1037 --- lib_com/prot_fx.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c9ef0e87a..d2e43e9b2 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -72,10 +72,6 @@ #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif -#ifndef TRUNC -#define TRUNC( x ) ( (int16_t) ( ( ( x ) >= 32767. ? 32767 : ( ( x ) <= -32768. ? -32768 : ( x ) ) ) + 0.5 ) ) -#endif - #define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) #define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) -- GitLab From bd596e48e5bec3ffc756b298498b85d41dde91c4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 19:34:14 +0530 Subject: [PATCH 087/358] Bug fixes, ivas_prot.h cleanup, Q documentation updates --- lib_com/core_com_config.c | 1 - lib_com/gs_bitallocation_ivas_fx.c | 1 - lib_com/ivas_arith_fx.c | 1 - lib_com/ivas_dirac_com_fx.c | 1 - lib_com/ivas_fb_mixer_fx.c | 1 - lib_com/ivas_ism_com_fx.c | 1 - lib_com/ivas_lfe_com_fx.c | 1 - lib_com/ivas_mc_com_fx.c | 1 - lib_com/ivas_mct_com_fx.c | 2 +- lib_com/ivas_mdct_core_com_fx.c | 1 - lib_com/ivas_mdft_imdft_fx.c | 1 - lib_com/ivas_qmetadata_com_fx.c | 1 - lib_com/ivas_qspherical_com_fx.c | 1 - lib_com/ivas_sba_config_fx.c | 1 - lib_com/ivas_stereo_dft_com_fx.c | 1 - lib_com/ivas_stereo_psychlpc_com_fx.c | 2 -- lib_com/ivas_tools_fx.c | 1 - lib_com/ivas_transient_det_fx.c | 1 - lib_com/mslvq_com.c | 1 - lib_dec/igf_dec_fx.c | 1 - lib_dec/ivas_binRenderer_internal_fx.c | 1 - lib_dec/ivas_core_dec_fx.c | 1 - lib_dec/ivas_cpe_dec_fx.c | 1 - lib_dec/ivas_decision_matrix_dec_fx.c | 1 - lib_dec/ivas_dirac_dec_fx.c | 1 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 1 - lib_dec/ivas_entropy_decoder_fx.c | 1 - lib_dec/ivas_ism_dec_fx.c | 1 - lib_dec/ivas_jbm_dec_fx.c | 1 - lib_dec/ivas_ls_custom_dec_fx.c | 1 - lib_dec/ivas_mc_param_dec_fx.c | 1 - lib_dec/ivas_mct_dec_fx.c | 1 - lib_dec/ivas_mct_dec_mct_fx_fx.c | 1 - lib_dec/ivas_objectRenderer_internal_fx.c | 1 - lib_dec/ivas_osba_dec_fx.c | 1 - lib_dec/ivas_out_setup_conversion_fx.c | 1 - lib_dec/ivas_pca_dec_fx.c | 1 - lib_dec/ivas_sba_dec_fx.c | 1 - lib_dec/ivas_sba_rendering_internal_fx.c | 1 - lib_dec/ivas_sns_dec_fx.c | 1 - lib_dec/ivas_spar_md_dec_fx.c | 1 - lib_dec/ivas_stereo_cng_dec.c | 1 - lib_dec/ivas_stereo_dft_dec_dmx_fx.c | 1 - lib_dec/ivas_stereo_ica_dec_fx.c | 1 - lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 1 - lib_dec/ivas_stereo_switching_dec_fx.c | 1 - lib_dec/ivas_svd_dec_fx.c | 1 - lib_dec/ivas_tcx_core_dec_fx.c | 1 - lib_enc/cod_tcx_fx.c | 1 - lib_enc/igf_enc.c | 1 - lib_enc/ivas_agc_enc_fx.c | 1 - lib_enc/ivas_cpe_enc_fx.c | 1 - lib_enc/ivas_decision_matrix_enc_fx.c | 1 - lib_enc/ivas_enc_cov_handler_fx.c | 1 - lib_enc/ivas_enc_fx.c | 1 - lib_enc/ivas_front_vad_fx.c | 1 - lib_enc/ivas_init_enc_fx.c | 1 - lib_enc/ivas_ism_dtx_enc_fx.c | 1 - lib_enc/ivas_ism_enc_fx.c | 1 - lib_enc/ivas_lfe_enc_fx.c | 1 - lib_enc/ivas_mc_paramupmix_enc_fx.c | 1 - lib_enc/ivas_mct_core_enc_fx.c | 1 - lib_enc/ivas_mct_enc_fx.c | 1 - lib_enc/ivas_mdct_core_enc_fx.c | 1 - lib_enc/ivas_osba_enc_fx.c | 1 - lib_enc/ivas_pca_enc_fx.c | 1 - lib_enc/ivas_qmetadata_enc_fx.c | 1 - lib_enc/ivas_sns_enc_fx.c | 1 - lib_enc/ivas_stereo_adapt_GR_enc_fx.c | 1 - lib_enc/ivas_stereo_classifier_fx.c | 1 - lib_enc/ivas_stereo_cng_enc_fx.c | 1 - lib_enc/ivas_stereo_dft_enc_fx.c | 1 - lib_enc/ivas_stereo_ica_enc_fx.c | 1 - lib_enc/ivas_stereo_icbwe_enc_fx.c | 1 - lib_enc/ivas_stereo_switching_enc_fx.c | 1 - lib_enc/ivas_stereo_td_analysis_fx.c | 1 - lib_enc/ivas_stereo_td_enc_fx.c | 1 - lib_enc/lsf_msvq_ma_enc.c | 1 - lib_rend/ivas_allrad_dec_fx.c | 1 - lib_rend/ivas_crend_fx.c | 1 - lib_rend/ivas_dirac_ana_fx.c | 1 - lib_rend/ivas_dirac_decorr_dec_fx.c | 1 - lib_rend/ivas_dirac_onsets_dec_fx.c | 1 - lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 1 - lib_rend/ivas_dirac_rend_fx.c | 1 - lib_rend/ivas_mcmasa_ana_fx.c | 1 - lib_rend/ivas_objectRenderer_fx.c | 1 - lib_rend/ivas_vbap_fx.c | 1 - lib_util/hrtf_file_reader.c | 1 - lib_util/ls_custom_file_reader.c | 2 +- 90 files changed, 2 insertions(+), 91 deletions(-) diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index ed72605de..f0ee8efd8 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -40,7 +40,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #define FSCALE_DENOM_BY_12800_Q15 1311 diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 0921dc88c..71b30ea75 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -6,7 +6,6 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#include "ivas_prot.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 006a31177..311bccff8 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "wmc_auto.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "stat_dec.h" diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 9b60b2c5c..146587791 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c index 883861024..d5cd8d4f1 100644 --- a/lib_com/ivas_fb_mixer_fx.c +++ b/lib_com/ivas_fb_mixer_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_ism_com_fx.c b/lib_com/ivas_ism_com_fx.c index f1201b06c..5f1a13afb 100644 --- a/lib_com/ivas_ism_com_fx.c +++ b/lib_com/ivas_ism_com_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index 7464c41c2..3d1e7aee6 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_stat_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "cnst.h" diff --git a/lib_com/ivas_mc_com_fx.c b/lib_com/ivas_mc_com_fx.c index 62d623b83..8201037a1 100644 --- a/lib_com/ivas_mc_com_fx.c +++ b/lib_com/ivas_mc_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mct_com_fx.c b/lib_com/ivas_mct_com_fx.c index 1f3c58153..81a56df14 100644 --- a/lib_com/ivas_mct_com_fx.c +++ b/lib_com/ivas_mct_com_fx.c @@ -33,8 +33,8 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_mdct_core_com_fx.c b/lib_com/ivas_mdct_core_com_fx.c index 000f3992f..fe313eecd 100644 --- a/lib_com/ivas_mdct_core_com_fx.c +++ b/lib_com/ivas_mdct_core_com_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_mdft_imdft_fx.c b/lib_com/ivas_mdft_imdft_fx.c index b10444307..5d7bee1a6 100644 --- a/lib_com/ivas_mdft_imdft_fx.c +++ b/lib_com/ivas_mdft_imdft_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index 79a585e8b..c9ad84097 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -36,7 +36,6 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_qspherical_com_fx.c b/lib_com/ivas_qspherical_com_fx.c index 5caa850cb..6661026a8 100644 --- a/lib_com/ivas_qspherical_com_fx.c +++ b/lib_com/ivas_qspherical_com_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index 38785956c..b3a0806d4 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -38,7 +38,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_dft_com_fx.c b/lib_com/ivas_stereo_dft_com_fx.c index 80e64c0cc..6d63bc6d1 100644 --- a/lib_com/ivas_stereo_dft_com_fx.c +++ b/lib_com/ivas_stereo_dft_com_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "cnst.h" #include "wmc_auto.h" diff --git a/lib_com/ivas_stereo_psychlpc_com_fx.c b/lib_com/ivas_stereo_psychlpc_com_fx.c index cb3c39df2..df5140895 100644 --- a/lib_com/ivas_stereo_psychlpc_com_fx.c +++ b/lib_com/ivas_stereo_psychlpc_com_fx.c @@ -33,9 +33,7 @@ #include #include "options.h" #include "ivas_rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index e15db9a15..04d6f7bf5 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_transient_det_fx.c b/lib_com/ivas_transient_det_fx.c index 97025b46f..3b9a8cfd7 100644 --- a/lib_com/ivas_transient_det_fx.c +++ b/lib_com/ivas_transient_det_fx.c @@ -36,7 +36,6 @@ #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_com.h" diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 6bd8026c4..12234a4c0 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -40,7 +40,6 @@ #include "rom_com.h" #include "prot_fx.h" #include "wmc_auto.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 582169c85..c1b0ce93a 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -9,7 +9,6 @@ #include "options.h" #include "stl.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "cnst.h" #include "stat_dec.h" diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 3c234c098..8527e6703 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "cnst.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 5bb4736e9..7b4e5f267 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 3749fb3fa..9e934cc88 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_decision_matrix_dec_fx.c b/lib_dec/ivas_decision_matrix_dec_fx.c index f7fd5e8e2..717bb3b93 100644 --- a/lib_dec/ivas_decision_matrix_dec_fx.c +++ b/lib_dec/ivas_decision_matrix_dec_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "stat_dec.h" #include "rom_com.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 776d0c8bb..ac29a23e0 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index e03913f8a..b247fd653 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -41,7 +41,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_entropy_decoder_fx.c b/lib_dec/ivas_entropy_decoder_fx.c index e637a6a93..f8bf3c091 100644 --- a/lib_dec/ivas_entropy_decoder_fx.c +++ b/lib_dec/ivas_entropy_decoder_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 664e3eeac..643874a82 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 428c817ef..210425b88 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_ls_custom_dec_fx.c b/lib_dec/ivas_ls_custom_dec_fx.c index 45f59d82f..5ad390f9a 100644 --- a/lib_dec/ivas_ls_custom_dec_fx.c +++ b/lib_dec/ivas_ls_custom_dec_fx.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include #include "options.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index be2363469..697ae6345 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 081eca88d..884a44c9e 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -38,7 +38,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index 69f601724..c275820fb 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "wmc_auto.h" #include diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 391a27522..b88b68915 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 07ea14ea2..6f1a233c9 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -33,7 +33,6 @@ #include "options.h" #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 4811911fd..84b6fe46d 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -35,7 +35,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index 08ac17799..98611ab7c 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include #include "ivas_cnst.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index efd766f76..f04350366 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index a42c67389..8748342ed 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 170256181..fd25e7ea7 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index bb79b956c..7f487a75c 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "math.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 4d50ba350..223860db0 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -35,7 +35,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c index 0781d49a6..e82005965 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index b49ab5399..694aad0b4 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 6412f315e..5b1378a89 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -35,7 +35,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 90fa9e175..c70e606ac 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 375dbdad0..1467687d8 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c908e4dc3..07eba9e64 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -40,7 +40,6 @@ #include "wmc_auto.h" #include "basop_proto_func.h" #include "stat_com.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*-------------------------------------------------------------* diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c54e8ccf4..7c28c3309 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -16,7 +16,6 @@ #include "prot_fx_enc.h" #ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" #endif diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index f6adb0f31..fc7c32fdb 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -39,7 +39,6 @@ #include "options.h" #include #include "prot_fx.h" -#include "ivas_prot.h" #include "cnst.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_agc_enc_fx.c b/lib_enc/ivas_agc_enc_fx.c index 104eeb998..d74e10bda 100644 --- a/lib_enc/ivas_agc_enc_fx.c +++ b/lib_enc/ivas_agc_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "options.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index a9d62a2b0..1152736f6 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "prot_fx_enc.h" #include "ivas_rom_com.h" #ifdef DEBUGGING diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index 1158f72fa..bd63553bd 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" /* Function prototypes */ diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 576bbb2c6..c05d59b90 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index 0a2d976e1..e8e1bc59e 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -37,7 +37,6 @@ #include "ivas_cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 0c3852bd5..8b76b37a4 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "prot_fx_enc.h" #include #include "wmc_auto.h" diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index c65c85356..b49fc9716 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_stat_enc.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 64b8991d6..b29b0c15b 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 22bf88df8..1b648cc98 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index 11056b535..96959c9dd 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -34,7 +34,6 @@ #include "options.h" #include "math.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index abd09cbbd..fd5cb6217 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "basop_util.h" #include "ivas_rom_com_fx.h" diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 439c227ae..71515571d 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "wmc_auto.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index d6bc4c7f0..56f5e44db 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx_enc.h" diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index f67660902..3272768e9 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -37,7 +37,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "rom_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 1229624de..2a6944c50 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -35,7 +35,6 @@ #include #include #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" diff --git a/lib_enc/ivas_pca_enc_fx.c b/lib_enc/ivas_pca_enc_fx.c index 410d5dd52..2cb347a02 100644 --- a/lib_enc/ivas_pca_enc_fx.c +++ b/lib_enc/ivas_pca_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include #include diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index b32c80404..2d6080995 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -36,7 +36,6 @@ #include #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index e321f1c7c..93ee56461 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c index 70c2165f8..8e79b2288 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc_fx.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc_fx.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "stat_enc.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index bfe683d6b..3e148a5ae 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -39,7 +39,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "ivas_cnst.h" diff --git a/lib_enc/ivas_stereo_cng_enc_fx.c b/lib_enc/ivas_stereo_cng_enc_fx.c index 255b6e938..aa7c2d0aa 100644 --- a/lib_enc/ivas_stereo_cng_enc_fx.c +++ b/lib_enc/ivas_stereo_cng_enc_fx.c @@ -37,7 +37,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index ede3d3ad9..3eb6c0e82 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -38,7 +38,6 @@ #include "rom_enc.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 78c324cce..057798706 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -37,7 +37,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 78891c5f7..bc84ba419 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "ivas_cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 2f38045eb..0a526561a 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -35,7 +35,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com_fx.h" #include "ivas_rom_com.h" #include "assert.h" diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index efae1e80d..44c08efa8 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "rom_enc.h" diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 2b550d3e9..1544aab76 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -36,7 +36,6 @@ #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" #ifdef DEBUGGING diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 6055bb0d1..60375ddcc 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -37,7 +37,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "rom_com.h" #include "rom_enc.h" diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 008e27d6c..770b62764 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -36,7 +36,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index 81437c49d..e50ad32e1 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index c21ffd979..1a5013059 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -34,7 +34,6 @@ #include #include "ivas_cnst.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index e89414542..b8b3c3ac7 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_dirac_onsets_dec_fx.c b/lib_rend/ivas_dirac_onsets_dec_fx.c index 4eae9c286..e9af8483a 100644 --- a/lib_rend/ivas_dirac_onsets_dec_fx.c +++ b/lib_rend/ivas_dirac_onsets_dec_fx.c @@ -35,7 +35,6 @@ #include "options.h" #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 983343bba..748b82d5c 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 1822b0132..d438dc7f2 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -36,7 +36,6 @@ #include #include "cnst.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 9b3b062b8..e17b2f9f6 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -36,7 +36,6 @@ #include "ivas_cnst.h" #include "options.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "prot_fx.h" #include "ivas_stat_rend.h" #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 93fe67436..7b1e1fe91 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -34,7 +34,6 @@ #include #include "options.h" #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include #include "ivas_rom_com.h" diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index 06cbd83a6..b90b3a456 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -35,7 +35,6 @@ #include #include #include "prot_fx.h" -#include "ivas_prot.h" #include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "wmc_auto.h" diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 930bb79dc..0316d8b30 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -34,7 +34,6 @@ #include #include "prot_fx.h" #include "ivas_prot_rend.h" -#include "ivas_prot.h" #include "ivas_prot_fx.h" /*---------------------------------------------------------------------* diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 90d47b7c9..f4f43e496 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -33,7 +33,7 @@ #include "ls_custom_file_reader.h" #include #include -#include "ivas_prot.h" +#include "ivas_prot_fx.h" #include "prot_fx.h" -- GitLab From 8b5efbd8734b40acd07beecdcbcacf78e277a4e4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 19:41:16 +0530 Subject: [PATCH 088/358] Clang formatting changes --- lib_com/gs_bitallocation_ivas_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 71b30ea75..9243f640e 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -2,11 +2,11 @@ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include -#include "options.h" /* Compilation switches */ -#include "cnst.h" /* Common constants */ -#include "rom_com.h" /* Static table prototypes */ -#include "prot_fx.h" /* Function prototypes */ -#include "assert.h" /* Debug prototypes */ +#include "options.h" /* Compilation switches */ +#include "cnst.h" /* Common constants */ +#include "rom_com.h" /* Static table prototypes */ +#include "prot_fx.h" /* Function prototypes */ +#include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" -- GitLab From 2f3a79116c56295e2ba3f3ed05e6377b5e1b3a20 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 12:52:44 +0530 Subject: [PATCH 089/358] USAN fix for decoder --- lib_dec/ivas_lfe_plc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index d98603d2a..8ed450435 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -387,7 +387,7 @@ static Word16 lfeplc_lev_dur_fx( s = W_extract_h( W_shl( s_fx, exp1 ) ); s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate( s ), err_fx, &temp_q2 ), 1 ); + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate(s), err_fx, &temp_q2 ), 1 ); move32(); rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); move16(); -- GitLab From 0a0705bf0317445bdf423faaf4366b2205a0816b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 12:55:14 +0530 Subject: [PATCH 090/358] Clang formatting changes --- lib_dec/ivas_lfe_plc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 8ed450435..d98603d2a 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -387,7 +387,7 @@ static Word16 lfeplc_lev_dur_fx( s = W_extract_h( W_shl( s_fx, exp1 ) ); s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate(s), err_fx, &temp_q2 ), 1 ); + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate( s ), err_fx, &temp_q2 ), 1 ); move32(); rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); move16(); -- GitLab From 3a5e04634454aff220c1712343e6a318cfc58c05 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 12:32:57 +0530 Subject: [PATCH 091/358] Fix for 3GPP issue 1341: Usage of open/deleteCldfb() functions - multiple variants Link #1341 --- lib_com/cldfb.c | 10 ++++------ lib_com/cnst.h | 6 +++++- lib_com/prot_fx.h | 13 +------------ lib_dec/init_dec_fx.c | 6 +++--- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 ++-- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +++++----- lib_enc/init_enc_fx.c | 4 ++-- lib_enc/ivas_masa_enc_fx.c | 2 +- lib_enc/ivas_omasa_enc_fx.c | 2 +- lib_enc/ivas_stereo_switching_enc_fx.c | 6 +++--- lib_enc/ivas_stereo_td_enc_fx.c | 4 ++-- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 ++-- 19 files changed, 40 insertions(+), 49 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 246a8a8e8..7fc8026b5 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1365,7 +1365,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - const Word16 enc_dec ) /* i : encoder/decoder flag */ + CODE_TYPE code_type ) { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,17 +1379,14 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - IF( enc_dec == ENC ) + IF( code_type == IVAS_ENC ) { configureCldfb_ivas_enc_fx( hs, sampling_rate ); - hs->Q_cldfb_state = 0; } ELSE { configureCldfb_ivas_fx( hs, sampling_rate ); - hs->Q_cldfb_state = Q11; } - move16(); hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1415,7 +1412,8 @@ ivas_error openCldfb_ivas_fx( hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); - + hs->Q_cldfb_state = Q11; + move16(); *h_cldfb = hs; move16(); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 4e14b310d..8f716f18e 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -806,7 +806,11 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; - +typedef enum +{ + IVAS_ENC, + IVAS_DEC_REND +} CODE_TYPE; typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index d2e43e9b2..c1aefbe36 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9804,7 +9804,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - const Word16 enc_dec ); /* i : encoder/decoder flag */ + CODE_TYPE code_type ); Word32 rand_gauss_fx( Word32 *x, @@ -11944,13 +11944,6 @@ ivas_error openCldfb_ivas( CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ ); -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); - void resampleCldfb_ivas( HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ const Word32 newSamplerate /* i : new samplerate to operate */ @@ -11960,10 +11953,6 @@ ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -); - /*! r: flag indicating a valid bitrate */ Word16 is_EVS_bitrate( const Word32 ivas_total_brate, /* i : EVS total bitrate */ diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index bd8a2cbd3..4e0cfda18 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 8333f146f..111c0be0e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1ab797ded..236eaad54 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 12549f49d..cc3980b12 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 5b1378a89..c8dde0837 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index c70e606ac..34eef94ed 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index cd5db5377..f0338b461 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index da1f836df..9fdebed7a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index b5258712b..50fb49355 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 0a526561a..6c7a1e68d 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 1544aab76..de9bc09b5 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 1a5013059..5dd3f8384 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index c74477365..3aa9f62a9 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index e17b2f9f6..d56ba2685 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 5e175fae5..1d849a90f 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 29030ca0c..ed513e91a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From 1002fad42819c4bdc5c861dbdd2aec1059eba2cc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 11:42:57 +0530 Subject: [PATCH 092/358] Address review comments --- lib_com/cldfb.c | 10 ++++++---- lib_com/cnst.h | 6 +----- lib_com/prot_fx.h | 2 +- lib_dec/init_dec_fx.c | 6 +++--- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 ++-- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +++++----- lib_enc/init_enc_fx.c | 4 ++-- lib_enc/ivas_masa_enc_fx.c | 2 +- lib_enc/ivas_omasa_enc_fx.c | 2 +- lib_enc/ivas_stereo_switching_enc_fx.c | 6 +++--- lib_enc/ivas_stereo_td_enc_fx.c | 4 ++-- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 ++-- 19 files changed, 38 insertions(+), 40 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 7fc8026b5..246a8a8e8 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1365,7 +1365,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ) + const Word16 enc_dec ) /* i : encoder/decoder flag */ { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,14 +1379,17 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - IF( code_type == IVAS_ENC ) + IF( enc_dec == ENC ) { configureCldfb_ivas_enc_fx( hs, sampling_rate ); + hs->Q_cldfb_state = 0; } ELSE { configureCldfb_ivas_fx( hs, sampling_rate ); + hs->Q_cldfb_state = Q11; } + move16(); hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1412,8 +1415,7 @@ ivas_error openCldfb_ivas_fx( hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); - hs->Q_cldfb_state = Q11; - move16(); + *h_cldfb = hs; move16(); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 8f716f18e..4e14b310d 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -806,11 +806,7 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; -typedef enum -{ - IVAS_ENC, - IVAS_DEC_REND -} CODE_TYPE; + typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c1aefbe36..9fe14b5bd 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9804,7 +9804,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ); + const Word16 enc_dec ); /* i : encoder/decoder flag */ Word32 rand_gauss_fx( Word32 *x, diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 4e0cfda18..bd8a2cbd3 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 111c0be0e..8333f146f 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 236eaad54..1ab797ded 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index cc3980b12..12549f49d 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index c8dde0837..5b1378a89 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 34eef94ed..c70e606ac 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index f0338b461..cd5db5377 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 9fdebed7a..da1f836df 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 50fb49355..b5258712b 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 6c7a1e68d..0a526561a 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index de9bc09b5..1544aab76 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 5dd3f8384..1a5013059 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 3aa9f62a9..c74477365 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index d56ba2685..e17b2f9f6 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 1d849a90f..5e175fae5 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ed513e91a..29030ca0c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From 500cf508bde93ac74c0a3d5c569c10866906cc50 Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 15:53:43 +0100 Subject: [PATCH 093/358] Fix for stereo DMX / PHA mode : Change the resolution and improve the precision of several variables. --- lib_com/options.h | 6 + lib_enc/ivas_stat_enc.h | 9 +- lib_enc/ivas_stereo_dmx_evs_fx.c | 195 ++++++++++++++++++++++++++----- 3 files changed, 181 insertions(+), 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d03261715..a2eba7aad 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,4 +172,10 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ + +#define FIX_1386_STEREO_DMX_EVS_PHA /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#undef FIX_ISSUE_1153 /* With FIX_1386_STEREO_DMX_EVS_PHA, the FIX_ISSUE_1153 should not be activated. */ +#endif + #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index ac258cfc1..397eb3cc3 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1183,7 +1183,11 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word32 isd_rate_s_fx; // Q31 +#else Word16 isd_rate_s_fx; // Q15 +#endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 @@ -1224,8 +1228,11 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; - +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx; // Q0 +#else Word32 itd_fx; // Q16 +#endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index ae8a8203e..bfb703c94 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -65,12 +65,20 @@ #define Q_BAND_FX 536870912 /*Q31*/ -#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 +#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 +#define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 +#define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 +#define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 +#define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 +#else +#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 +#endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 @@ -153,8 +161,12 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word32 itd[], /* o : estimated itd Q16 */ - const Word16 input_frame /* i : input frame length per channel */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd[], /* o : estimated itd Q0 */ +#else + Word32 itd[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( const Word32 src_fx[], /* i : input signal Q16 */ @@ -196,9 +208,13 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word32 itd_fx[], /* o : estimated itd */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx[], /* o : estimated itd */ +#else + Word32 itd_fx[], /* o : estimated itd */ +#endif + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio */ ); /*-------------------------------------------------------------------* * estimate_itd_wnd_fft() @@ -604,12 +620,21 @@ static void calc_poc_fx( Ni = L_sub( specLi[i], specRi[i] ); // spec_e Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e - // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) + // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) +#else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) +#endif { isd_cnt_h = add( isd_cnt_h, 1 ); } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 + IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 +#else IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) +#endif { isd_cnt_l = add( isd_cnt_l, 1 ); } @@ -618,10 +643,19 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); + move32(); +#else hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); move16(); +#endif +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) +#else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) +#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { @@ -646,7 +680,11 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) +#else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) +#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { @@ -711,11 +749,36 @@ static void calc_poc_fx( FOR( j = 0; j < STEREO_DMX_EVS_SUBBAND_SIZE; ( j++, i++ ) ) { + /* Energy */ + +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + + // Left + W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) + } + tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEl_e[n] ); + move32(); + + // Right + W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); // Q(62-(2*specR_e)) -> Q(63 - ((2*specR_e) +1)) + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) + } + tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); + move32(); +#else tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); move32(); tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); move32(); +#endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e @@ -746,11 +809,35 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + + Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); + Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); + + // eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), 0, &eneL_e ); + W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); + } + eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneL_e ); + + // eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), 0, &eneR_e ); + W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); + } + eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); +#else Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), shl( spec_e, 1 ), &Ni_e ); eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); +#endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); @@ -768,7 +855,13 @@ static void calc_poc_fx( move32(); Pi[n] = L_add( Mpy_32_32_r( ipd_ff[n], Pi[n] ), Mpy_32_32_r( L_sub( MAX_32, ipd_ff[n] ), tPi ) ); move32(); + // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); + Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); + Pn = Isqrt_lc( Pn, &Pn_e ); +#else L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); L_tmp_e = 1; move16(); @@ -776,6 +869,8 @@ static void calc_poc_fx( Pn_e = L_tmp_e; move16(); Pn = ISqrt32( L_tmp, &Pn_e ); +#endif + Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); Pi[n] = L_shl_sat( Mpy_32_32_r( Pi[n], Pn ), Pn_e ); // Q31 @@ -984,7 +1079,13 @@ static void calc_poc_fx( #ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else + +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 +#else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 +#endif + #endif move32(); } @@ -1015,7 +1116,11 @@ static void calc_poc_fx( energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 +#else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 +#endif move32(); } } @@ -1118,9 +1223,13 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word32 itd_fx[], /* o : estimated itd Q16 */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio Q31 */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx[], /* o : estimated itd Q0 */ +#else + Word32 itd_fx[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) { Word16 itd_cand[CPE_CHANNELS], i, n, cnt[CPE_CHANNELS], Lh, peak_range, *on, *itdLR, prev_off[CPE_CHANNELS], eps_fx; @@ -1430,8 +1539,12 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word32 itd[], /* o : estimated itd Q16 */ - const Word16 input_frame /* i : input frame length per channel */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd[], /* o : estimated itd Q0 */ +#else + Word32 itd[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame /* i : input frame length per channel */ ) { Word32 specLr[L_FRAME48k / 2 + 1], specLi[L_FRAME48k / 2 + 1], specRr[L_FRAME48k / 2 + 1], specRi[L_FRAME48k / 2 + 1]; @@ -1938,9 +2051,9 @@ void stereo_dmx_evs_enc_fx( hStereoDmxEVS->dmx_weight_fx, hStereoDmxEVS->pre_dmx_energy_fx, hStereoDmxEVS->pre_dmx_energy_fx_e, hStereoDmxEVS->aux_dmx_energy_fx, hStereoDmxEVS->aux_dmx_energy_fx_e ); // Downscaling signals to avoid accumulation overflows - scale_sig32( data_fx[0], input_frame, -5 ); // Q16->Q11 - scale_sig32( data_fx[1], input_frame, -5 ); // Q16->Q11 - scale_sig32( dmx_poc_data, input_frame, -5 ); // Q16->Q11 + scale_sig32( data_fx[0], input_frame, -5 ); // Q31->Q26 + scale_sig32( data_fx[1], input_frame, -5 ); // Q31->Q26 + scale_sig32( dmx_poc_data, input_frame, -5 ); // Q31->Q26 /* pha */ @@ -1969,9 +2082,11 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_prev_taps[m]; - // fx_tmp = BASOP_Util_Add_Mant32Exp(fx_tmp, fx_tmp_e, Mpy_32_32(p_data_mem[n - m], p_prev_taps[m]),15,&fx_tmp_e); - fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q11 + fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + fx_tmp = L_shl( fx_tmp, 1 ); // Q26 +#endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); move32(); } @@ -1981,7 +2096,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < fad_len; n++ ) { // mem_prev[n] += p_data[n] * INV_SQRT_2; - mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 + mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -1994,10 +2109,13 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_curr_taps[m]; - fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q11 + fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + fx_tmp = L_shl( fx_tmp, 1 ); // Q26 +#endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -2006,7 +2124,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < n_samples; n++ ) { // dmx_pha_data[n] += p_data[n] * INV_SQRT_2; - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -2016,7 +2134,7 @@ void stereo_dmx_evs_enc_fx( { dmx_pha_data[n] = Mpy_32_32( dmx_pha_data[n], fad_g[n] ); move32(); - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q26 move32(); } @@ -2025,7 +2143,11 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) +#else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) +#endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { @@ -2102,9 +2224,9 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { - p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 + p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); - p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q11 + p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q26 move32(); } } @@ -2121,16 +2243,15 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { - p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 + p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); - p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q11 + p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q26 move32(); } } } - Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q11->Q0 - + Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q26->Q15 return; } @@ -2383,6 +2504,23 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); + hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; + move16(); + IF( EQ_32( input_Fs, 16000 ) ) + { + hStereoDmxEVS->hPHA->win_fx[pha_len - 1] = 7373; /*0.45f in Q14*/ + move16(); + } + ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) + { + hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 2 )] = 19302; /*1.1781f in Q14*/ + move16(); + hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ + move16(); + } +#else trans_len = idiv1616( pha_len, 20 ); set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; @@ -2396,6 +2534,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); move16(); } +#endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); -- GitLab From 51e86b7db007a58de319961264c44c732d94128c Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 16:48:53 +0100 Subject: [PATCH 094/358] clang-format correction. --- lib_enc/ivas_stat_enc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 397eb3cc3..258a3074c 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1184,7 +1184,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA - Word32 isd_rate_s_fx; // Q31 + Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 #endif @@ -1231,7 +1231,7 @@ typedef struct stereo_dmx_evs_enc_data_structure #ifdef FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else - Word32 itd_fx; // Q16 + Word32 itd_fx; // Q16 #endif Word32 pre_dmx_energy_fx[1]; -- GitLab From d27a08ed490024c004de72643145d778599a8c04 Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 16:58:01 +0100 Subject: [PATCH 095/358] Useless variable removed. --- lib_enc/ivas_stereo_dmx_evs_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index bfb703c94..e6b6b338f 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -2272,7 +2272,11 @@ ivas_error stereo_dmx_evs_init_encoder_fx( Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 *win; +#else Word16 *win, tmp_r; +#endif const Word16 *p_ipd_w; Word16 tmp_e; -- GitLab From efd050064dc3610e93f48cb778b86ef3d6eb3af3 Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 17:23:12 +0100 Subject: [PATCH 096/358] Useless variable removed. --- lib_enc/ivas_stereo_dmx_evs_fx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index e6b6b338f..690e0b35e 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -2270,11 +2270,13 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; - Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; - Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; #ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; + Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; #else + Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; + Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; Word16 *win, tmp_r; #endif const Word16 *p_ipd_w; -- GitLab From 99819c6d58f906bdeec90ed4efcb326570c5b9f6 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 13 Mar 2025 15:40:36 +0100 Subject: [PATCH 097/358] Reduce differences to main. Remove out of scope division change in ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(). Simplify reference power calculation in computeTargetPSDs_direct_subframe_fx(). --- lib_dec/ivas_dirac_dec_fx.c | 2 + lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 52 +++++++++++++++---- lib_rend/ivas_dirac_rend_fx.c | 11 +++- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 283f607e0..48c00ed92 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3848,6 +3848,7 @@ void ivas_dirac_dec_render_sf_fx( 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) hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, exp ); @@ -3934,6 +3935,7 @@ void ivas_dirac_dec_render_sf_fx( } } #endif + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index b02d67702..6c77f12ff 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -314,6 +314,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( 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 ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -636,13 +637,13 @@ 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)*/ #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 Word32 *onset, /* i : onset filter Q31*/ const Word16 *azimuth, const Word16 *elevation, const Word32 *diffuseness, /* Q(q_diffuseness)*/ @@ -1954,7 +1955,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Word16 alphaMaxBinFast; Word32 L_tmp; Word16 exp_arr[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; -#if 0 +#if 1 Word16 exp = 0, exp1, tmp, q_com, q_tmp, min_exp; #else Word16 exp = 0, exp1, q_com, q_tmp, min_exp; @@ -2186,7 +2187,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = 0; move16(); -#if 0 +#if 1 tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 #else @@ -2328,6 +2329,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( 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++ ) @@ -2517,6 +2519,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( add( q_cy_auto_dir_smooth_prev_local[k], q_tmp ) ), Q31 ) ); #endif + *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp) move32(); *( p_gains_dir ) = L_shl_sat( *( p_gains_dir ), sub( h_dirac_output_synthesis_state->gains_dir_prev_q, sub( Q31, exp ) ) ); // gains_dir_prev_q @@ -4050,22 +4053,22 @@ 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) */ #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) */ + 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) */ + 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) */ + 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 */ @@ -4095,8 +4098,12 @@ static void computeTargetPSDs_direct_subframe_fx( Word16 *q_cy_cross_dir_smooth ) { Word16 ch_idx, cur_idx, i, q_tmp; +#ifdef FIX_867_CLDFB_NRG_SCALE + Word32 L_tmp[CLDFB_NO_CHANNELS_MAX]; +#else 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. */ @@ -4106,18 +4113,21 @@ static void computeTargetPSDs_direct_subframe_fx( { direct_power[i] = Mpy_32_32( direct_power_factor[i], reference_power[i] ); move32(); +#ifndef FIX_867_CLDFB_NRG_SCALE test(); if ( direct_power[i] == 0 && ( direct_power_factor[i] != 0 && reference_power[i] != 0 ) ) { direct_power[i] = 1; move32(); } +#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++ ) @@ -4139,26 +4149,41 @@ static void computeTargetPSDs_direct_subframe_fx( 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*/ + 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 + 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_reference_power[0], q_reference_power[1] ) ); q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp ); move16(); +#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; } @@ -4195,12 +4220,12 @@ 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) */ #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) */ + 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 */ @@ -4235,11 +4260,13 @@ static void computeTargetPSDs_diffuse_subframe_fx( 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 + assert( q_reference_power[0] <= q_reference_power[1] ); Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); q_cy_auto_diff_smooth_new = q_reference_power[0]; move16(); IF( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { + assert( *q_cy_auto_diff_smooth <= q_reference_power[0] ); Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; move16(); @@ -4253,6 +4280,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( #ifdef FIX_867_CLDFB_NRG_SCALE IF( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { + assert( q_reference_power[0] <= *q_cy_auto_diff_smooth ); Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *q_cy_auto_diff_smooth ) ); } #endif @@ -4266,6 +4294,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( *q_cy_auto_diff_smooth = *q_reference_power; move16(); #endif + return; } @@ -4316,6 +4345,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( move16(); } #endif + /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index a5a15ec99..18c9269d5 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1662,7 +1662,6 @@ void protoSignalComputation1_fx( 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(); @@ -1700,6 +1699,7 @@ void protoSignalComputation1_fx( move16(); } #endif + idx = 2 * l; p_proto_buffer_fx[idx] = RealBuffer_fx[0][0][l]; // q_cldfb move32(); @@ -1863,6 +1863,7 @@ void protoSignalComputation2_fx( *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 @@ -2782,6 +2783,7 @@ void protoSignalComputation2_fx( *q_reference_power = sub( add( q_reference_power_64fx, norm_shift ), 32 ); move16(); #endif + *q_proto_frame_f = add( q_cldfb, min_q_shift ); move16(); *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift ); @@ -2876,6 +2878,7 @@ void protoSignalComputation4_fx( 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 @@ -4275,6 +4278,7 @@ 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] ) ) { @@ -4326,6 +4330,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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 ); @@ -4611,6 +4616,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->masa_stereo_type_detect->q_subtract_power_y = s_min( hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); move16(); } + #ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, 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 ) Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + 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 ) @@ -4661,6 +4667,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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 hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, proto_power_diff_smooth_prev_temp_q ); @@ -4681,6 +4688,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( Scale_sig32( diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, 1 ); /*Buffer rescaling*/ + #ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, 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, 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 ) @@ -4716,6 +4724,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( 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, hSpatParamRendCom, -- GitLab From 5a376fef9d527defd6b5caf5f7b52ad7a8869bb2 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 13 Mar 2025 15:43:27 +0100 Subject: [PATCH 098/358] format (had failed despite being identical with main) --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 6c77f12ff..1692b1b0b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -637,13 +637,13 @@ 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)*/ #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 Word32 *onset, /* i : onset filter Q31*/ const Word16 *azimuth, const Word16 *elevation, const Word32 *diffuseness, /* Q(q_diffuseness)*/ @@ -4053,22 +4053,22 @@ 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) */ #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) */ + 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) */ + 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) */ + 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 */ @@ -4149,7 +4149,7 @@ static void computeTargetPSDs_direct_subframe_fx( 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*/ + 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 ); @@ -4164,8 +4164,8 @@ static void computeTargetPSDs_direct_subframe_fx( 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); + 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 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_reference_power[0], q_reference_power[1] ) ); q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp ); @@ -4220,12 +4220,12 @@ 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) */ #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) */ + 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 */ -- GitLab From d8e83fdebe3801b56625147534c4faa07444a521 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 09:16:55 +0100 Subject: [PATCH 099/358] added some comments for an easier review. --- lib_enc/ivas_sns_enc_fx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 7b1aa46de..4b171bdf0 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == Q15 ) + IF( exp_sns == 15 ) { Word16 index; const Word16 split_len = M / 2; @@ -72,20 +72,20 @@ static Word16 sns_1st_cod_fx( SWITCH( L_frame ) { case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; + means = &sns_1st_means_16k[core - 1][0]; // Q14 break; case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; + means = &sns_1st_means_25k6[core - 1][0]; // Q14 break; case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; + means = &sns_1st_means_32k[core - 1][0]; // Q14 break; default: assert( !"illegal frame length in sns_1st_cod" ); } FOR( Word16 i = 0; i < M; ++i ) { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 + Word32 tmp = L_mult( means[i], means_fix ); // Q14->Q16 snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -100,7 +100,7 @@ static Word16 sns_1st_cod_fx( Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; // Q12 j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); @@ -114,14 +114,14 @@ static Word16 sns_1st_cod_fx( { Word32 dist_fx = 0; move32(); - FOR( Word16 j = j0; j < j1; ++j ) + FOR( Word16 j = j0; j < j1; ++j ) // j1-j0=split_len. split_len=M/2. M=16 { Word32 tmp; Word32 dist; Word16 tmp2; - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 + dist = L_sub( snsq_fx[j], tmp ); // Q16 dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow tmp2 = extract_l( dist ); @@ -781,7 +781,7 @@ Word16 quantize_sns_fx( IF( zero_side_flag[k] ) { set32_fx( snsQ_fx, 0, M ); - CONTINUE; + continue; } nStages = SNS_MSVQ_NSTAGES_SIDE; -- GitLab From 86fa164c1590e85947839ecac8f1f458af4255b6 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 09:19:06 +0100 Subject: [PATCH 100/358] applied the formatting patch. --- lib_enc/ivas_sns_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 4b171bdf0..e981c338f 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -121,8 +121,8 @@ static Word16 sns_1st_cod_fx( Word16 tmp2; tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 - dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + dist = L_sub( snsq_fx[j], tmp ); // Q16 + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow tmp2 = extract_l( dist ); dist = L_mult( tmp2, tmp2 ); -- GitLab From 09de1b628265221b838c5565322dde8fed0e6a70 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 10:59:04 +0100 Subject: [PATCH 101/358] updated the style to the standard of the rest of the code. the magic shifts have been explained. total 150.00 603.963 644.322 631.525 --- lib_enc/ivas_sns_enc_fx.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index e981c338f..9396c4ede 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == 15 ) + IF( exp_sns == Q15 ) { Word16 index; const Word16 split_len = M / 2; @@ -118,15 +118,12 @@ static Word16 sns_1st_cod_fx( { Word32 tmp; Word32 dist; - Word16 tmp2; - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12->Q16 dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - - tmp2 = extract_l( dist ); - dist = L_mult( tmp2, tmp2 ); - dist = L_shr( dist, 4 ); // make sure that the sum does not overflow + dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. + dist = Mpy_32_32( dist, dist ); + dist = L_shr( dist, 3 ); // make sure that the sum of 8 values does not overflow dist_fx = L_add( dist_fx, dist ); } -- GitLab From 2fcbd3b31d85c9d7851d7af55adf98fd8361097f Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 11:11:27 +0100 Subject: [PATCH 102/358] applied the clang formatting patch. --- lib_enc/ivas_sns_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 9396c4ede..d9dea23b0 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -121,7 +121,7 @@ static Word16 sns_1st_cod_fx( tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12->Q16 dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. + dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. dist = Mpy_32_32( dist, dist ); dist = L_shr( dist, 3 ); // make sure that the sum of 8 values does not overflow dist_fx = L_add( dist_fx, dist ); -- GitLab From 2931b1d877bb33073dd9420816d69962c35f3ea2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 18 Mar 2025 10:02:06 +0530 Subject: [PATCH 103/358] Fix for 3GPP issue 1384: Decoder crash for Stereo at 16.4kbps in cng_params_upd_ivas_fx() Link #1384 --- lib_com/cng_exc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 4153afa32..ed94b1531 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -1166,7 +1166,7 @@ void cng_params_upd_ivas_fx( L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); - sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); + sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); move32(); /* Q6 */ ptR++; ptI--; -- GitLab From 5ad3ab89bdfc73c1b4f5256a5088e864012362cf Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Tue, 18 Mar 2025 15:30:28 +0100 Subject: [PATCH 104/358] Switch cleaned for fix 1386. --- lib_com/options.h | 6 +--- lib_enc/ivas_stat_enc.h | 4 +-- lib_enc/ivas_stereo_dmx_evs_fx.c | 50 ++++++++++++++++++-------------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9b5981930..41377f07a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,9 +174,5 @@ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ #define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ #define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ - -#define FIX_1386_STEREO_DMX_EVS_PHA /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA -#undef FIX_ISSUE_1153 /* With FIX_1386_STEREO_DMX_EVS_PHA, the FIX_ISSUE_1153 should not be activated. */ -#endif +#define NONBE_FIX_1386_STEREO_DMX_EVS_PHA /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */ #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 19f9a436e..ef278d188 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1183,7 +1183,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 @@ -1228,7 +1228,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 690e0b35e..933270c33 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -68,7 +68,7 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 @@ -161,7 +161,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ @@ -208,7 +208,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ @@ -621,7 +621,7 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) #else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) @@ -629,7 +629,7 @@ static void calc_poc_fx( { isd_cnt_h = add( isd_cnt_h, 1 ); } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 #else @@ -643,7 +643,7 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); #else @@ -651,7 +651,7 @@ static void calc_poc_fx( move16(); #endif -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) #else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) @@ -680,7 +680,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) #else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) @@ -752,7 +752,7 @@ static void calc_poc_fx( /* Energy */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) @@ -809,7 +809,7 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); @@ -857,7 +857,7 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); @@ -1076,17 +1076,17 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; -#ifdef FIX_ISSUE_1153 +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 #endif -#endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } @@ -1094,6 +1094,7 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); +#ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); IF( shift ) @@ -1103,20 +1104,25 @@ static void calc_poc_fx( move16(); } #endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA + energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); +#else #ifdef FIX_ISSUE_1153 energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); #else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 @@ -1223,7 +1229,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ @@ -1539,7 +1545,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ @@ -2084,7 +2090,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); @@ -2111,7 +2117,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; @@ -2143,7 +2149,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) #else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) @@ -2270,7 +2276,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; @@ -2510,7 +2516,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); -- GitLab From dba7d7b4f255481595450c51ee5bcbc557e3a25b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 19 Mar 2025 12:36:30 +0530 Subject: [PATCH 105/358] Fix for 3GPP issue 1408: Decoder crash for ParamMC 5.1 at 48/64/80 kbps decoding to mono in ivas_ls_setup_conversion_fx() Link #1408 --- lib_dec/ivas_jbm_dec_fx.c | 11 ----------- lib_dec/ivas_mc_param_dec_fx.c | 17 ++++++++++++----- lib_dec/ivas_out_setup_conversion_fx.c | 6 +++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index e7ee06648..1918ce3f3 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1288,18 +1288,7 @@ ivas_error ivas_jbm_dec_tc_fx( test(); IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - s = Q16 - Q11; - move16(); - s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, s ); - } ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); - } } } ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index db56ad03e..b2a8bd30b 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -123,7 +123,7 @@ ivas_error ivas_param_mc_dec_open_fx( Word16 nchan_out_transport; Word16 nchan_out_cov; Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 proto_mtx_norm_fx; + Word32 proto_mtx_norm_fx, tmp32; Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; Word16 max_param_band_residual; UWord16 config_index; @@ -374,20 +374,27 @@ ivas_error ivas_param_mc_dec_open_fx( Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, imult1616( nchan_out_transport, nchan_out_cov ), 4 ); /*Q.26*/ IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { - proto_mtx_norm_fx = ONE_IN_Q26; /*Q26*/ + tmp32 = ONE_IN_Q26; /*Q26*/ move32(); FOR( k = 0; k < nchan_transport * nchan_out_cov; k++ ) { - proto_mtx_norm_fx = L_max( L_abs( proto_mtx_norm_fx ), L_abs( proto_matrix_fx[k] ) ); /*Q.26*/ + tmp32 = L_max( L_abs( tmp32 ), L_abs( proto_matrix_fx[k] ) ); /*Q.26*/ } - proto_mtx_norm_fx = divide3232( ONE_IN_Q26, proto_mtx_norm_fx ); /*Q15*/ + proto_mtx_norm_fx = divide3232( ONE_IN_Q26, tmp32 ); /*Q15*/ /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ FOR( k = 0; k < nchan_transport; k++ ) { FOR( Word16 i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl( Mult_32_16( proto_matrix_fx[k * nchan_out_cov + i], extract_l( proto_mtx_norm_fx ) ), 4 ); /*Q.30*/ + IF( EQ_32( proto_matrix_fx[k * nchan_out_cov + i], tmp32 ) ) + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = ONE_IN_Q30; // Q30 + } + ELSE + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl( Mult_32_16( proto_matrix_fx[k * nchan_out_cov + i], extract_l( proto_mtx_norm_fx ) ), 4 ); /*Q.30*/ + } move32(); } } diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index c7bf0655d..756eed60e 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -586,14 +586,14 @@ void ivas_ls_setup_conversion_fx( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const Word16 input_chans, /* i : number of input channels to the renderer */ const Word16 output_frame, /* i : frame length */ - Word32 *input[], /* i : LS input/output synthesis signal Q16*/ - Word32 *output[] /* i/o: LS input/output synthesis signal Q16*/ + Word32 *input[], /* i : LS input/output synthesis signal Qx*/ + Word32 *output[] /* i/o: LS input/output synthesis signal Qx*/ ) { Word16 chInIdx, chOutIdx, idx; LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; Word32 dmxCoeff, tmpVal; - Word32 output_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // Q16 + Word32 output_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // Qx push_wmops( "LS_Renderer" ); -- GitLab From 241044c58c76d4a8aeaed13211b6cbfe95594ddb Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 19 Mar 2025 11:15:50 +0100 Subject: [PATCH 106/358] add missing move16(), move32(); don't change variable name to stay closer to float and the other variant --- lib_enc/ivas_sns_enc_fx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 7b1aa46de..2271b6ac6 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -96,7 +96,7 @@ static Word16 sns_1st_cod_fx( { const Word16 *cdbk_ptr; Word16 j0, j1; - Word16 dist_split; + Word16 index_split; Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); @@ -107,7 +107,7 @@ static Word16 sns_1st_cod_fx( cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; - dist_split = 0; + index_split = 0; move32(); move16(); FOR( Word16 i = 0; i < 32; ++i ) @@ -133,12 +133,14 @@ static Word16 sns_1st_cod_fx( IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; - dist_split = i; + move32(); + index_split = i; + move16(); } } /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 @@ -150,10 +152,10 @@ static Word16 sns_1st_cod_fx( /* for second split shift by five bits to store both indices as one 10 bit value */ if ( EQ_16( split, 1 ) ) { - dist_split = shl( dist_split, 5 ); + index_split = shl( index_split, 5 ); } - index = add( index, dist_split ); + index = add( index, index_split ); } return index; } -- GitLab From 67ba34472b700e514fd795ef6f95487b4f87182a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 19 Mar 2025 11:18:10 +0100 Subject: [PATCH 107/358] continue using CONTINUE instead of continue --- lib_enc/ivas_sns_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 88c2a5b7c..22cd98cad 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -780,7 +780,7 @@ Word16 quantize_sns_fx( IF( zero_side_flag[k] ) { set32_fx( snsQ_fx, 0, M ); - continue; + CONTINUE; } nStages = SNS_MSVQ_NSTAGES_SIDE; -- GitLab From 233e91e06ca68d137bb383e8c12427ec6623ef38 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 19 Mar 2025 16:27:22 +0100 Subject: [PATCH 108/358] Correct rescale buffer boundaries of proto_power_smooth_fx. --- lib_rend/ivas_dirac_rend_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 18c9269d5..503b1f3e8 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1815,9 +1815,10 @@ void protoSignalComputation2_fx( #ifdef FIX_867_CLDFB_NRG_SCALE IF( isloudspeaker ) { - q_shift = getScaleFactor32( proto_power_smooth_fx, CLDFB_NO_CHANNELS_HALF ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = getScaleFactor32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = - 2; scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 -- GitLab From f41bd4034140df724f20b323bb428b547ea1dd24 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 19 Mar 2025 16:37:34 +0100 Subject: [PATCH 109/358] Correct rescale buffer boundaries of proto_power_smooth_fx. Correction. --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 10 +--------- lib_rend/ivas_dirac_rend_fx.c | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 1692b1b0b..d88d83a93 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -1955,11 +1955,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Word16 alphaMaxBinFast; Word32 L_tmp; Word16 exp_arr[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; -#if 1 Word16 exp = 0, exp1, tmp, q_com, q_tmp, min_exp; -#else - Word16 exp = 0, exp1, q_com, q_tmp, min_exp; -#endif Word32 tmp32; move16(); @@ -2187,13 +2183,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = 0; move16(); -#if 1 + tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 -#else - L_tmp = BASOP_Util_Divide3232_Scale_cadence( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ - smoothedDirectionSmoothness = L_shl_sat( L_tmp, exp ); // Q31 -#endif h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] = smoothedDirectionSmoothness; // Q31 move32(); diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 503b1f3e8..006b53ec9 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1818,7 +1818,6 @@ void protoSignalComputation2_fx( q_shift = getScaleFactor32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - q_shift = - 2; scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 -- GitLab From 415682e308b8082a2ccdf70b594913c672da865f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 10:11:14 +0530 Subject: [PATCH 110/358] Fix for 3GPP issue 1409: Stereo Encoder: Differences in DTX for LTV 16 kHz signal Link #1409 --- lib_enc/cng_enc_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index b65d41403..f148d3e4c 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1876,7 +1876,7 @@ void CNG_enc_ivas_fx( { E_LPC_f_lsp_a_conversion( hDtxEnc->lspCNG_fx, Aq, M ); exp = sub( Q14, norm_s( Aq[0] ) ); - Scale_sig( Aq, M, sub( Q12, exp ) ); // Q12 + Scale_sig( Aq, M + 1, sub( Q12, exp ) ); // Q12 } tmp_loop = shr( st_fx->L_frame, 6 ); @@ -1986,19 +1986,19 @@ void CNG_enc_ivas_fx( move16(); BREAK; case L_FRAME32k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME32k_Q31; move16(); BREAK; case L_FRAME16k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME16k_Q31; move16(); BREAK; case L_FRAME8k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME8k_Q31; move16(); BREAK; case L_FRAME4k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME4k_Q31; move16(); BREAK; default: -- GitLab From 556608f757feebcf49295e970bdd086d6c42fcce Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 15:47:00 +0530 Subject: [PATCH 111/358] Bug fix in CNG_enc_ivas_fx, saturation removal and correction of macro value for MASA path --- lib_com/ivas_cnst.h | 2 +- lib_com/rom_com.c | 15 +++++++++++++++ lib_com/rom_com.h | 19 ++++++++++--------- lib_com/swb_tbe_com_fx.c | 2 +- lib_enc/cng_enc_fx.c | 8 ++++---- lib_enc/swb_tbe_enc_fx.c | 24 ++++++++++++------------ 6 files changed, 43 insertions(+), 27 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2abb790f1..9243b3f50 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1285,7 +1285,7 @@ enum #define MASA_RATIO_THRESHOLD 0.1f #define MASA_ANGLE_TOLERANCE 0.5f #define MASA_RATIO_THRESHOLD_FX 214748365 // 0.1 in Q31 -#define MASA_RATIO_TOLERANCE_FX 214748364/*0.1 Q30*/ +#define MASA_RATIO_TOLERANCE_FX 107374182 // 0.1 in Q30 #define MASA_ANGLE_TOLERANCE_FX ONE_IN_Q21 // 0.5 in Q22 #define MASA_LIMIT_NO_BANDS_SUR_COH 8 #define MINIMUM_BIT_BUDGET_NORMAL_META 100 diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 87b323d0a..e6f392ff0 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -25351,6 +25351,21 @@ const Word16 lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = { 13107, 14746 }; + +const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[LPC_SHB_ORDER] = { + // Q15 + 32767, + 31165, + 26509, + 19262, + 10123, + 0, + -10124, + -19261, + -26509, + -31166, +}; + const Word16 ivas_lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = { /* Q15 */ 1489, diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 10bce5bb2..73156b989 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1504,15 +1504,16 @@ extern const Word16 tab_hup_l_fx[]; // Q15 extern const Word16 mfreq_loc_Q2fx[]; // Q0 extern const Word16 mfreq_loc_div_25[]; // Q0 -extern const Word16 band_len_idx[]; // Q0 -extern const Word16 band_len_ener_shift[]; // Q0 -extern const Word16 fine_gain_pred_sqrt_bw[]; // Q11 -extern const Word16 ivas_band_len_idx[]; // Q0 -extern const Word16 ivas_band_len_ener_shift[]; // Q0 -extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; // Q11 -extern const Word16 Mean_isf_wb[]; // Q2.56 -extern const Word16 lsp_shb_prev_tbl_fx[]; // Q15 -extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; // Q15 +extern const Word16 band_len_idx[]; // Q0 +extern const Word16 band_len_ener_shift[]; // Q0 +extern const Word16 fine_gain_pred_sqrt_bw[]; // Q11 +extern const Word16 ivas_band_len_idx[]; // Q0 +extern const Word16 ivas_band_len_ener_shift[]; // Q0 +extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; // Q11 +extern const Word16 Mean_isf_wb[]; // Q2.56 +extern const Word16 lsp_shb_prev_tbl_fx[]; // Q15 +extern const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[]; // Q15 +extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; // Q15 extern const Word16 tab_ari_qnew[4][4]; // enhancer.c diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 238478b1a..04b6ba187 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -930,7 +930,7 @@ static void Calc_st_filt_tbe_ivas_enc_fx( { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } - g0 = extract_h( L_shl_sat( L_g0, 14 ) ); + g0 = extract_h( L_shl( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index b65d41403..99e99bef7 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1305,19 +1305,19 @@ void CNG_enc_ivas_fx( move16(); BREAK; case L_FRAME32k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME32k_Q31; move16(); BREAK; case L_FRAME16k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME16k_Q31; move16(); BREAK; case L_FRAME8k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME8k_Q31; move16(); BREAK; case L_FRAME4k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME4k_Q31; move16(); BREAK; default: diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index ba8ee5aa8..9b4f15dc5 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -21,7 +21,6 @@ #define ENVSHBRES_ACORR_MIN 40 /* minimum lag for calculating autocorrelation function on SHB residual TD envelope */ #define ENVSHBRES_ACORR_MAX 80 /* maximum lag for calculating autocorrelation function on SHB residual TD envelope */ - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -551,7 +550,7 @@ void InitSWBencBuffer_ivas_fx( FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { - hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_fx[i]; + hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_swb_tbe_enc_fx[i]; move16(); } @@ -3109,14 +3108,7 @@ void swb_tbe_enc_ivas_fx( } } - /* stab_check = a2lsp( lsf_shb, lpc_shb, LPC_SHB_ORDER ); - stab_check missing */ - /* LPC to LSP conversion */ - /* LPC: Q12, LSP: Q15 */ - E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); - - /* LSP to LSF conversion */ - /* LSP: Q15, LSF: Q15 */ - E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); + /* stab_check = a2lsp( lsf_shb, lpc_shb, LPC_SHB_ORDER ); */ test(); test(); @@ -3124,8 +3116,8 @@ void swb_tbe_enc_ivas_fx( { FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { - // hBWE_TD->prev_lsp_shb_fx[i] = i / 20.0f; - hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_fx[i]; + // hBWE_TD->prev_lsp_shb_fx[i] = i / 20.0f; // This value in float enc is lsf. + hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_swb_tbe_enc_fx[i]; // lsf converted to lsp as fixed enc stores lsp. move16(); } } @@ -3135,6 +3127,14 @@ void swb_tbe_enc_ivas_fx( // mvr2r( hBWE_TD->prev_lsp_shb, lsf_shb, LPC_SHB_ORDER ); // } + /* LPC to LSP conversion */ + /* LPC: Q12, LSP: Q15 */ + E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); + + /* LSP to LSF conversion */ + /* LSP: Q15, LSF: Q15 */ + E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); + Copy( lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); Copy( lsf_shb_fx, lsf_shb_orig_fx, LPC_SHB_ORDER ); -- GitLab From 15eeaa14adea56366265d954eab302a8b248fedd Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 18:50:36 +0530 Subject: [PATCH 112/358] Fix for 3GPP issue 1339: Artifact in IGF part for first active frame after DTX period in MDCT-Stereo Link #1339 --- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index b68578542..a73120286 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -360,6 +360,32 @@ void stereo_mdct_core_enc_fx( } q_spec = sub( Q31, q_spec ); + /*find headroom to increase precision*/ + Word16 hdrm_min = MAX_16; + move16(); + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + IF( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + { + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + } + ELSE + { + length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + } + FOR( k = 0; k <= ( ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV ) - 1; k++ ) + { + hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[k], length ) ); + hdrm_min = s_min( hdrm_min, L_norm_arr( mdst_spectrum_fx[ch][k], length ) ); + } + } + + IF( hdrm_min != 0 ) + { + q_spec = sub( add( hdrm_min, q_spec ), 1 ); /*1 guard bit to avoid over-flows*/ + } + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; -- GitLab From 3d8caf909acee8773088b0a5fa9363ece42c48e1 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Mar 2025 15:13:24 +0100 Subject: [PATCH 113/358] add COMPLEXITY/logs folder to artifacts --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91fbd0569..7a28b9871 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1748,6 +1748,7 @@ voip-be-on-merge-request: expire_in: 2 week paths: - $CI_JOB_NAME-public + - COMPLEXITY/logs complexity-stereo-in-stereo-out: extends: -- GitLab From 8cd0343d0ca9bf8a7b540a5b16c36c1c6f268701 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Mar 2025 16:02:06 +0100 Subject: [PATCH 114/358] remove log folder b4 running COMPLEXITY check this should avoid archiving any old logs in case not all of them are overwritten (e.g. when new modes are added) --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a28b9871..abd8e02ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1741,6 +1741,8 @@ voip-be-on-merge-request: - *update-ltv-repo - *build-float-ref-and-dut-binaries - *complexity-measurements-setup + # delete previous jobs logfiles if present (-f flag ensures return calue of 0 even in first run where this folder is not present) + - rm -rf COMPLEXITY/logs - which coan artifacts: name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" -- GitLab From 469ab4619d538f0df6037890fd6abfa8e8cadb48 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 10:39:39 +0100 Subject: [PATCH 115/358] - added some wmops push/pop, - added FIX_xxxx_SPEEDUP_00: not implemented, no bitstream - added FIX_xxxx_SPEEDUP_01: not implemented yet --- lib_com/basop_util.c | 6 +- lib_dec/ivas_jbm_dec_fx.c | 2 +- .../ivas_dirac_dec_binaural_functions_fx.c | 72 +++++++++++++++++-- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index b7ee35ab3..fa8d097df 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1010,6 +1010,7 @@ Word32 div_w( Word32 L_num, Word32 L_den ) } } + Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; @@ -1017,6 +1018,8 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; + //push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); + /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1038,6 +1041,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; + //pop_wmops(); return ( (Word32) 0 ); } @@ -1058,7 +1062,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - + //pop_wmops(); return z; } diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1918ce3f3..ce60c0d65 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1875,7 +1875,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - push_wmops( "ivas_dec_render" ); + push_wmops( "ivas_dec_render (IDR)" ); /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index b5dd1f8b9..8153775b7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,6 +45,9 @@ #include "wmc_auto.h" +//#define FIX_xxxx_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream +//#define FIX_xxxx_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui + Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -504,8 +507,9 @@ void ivas_dirac_dec_binaural_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - + pop_wmops();/*push_wmops( "IDR binaural internal (IDRBI)" );*/ FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -708,6 +712,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } } /* CLDFB Analysis of input */ + push_wmops( "IDRBI CLDFB ANALYSYS" ); FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) @@ -857,6 +862,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } } } + pop_wmops(); /*push_wmops( "IDRBI CLDFB ANALYSYS" );*/ test(); IF( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) @@ -921,7 +927,9 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); + push_wmops( "IDRBI cov matrices" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); + pop_wmops();/*push_wmops( "IDRBI cov matrices" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -959,7 +967,9 @@ static void ivas_dirac_dec_binaural_internal_fx( move16(); } + push_wmops( "IDRBI proc matrices (IRDBI pm)" ); ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); + pop_wmops(); /*push_wmops( "IDRBI proc matrices (IRDBI pm)" );*/ q_inp = Q6; move16(); @@ -1005,8 +1015,10 @@ static void ivas_dirac_dec_binaural_internal_fx( hDiracDecBin->q_processMtxDecPrev = q_mat; move16(); + push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); - + pop_wmops(); /*push_wmops( "IDRBI processOutput" ); + */ hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -1843,6 +1855,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); } + push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" ); FOR( bin = 0; bin < nBins; bin++ ) { Word32 tmpMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain_fx; @@ -1866,6 +1879,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_CrEne = Q31; move16(); + push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" ); IF( GT_16( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ) { hDiracDecBin->ChEne_fx[1][bin] = L_shr( hDiracDecBin->ChEne_fx[1][bin], sub( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ); @@ -1935,7 +1949,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->q_ChCrossOut, prototypeMtx_fx, Mre_fx, Mim_fx, &q_M, hDiracDecBin->reqularizationFactor_fx ); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" );*/ + push_wmops( "IDRBI pm LOOP1 sec B" ); IF( LT_16( hDiracDecBin->q_ChEne, hDiracDecBin->q_ChCross ) ) { CxRe_fx[0][0] = hDiracDecBin->ChEne_fx[0][bin]; @@ -1989,9 +2005,13 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( #endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec B" );*/ + /* When below the frequency limit where decorrelation is applied, we inject the decorrelated * residual (or missing) signal component. The procedure is active when there are not enough independent * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ + + push_wmops( "IDRBI pm LOOP1 sec C" ); IF( LT_16( bin, max_band_decorr ) ) { Word32 decorrelationReductionFactor_fx; @@ -2107,7 +2127,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_Mdec = Q31; move16(); } + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec C" );*/ + push_wmops( "IDRBI pm LOOP1 sec D" ); /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ tmp1 = L_add( CrEneL_fx, CrEneR_fx ); exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); @@ -2198,6 +2220,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_processMtxDec_bin = q_processMtxDec[bin]; move16(); move16(); + /* Store processing matrices */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -2232,7 +2255,10 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); q_processMtxDec[bin] = sub( q_Mdec, 16 ); move16(); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec D" );*/ + + push_wmops( "IDRBI pm LOOP1 sec E" ); IF( separateCenterChannelRendering ) { /* The rendering of the separate center channel in masa + mono mode. @@ -2322,7 +2348,10 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec E" );*/ } + pop_wmops(); /*push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" );*/ + /* Aligning Q-factors of all bins in the processing matrices to a common Q-factor */ minimum_s( q_processMtx, nBins, &hDiracDecBin->q_processMtx ); minimum_s( q_processMtxPrev, nBins, &hDiracDecBin->q_processMtxPrev ); @@ -2342,6 +2371,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( minimum_s( q_processMtxDec, nBins, &hDiracDecBin->q_processMtxDec ); minimum_s( q_processMtxDecPrev, nBins, &hDiracDecBin->q_processMtxDecPrev ); + push_wmops( "IRDBI pm LOOP2" ); FOR( bin = 0; bin < nBins; bin++ ) { FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2381,6 +2411,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } + pop_wmops(); /*push_wmops( "IRDBI pm LOOP2" );*/ return; } @@ -4354,7 +4385,9 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4377,9 +4410,12 @@ static void formulate2x2MixingMatrix_fx( Cout_im = Mpy_32_32( Cout_im, maxEneDiv_fx ); q_cout = sub( add( q_cout, q_maxEneDiv ), 31 ); + push_wmops( "formulate2x2MixingMatrix cholesky" ); /* Cholesky decomposition of target / output covariance matrix */ chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix cholesky" );*/ + push_wmops( "formulate2x2MixingMatrix Eigendecomp" ); /* Eigendecomposition of input covariance matrix */ eig2x2_fx( E_in1, E_in2, q_ein, Cin_re, Cin_im, q_cin, Uxre_fx, Uxim_fx, &q_Ux, Sx_fx, &q_Sx ); @@ -4397,7 +4433,9 @@ static void formulate2x2MixingMatrix_fx( move32(); matrixDiagMul_fx( Uxre_fx, Uxim_fx, q_Ux, Sx_fx, q_Sx, Kxre_fx, Kxim_fx, &q_Kx ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Eigendecomp" );*/ + push_wmops( "formulate2x2MixingMatrix RegSMInv" ); /* Regularize the diagonal Sx for matrix inversion */ Sx_fx[0] = L_max( L_shr( Sx_fx[0], 1 ), Mpy_32_16_1( Sx_fx[1], regularizationFactor_fx ) ); Sx_fx[1] = L_max( L_shr( Sx_fx[1], 1 ), L_shl( Mpy_32_16_1( Sx_fx[0], regularizationFactor_fx ), 1 ) ); @@ -4432,8 +4470,9 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp @@ -4469,8 +4508,9 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4487,7 +4527,9 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); + pop_wmops(); + push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" ); /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4513,17 +4555,29 @@ static void formulate2x2MixingMatrix_fx( move32(); } } + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); + push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ + push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ + push_wmops( "oPtoA MT1M" ); +#ifdef FIX_xxxx_SPEEDUP_01 + matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + + eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#endif + pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ IF( D_fx[0] == 0 ) { @@ -4537,8 +4591,10 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); exp = sub( exp, sub( Q30, q_D ) ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); @@ -4555,7 +4611,9 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4657,7 +4715,9 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ #if ( BINAURAL_CHANNELS != 2 ) FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4740,7 +4800,9 @@ static void formulate2x2MixingMatrix_fx( { Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); @@ -4811,6 +4873,8 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Mre_fx, Mim_fx, q_M ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" );*/ + return; } -- GitLab From 679ca05f9e94d39c8df4ff0a4b107b9fd89782bc Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 10:41:26 +0100 Subject: [PATCH 116/358] change names of macros from xxxx to 1326 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 8153775b7..716b16262 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,8 +45,8 @@ #include "wmc_auto.h" -//#define FIX_xxxx_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_xxxx_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui +//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream +//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -4568,7 +4568,7 @@ static void formulate2x2MixingMatrix_fx( /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); -#ifdef FIX_xxxx_SPEEDUP_01 +#ifdef FIX_1326_SPEEDUP_01 matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -- GitLab From 50fbdde0ea69c9e131293ad7a4abecf64498c847 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 16:56:36 +0100 Subject: [PATCH 117/358] added and activated FIX_1326_SPEEDUP_00 - 07 --- .../ivas_dirac_dec_binaural_functions_fx.c | 190 +++++++++++++++++- 1 file changed, 182 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 716b16262..d1fb6c23c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,8 +46,13 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui - +#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS +#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -3280,6 +3285,19 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) +#ifdef FIX_1326_SPEEDUP_02 + IF ( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) + { + Ure_fx[0][0] = ONE_IN_Q31; + move32(); + Ure_fx[1][1] = ONE_IN_Q31; + move32(); + *q_U = Q31; + move16(); + + return; + } +#else IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( D_fx[0], *q_D, EPSILON_MANT, EPSILON_EXP ), -1 ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3291,8 +3309,24 @@ static void eig2x2_fx( return; } +#endif /* Numeric case, when input is near an identity matrix with a gain */ +#ifdef FIX_1326_SPEEDUP_03 //178.932 + tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 + + IF( LT_32( pm_fx, L_shl_sat(tmp1, sub(q_tmp1,q_tmp2) ) ) ) + { + Ure_fx[0][0] = ONE_IN_Q30; + move32(); + Ure_fx[1][1] = ONE_IN_Q30; + move32(); + *q_U = Q30; + move16(); + + return; + } +#else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3323,6 +3357,7 @@ static void eig2x2_fx( return; } } +#endif q_U_1 = 0; q_U_2 = 0; @@ -3431,10 +3466,22 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + +#ifdef FIX_1326_SPEEDUP_04 + Word16 exp_tmp2; + Word32 eps_tmp; + + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); + eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); + + tmp3 = L_add( L_shr ( tmp2,1), L_shr(eps_tmp,1) ); // Add Epsilon if relevant + + exp_tmp3 = add(exp_tmp2 , 1); +#else 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 ); +#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); @@ -4387,7 +4434,7 @@ static void formulate2x2MixingMatrix_fx( { push_wmops( "formulate2x2MixingMatrix Division" ); maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4468,6 +4515,28 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE +#ifdef FIX_1326_SPEEDUP_05 + { + Word16 shift = norm_l( temp ); + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); + exp_temp = sub( 31, q_ein ); + if ( temp == 0 ) + { + exp_temp = EPSILON_EXP; + move32(); + } + if (temp == 0) + { + temp = EPSILON_MANT; + move32(); + } + temp = ISqrt32( temp , &exp_temp); + shift = sub( 31, q_eout ); + Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); + move32(); + exp = add( shift, exp_temp ); + } +#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4478,6 +4547,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } +#endif #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4506,16 +4576,36 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE +#ifdef FIX_1326_SPEEDUP_06 + { + Word16 shift = norm_l( temp ); + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); + exp_temp = sub(31, q_ein); + if ( temp == 0 ) + { + exp_temp = add( 0, EPSILON_EXP ); + } + if (temp == 0) + { + temp = L_add( 0, EPSILON_MANT ); + } + temp = ISqrt32( temp, &exp_temp ); + shift = sub( 31, q_eout ); + Ghat_fx[1] = Mpy_32_32( temp, ISqrt32( E_out2, &shift ) ); + exp_temp = add( shift, exp_temp ); + } +#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } +#endif #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4555,21 +4645,86 @@ static void formulate2x2MixingMatrix_fx( move32(); } } - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); #ifdef FIX_1326_SPEEDUP_01 - matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + + { + Word16 chA, chB; + { + chA = 0, chB = 0; + tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), + Are_fx[1][0], Are_fx[1][0] ), + Aim_fx[0][0], Aim_fx[0][0] ), + Aim_fx[1][0], Aim_fx[1][0] ); + move32(); + } + { + chA = 0, chB = 1; + tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), + Are_fx[1][1], Are_fx[1][0] ), + Aim_fx[0][1], Aim_fx[0][0] ), + Aim_fx[1][1], Aim_fx[1][0] ); + move32(); + tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), + Are_fx[1][1], Aim_fx[1][0] ), + Aim_fx[0][1], Are_fx[0][0] ), + Aim_fx[1][1], Are_fx[1][0] ); + move32(); + } + { + chA = 1, chB = 0; + tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), + Are_fx[1][1], Are_fx[1][1] ), + Aim_fx[0][1], Aim_fx[0][1] ), + Aim_fx[1][1], Aim_fx[1][1] ); + move32(); + } + { + chA = 1, chB = 1; + } + + q_temp = sub( add( q_A, q_A ), 31 ); + + move16(); + Word16 ZeroState = add( 1, 0 ); + if (tmpRe_fx[0][0] != 0) + { + ZeroState = add(0, 0); + } + if ( tmpRe_fx[1][1] != 0 ) + { + ZeroState = add( 0, 0 ); + } + if ( tmpRe_fx[1][0] != 0 ) + { + ZeroState = add( 0, 0 ); + } + if ( tmpIm_fx[1][0] != 0 ) + { + ZeroState = add( 0, 0 ); + } + + if ( sub(ZeroState,1) == 0 ) + { + q_temp = Q31; + move16(); + } + + } + eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); #else @@ -4579,6 +4734,24 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ +#ifdef FIX_1326_SPEEDUP_07 + IF( D_fx[0] == 0 ) + { + //temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + //exp = ONE_DIV_EPSILON_EXP; + div_fx[0] = L_add(0,2047986068); //Sqrt32( temp, &exp ); // Q = 31 - exp + exp = add(0,20); + } + ELSE + { + exp = sub( 31, q_D ); + div_fx[0] = ISqrt32( D_fx[0], &exp ); + //temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + //exp = sub( exp, sub( Q30, q_D ) ); + //div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); + } +#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4598,6 +4771,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); +#endif IF( D_fx[1] == 0 ) { -- GitLab From d12ec4121777398516e9a8bab2665f62e16c43c0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 16:32:41 +0100 Subject: [PATCH 118/358] apply clang patch --- lib_com/basop_util.c | 6 +- .../ivas_dirac_dec_binaural_functions_fx.c | 139 +++++++++--------- 2 files changed, 72 insertions(+), 73 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index fa8d097df..609ca234d 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1018,7 +1018,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; - //push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); + // push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1041,7 +1041,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; - //pop_wmops(); + // pop_wmops(); return ( (Word32) 0 ); } @@ -1062,7 +1062,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - //pop_wmops(); + // pop_wmops(); return z; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index d1fb6c23c..577ee62f7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -514,7 +514,7 @@ void ivas_dirac_dec_binaural_render_fx( Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - pop_wmops();/*push_wmops( "IDR binaural internal (IDRBI)" );*/ + pop_wmops(); /*push_wmops( "IDR binaural internal (IDRBI)" );*/ FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -934,7 +934,7 @@ static void ivas_dirac_dec_binaural_internal_fx( test(); push_wmops( "IDRBI cov matrices" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops();/*push_wmops( "IDRBI cov matrices" );*/ + pop_wmops(); /*push_wmops( "IDRBI cov matrices" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -1023,7 +1023,7 @@ static void ivas_dirac_dec_binaural_internal_fx( push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); pop_wmops(); /*push_wmops( "IDRBI processOutput" ); - */ + */ hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -3286,7 +3286,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) #ifdef FIX_1326_SPEEDUP_02 - IF ( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) + IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; move32(); @@ -3312,20 +3312,20 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 //178.932 +#ifdef FIX_1326_SPEEDUP_03 // 178.932 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 - IF( LT_32( pm_fx, L_shl_sat(tmp1, sub(q_tmp1,q_tmp2) ) ) ) - { - Ure_fx[0][0] = ONE_IN_Q30; - move32(); - Ure_fx[1][1] = ONE_IN_Q30; - move32(); - *q_U = Q30; - move16(); + IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) + { + Ure_fx[0][0] = ONE_IN_Q30; + move32(); + Ure_fx[1][1] = ONE_IN_Q30; + move32(); + *q_U = Q30; + move16(); - return; - } + return; + } #else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 @@ -3470,13 +3470,13 @@ static void eig2x2_fx( #ifdef FIX_1326_SPEEDUP_04 Word16 exp_tmp2; Word32 eps_tmp; - + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); - tmp3 = L_add( L_shr ( tmp2,1), L_shr(eps_tmp,1) ); // Add Epsilon if relevant + tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); // Add Epsilon if relevant - exp_tmp3 = add(exp_tmp2 , 1); + exp_tmp3 = add( exp_tmp2, 1 ); #else tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); q_tmp2 = sub( 31, q_tmp2 ); @@ -4525,17 +4525,17 @@ static void formulate2x2MixingMatrix_fx( exp_temp = EPSILON_EXP; move32(); } - if (temp == 0) + if ( temp == 0 ) { temp = EPSILON_MANT; move32(); } - temp = ISqrt32( temp , &exp_temp); + temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); move32(); exp = add( shift, exp_temp ); - } + } #else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); @@ -4580,12 +4580,12 @@ static void formulate2x2MixingMatrix_fx( { Word16 shift = norm_l( temp ); temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub(31, q_ein); + exp_temp = sub( 31, q_ein ); if ( temp == 0 ) { exp_temp = add( 0, EPSILON_EXP ); } - if (temp == 0) + if ( temp == 0 ) { temp = L_add( 0, EPSILON_MANT ); } @@ -4663,46 +4663,46 @@ static void formulate2x2MixingMatrix_fx( { Word16 chA, chB; - { + { chA = 0, chB = 0; - tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), - Are_fx[1][0], Are_fx[1][0] ), - Aim_fx[0][0], Aim_fx[0][0] ), - Aim_fx[1][0], Aim_fx[1][0] ); - move32(); - } - { - chA = 0, chB = 1; - tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), - Are_fx[1][1], Are_fx[1][0] ), - Aim_fx[0][1], Aim_fx[0][0] ), - Aim_fx[1][1], Aim_fx[1][0] ); - move32(); - tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), - Are_fx[1][1], Aim_fx[1][0] ), - Aim_fx[0][1], Are_fx[0][0] ), - Aim_fx[1][1], Are_fx[1][0] ); - move32(); - } - { - chA = 1, chB = 0; - tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), - Are_fx[1][1], Are_fx[1][1] ), - Aim_fx[0][1], Aim_fx[0][1] ), - Aim_fx[1][1], Aim_fx[1][1] ); - move32(); - } - { - chA = 1, chB = 1; - } + tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), + Are_fx[1][0], Are_fx[1][0] ), + Aim_fx[0][0], Aim_fx[0][0] ), + Aim_fx[1][0], Aim_fx[1][0] ); + move32(); + } + { + chA = 0, chB = 1; + tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), + Are_fx[1][1], Are_fx[1][0] ), + Aim_fx[0][1], Aim_fx[0][0] ), + Aim_fx[1][1], Aim_fx[1][0] ); + move32(); + tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), + Are_fx[1][1], Aim_fx[1][0] ), + Aim_fx[0][1], Are_fx[0][0] ), + Aim_fx[1][1], Are_fx[1][0] ); + move32(); + } + { + chA = 1, chB = 0; + tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), + Are_fx[1][1], Are_fx[1][1] ), + Aim_fx[0][1], Aim_fx[0][1] ), + Aim_fx[1][1], Aim_fx[1][1] ); + move32(); + } + { + chA = 1, chB = 1; + } q_temp = sub( add( q_A, q_A ), 31 ); move16(); Word16 ZeroState = add( 1, 0 ); - if (tmpRe_fx[0][0] != 0) + if ( tmpRe_fx[0][0] != 0 ) { - ZeroState = add(0, 0); + ZeroState = add( 0, 0 ); } if ( tmpRe_fx[1][1] != 0 ) { @@ -4717,12 +4717,11 @@ static void formulate2x2MixingMatrix_fx( ZeroState = add( 0, 0 ); } - if ( sub(ZeroState,1) == 0 ) + if ( sub( ZeroState, 1 ) == 0 ) { - q_temp = Q31; + q_temp = Q31; move16(); } - } @@ -4732,23 +4731,23 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); #endif - pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ + pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ #ifdef FIX_1326_SPEEDUP_07 IF( D_fx[0] == 0 ) { - //temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - //exp = ONE_DIV_EPSILON_EXP; - div_fx[0] = L_add(0,2047986068); //Sqrt32( temp, &exp ); // Q = 31 - exp - exp = add(0,20); + // temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + // exp = ONE_DIV_EPSILON_EXP; + div_fx[0] = L_add( 0, 2047986068 ); // Sqrt32( temp, &exp ); // Q = 31 - exp + exp = add( 0, 20 ); } ELSE { exp = sub( 31, q_D ); div_fx[0] = ISqrt32( D_fx[0], &exp ); - //temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - //exp = sub( exp, sub( Q30, q_D ) ); - //div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + // temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + // exp = sub( exp, sub( Q30, q_D ) ); + // div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); } #else @@ -4787,7 +4786,7 @@ static void formulate2x2MixingMatrix_fx( { push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4889,7 +4888,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ @@ -4976,7 +4975,7 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); -- GitLab From f12a124db1300a8f344276a4b674747fa464a264 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:04:07 +0100 Subject: [PATCH 119/358] added FIX_1326_SPEEDUP_08 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 577ee62f7..2dac2b867 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,6 +53,7 @@ #define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS #define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS #define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4772,6 +4773,20 @@ static void formulate2x2MixingMatrix_fx( move32(); #endif +#ifdef FIX_1326_SPEEDUP_08 + // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster + { + div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 + exp1 = add( 0, 20 ); // move32(); + } + + IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt + { + exp1 = sub( 31, q_D ); + div_fx[1] = ISqrt32( D_fx[1], &exp1 ); + move32(); + } +#else IF( D_fx[1] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4791,7 +4806,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 move32(); - +#endif q_div = sub( 31, s_max( exp, exp1 ) ); div_fx[0] = L_shr( div_fx[0], sub( sub( 31, exp ), q_div ) ); // q_div -- GitLab From 56305ddde36fee4fe6ecfb9e50494117be5a6c74 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:07:26 +0100 Subject: [PATCH 120/358] fixed warning --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 2dac2b867..7c243d7d8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3770,6 +3770,7 @@ static void matrixMul_fx( return; } +#ifndef FIX_1326_SPEEDUP_01 static void matrixTransp1Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -3883,6 +3884,7 @@ static void matrixTransp1Mul_fx( return; } +#endif /*FIX_1326_SPEEDUP_01*/ static void matrixTransp2Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4663,7 +4665,7 @@ static void formulate2x2MixingMatrix_fx( // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); { - Word16 chA, chB; + //Word16 chA, chB; { chA = 0, chB = 0; tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), @@ -4673,7 +4675,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 0, chB = 1; + //chA = 0, chB = 1; tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), Are_fx[1][1], Are_fx[1][0] ), Aim_fx[0][1], Aim_fx[0][0] ), @@ -4686,7 +4688,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 1, chB = 0; + //chA = 1, chB = 0; tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), Are_fx[1][1], Are_fx[1][1] ), Aim_fx[0][1], Aim_fx[0][1] ), @@ -4694,7 +4696,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 1, chB = 1; + //chA = 1, chB = 1; } q_temp = sub( add( q_A, q_A ), 31 ); -- GitLab From 4b66449d1b749bc14b31ea0e1ef9a1715ef29613 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:11:02 +0100 Subject: [PATCH 121/358] apply clang patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7c243d7d8..1544b4f1a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4665,7 +4665,7 @@ static void formulate2x2MixingMatrix_fx( // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); { - //Word16 chA, chB; + // Word16 chA, chB; { chA = 0, chB = 0; tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), @@ -4675,7 +4675,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 0, chB = 1; + // chA = 0, chB = 1; tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), Are_fx[1][1], Are_fx[1][0] ), Aim_fx[0][1], Aim_fx[0][0] ), @@ -4688,7 +4688,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 1, chB = 0; + // chA = 1, chB = 0; tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), Are_fx[1][1], Are_fx[1][1] ), Aim_fx[0][1], Aim_fx[0][1] ), @@ -4696,7 +4696,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 1, chB = 1; + // chA = 1, chB = 1; } q_temp = sub( add( q_A, q_A ), 31 ); -- GitLab From 03b77f5ce70483c1024a794f419882ab4a15a1bb Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 09:26:29 +0100 Subject: [PATCH 122/358] activated SPEEDUP8 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 1544b4f1a..f024f53ba 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,14 +46,14 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS -#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS +//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs +//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs! Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- -- GitLab From 86520445e6af996f9ead2625174d24694c6d8ae8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 11:13:06 +0100 Subject: [PATCH 123/358] activate SPEEDUP 07 small version --- .../ivas_dirac_dec_binaural_functions_fx.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f024f53ba..c452437f1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -52,8 +52,8 @@ //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS //#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs! +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs , no replacement of divSqrt +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4746,12 +4746,18 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32( D_fx[0], &exp ); - // temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - // exp = sub( exp, sub( Q30, q_D ) ); - // div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp +#if 1 //old code + push_wmops( "formulate2x2MixingMatrix Division" ); + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + exp = sub( exp, sub( Q30, q_D ) ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); +#else + exp = sub(31, q_D); + div_fx[0] = ISqrt32_2( D_fx[0], &exp ); move32(); +#endif } #else IF( D_fx[0] == 0 ) -- GitLab From 12809f5b6359704415a114ddde609e193c899283 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 11:18:14 +0100 Subject: [PATCH 124/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index c452437f1..1e37860c9 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4746,18 +4746,18 @@ static void formulate2x2MixingMatrix_fx( } ELSE { -#if 1 //old code +#if 1 // old code push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); #else - exp = sub(31, q_D); + exp = sub( 31, q_D ); div_fx[0] = ISqrt32_2( D_fx[0], &exp ); move32(); -#endif +#endif } #else IF( D_fx[0] == 0 ) -- GitLab From 9028c88021ef93cc2cfadb421f1db6be435a788c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 12:22:09 +0100 Subject: [PATCH 125/358] activated speedup 01 02 03 04 --- .../ivas_dirac_dec_binaural_functions_fx.c | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 1e37860c9..06b5be3ee 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,14 +46,14 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs , no replacement of divSqrt -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! +#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4521,8 +4521,12 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_05 { Word16 shift = norm_l( temp ); +#if 1 // oldcode + temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); +#else + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31, q_ein ); + exp_temp = sub( 30, q_ein ); if ( temp == 0 ) { exp_temp = EPSILON_EXP; @@ -4533,6 +4537,7 @@ static void formulate2x2MixingMatrix_fx( temp = EPSILON_MANT; move32(); } +#endif temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); @@ -4582,8 +4587,11 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_06 { Word16 shift = norm_l( temp ); +#if 0 //oldcode + temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); +#else temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31, q_ein ); + exp_temp = sub( 31 - 1, q_ein ); if ( temp == 0 ) { exp_temp = add( 0, EPSILON_EXP ); @@ -4592,10 +4600,22 @@ static void formulate2x2MixingMatrix_fx( { temp = L_add( 0, EPSILON_MANT ); } +#endif +#if 1 //oldcode - new code introduces too much noise + push_wmops( "formulate2x2MixingMatrix Division" ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); +#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC + Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 +#endif +#else temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); - Ghat_fx[1] = Mpy_32_32( temp, ISqrt32( E_out2, &shift ) ); - exp_temp = add( shift, exp_temp ); + Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); + exp1 = add( shift, exp_temp ); +#endif + } #else { -- GitLab From 90d2563bf00e217b994ad64a27421f37adb0b628 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 12:35:34 +0100 Subject: [PATCH 126/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 06b5be3ee..5fcc8a2d1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -54,6 +54,7 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE #define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE +#define FIX_1326_SPEEDUP_09 // Relocate matrixMul Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4587,7 +4588,7 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_06 { Word16 shift = norm_l( temp ); -#if 0 //oldcode +#if 0 // oldcode temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); #else temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); @@ -4601,7 +4602,7 @@ static void formulate2x2MixingMatrix_fx( temp = L_add( 0, EPSILON_MANT ); } #endif -#if 1 //oldcode - new code introduces too much noise +#if 1 // oldcode - new code introduces too much noise push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ @@ -4614,8 +4615,7 @@ static void formulate2x2MixingMatrix_fx( shift = sub( 31, q_eout ); Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); exp1 = add( shift, exp_temp ); -#endif - +#endif } #else { @@ -4749,10 +4749,17 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#ifdef FIX_1326_SPEEDUP_09 + matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif #else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); + +#ifdef FIX_1326_SPEEDUP_09 + matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4860,7 +4867,9 @@ static void formulate2x2MixingMatrix_fx( move16(); } +#ifndef FIX_1326_SPEEDUP_09 matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif exp = L_norm_arr( div_fx, BINAURAL_CHANNELS ); scale_sig32( div_fx, BINAURAL_CHANNELS, exp ); -- GitLab From 33a98171ada436d22c6f538c5ad3dbefd93bebb0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 14:30:57 +0100 Subject: [PATCH 127/358] activate speedup 09 10 11 for testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 80 ++++++++++++++----- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 5fcc8a2d1..e99cb6b34 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,16 +45,25 @@ #include "wmc_auto.h" -//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE -#define FIX_1326_SPEEDUP_09 // Relocate matrixMul +// MHZ NUMBERS: +// NULL: 179.292 + + +//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence --> DONT USE +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS +//#define FIX_1326_SPEEDUP_14 // Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -2142,6 +2151,14 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); +#ifdef FIX_1326_SPEEDUP_11 + { + Word16 shift1 = s_max( 0, sub( q_tmp2, q_CrEne ) ); + Word16 shift2 = s_max( 0, sub( q_CrEne, q_tmp2 ) ); + realizedOutputEne_fx = L_add( L_shr( tmp1, shift2 ), L_shr( tmp2, shift1 ) ); + q_realizedOutputEne = s_min( q_CrEne, q_tmp2 ); + } +#else IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2154,7 +2171,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_realizedOutputEne = q_tmp2; move16(); } - +#endif exp = sub( get_min_scalefactor( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_fx[1][bin] ), 1 ); targetOutputEne_fx = L_add( L_shl( hDiracDecBin->ChEneOut_fx[0][bin], exp ), L_shl( hDiracDecBin->ChEneOut_fx[1][bin], exp ) ); q_targetOutputEne = add( hDiracDecBin->q_ChEneOut, exp ); @@ -2177,9 +2194,17 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_missingOutputEne = q_targetOutputEne; move16(); } - tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); +#ifdef FIX_1326_SPEEDUP_13 + { + Word16 exp_temp; + tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + tmp2 = ISqrt32( tmp2, &exp_temp ); + gain_fx = Mpy_32_32(tmp2, Sqrt32(tmp1, &exp1)); + q_gain = sub( 31, add( exp_temp, exp1 ) ); + } +#else { Word16 exp_temp; tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); @@ -2188,6 +2213,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } gain_fx = Sqrt32( tmp2, &exp2 ); q_gain = sub( 31, exp2 ); +#endif + // 1073741824 = 4 in Q28 IF( LT_16( q_gain, Q28 ) ) @@ -4749,17 +4776,11 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#ifdef FIX_1326_SPEEDUP_09 - matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif #else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#ifdef FIX_1326_SPEEDUP_09 - matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4849,7 +4870,19 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = L_shr( div_fx[1], sub( sub( 31, exp1 ), q_div ) ); // q_div move32(); + // 1310720000 = 10,000.0f in Q17 +#ifdef FIX_1326_SPEEDUP_09 + { + Word16 shift1 = s_max( sub( Q17, q_div ), 0 ); + Word16 shift2 = s_max( sub( q_div, Q17 ), 0 ); + + div_fx[0] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[0], shift2 ) ); // q_div + move32(); + div_fx[1] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[1], shift2 ) ); // q_div + move32(); + } +#else IF( LT_16( q_div, Q17 ) ) { div_fx[0] = L_min( L_shr( 1310720000, sub( Q17, q_div ) ), div_fx[0] ); // q_div @@ -4866,10 +4899,9 @@ static void formulate2x2MixingMatrix_fx( q_div = Q17; move16(); } +#endif -#ifndef FIX_1326_SPEEDUP_09 matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif exp = L_norm_arr( div_fx, BINAURAL_CHANNELS ); scale_sig32( div_fx, BINAURAL_CHANNELS, exp ); @@ -4884,7 +4916,11 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpRe_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { +#ifdef FIX_1326_SPEEDUP_10 + hdrm_re[chA][chB] = W_norm( W_tmp ); +#else hdrm_re[chA][chB] = sub( W_norm( W_tmp ), 0 ); +#endif move16(); W_tmp = W_shl( W_tmp, hdrm_re[chA][chB] ); tmpRe_fx[chA][chB] = W_extract_h( W_tmp ); @@ -4901,7 +4937,11 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpIm_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { +#ifdef FIX_1326_SPEEDUP_10 + hdrm_im[chA][chB] = W_norm( W_tmp ); +#else hdrm_im[chA][chB] = sub( W_norm( W_tmp ), 0 ); +#endif move16(); W_tmp = W_shl( W_tmp, hdrm_im[chA][chB] ); tmpIm_fx[chA][chB] = W_extract_h( W_tmp ); -- GitLab From 1a23f8d8deb4ce90aeac714fd274f3fa6c380f16 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 14:56:15 +0100 Subject: [PATCH 128/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e99cb6b34..2336151e0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -58,12 +58,12 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS //#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE //#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -//#define FIX_1326_SPEEDUP_14 // +//#define FIX_1326_SPEEDUP_14 // Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -2201,7 +2201,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( Word16 exp_temp; tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); tmp2 = ISqrt32( tmp2, &exp_temp ); - gain_fx = Mpy_32_32(tmp2, Sqrt32(tmp1, &exp1)); + gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); q_gain = sub( 31, add( exp_temp, exp1 ) ); } #else @@ -2214,7 +2214,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( gain_fx = Sqrt32( tmp2, &exp2 ); q_gain = sub( 31, exp2 ); #endif - + // 1073741824 = 4 in Q28 IF( LT_16( q_gain, Q28 ) ) -- GitLab From c8151a8382939a33af975c6c5bf7e192030fcc10 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 15:33:23 +0100 Subject: [PATCH 129/358] added assert testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 2336151e0..cc6d977f0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -58,12 +58,12 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -//#define FIX_1326_SPEEDUP_14 // +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -->USE? (pipe coming) +#define FIX_1326_SPEEDUP_14 // test Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -3213,8 +3213,14 @@ static void eig2x2_fx( pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ + #ifdef FIX_1326_SPEEDUP_14 + static int tstcnt = 0; + #endif IF( L_and( c_re == 0, c_im == 0 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt ++; +#endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 pm_fx = 0.5 * sqrt(max(0, a_fx)) = 0.5 * max(0, (e1 - e2)) */ @@ -3232,6 +3238,9 @@ static void eig2x2_fx( q_crossSquare = sub( add( q_c, q_c ), 31 ); IF( EQ_32( e1, e2 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt++; +#endif /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ test(); @@ -3265,6 +3274,9 @@ static void eig2x2_fx( IF( GT_16( sub( q_c, q_e ), Q15 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt++; +#endif pm_fx = L_shr( L_max( 0, L_abs( L_sub( e1, e2 ) ) ), 1 ); q_tmp2 = q_e; move16(); @@ -3288,6 +3300,10 @@ static void eig2x2_fx( } } } +#ifdef FIX_1326_SPEEDUP_14 + if (tstcnt>10000) + assert(0); +#endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); q_tmp1 = q_e; @@ -4669,7 +4685,6 @@ static void formulate2x2MixingMatrix_fx( move32(); pop_wmops(); - push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" ); /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4695,14 +4710,11 @@ static void formulate2x2MixingMatrix_fx( move32(); } } - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); - push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx @@ -4980,7 +4992,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );*/ push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ -- GitLab From c6d0d7dab2acc799534d4a284cf603826d37460c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 15:35:49 +0100 Subject: [PATCH 130/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index cc6d977f0..c5b3500b2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3213,13 +3213,13 @@ static void eig2x2_fx( pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ - #ifdef FIX_1326_SPEEDUP_14 +#ifdef FIX_1326_SPEEDUP_14 static int tstcnt = 0; - #endif +#endif IF( L_and( c_re == 0, c_im == 0 ) ) { #ifdef FIX_1326_SPEEDUP_14 - tstcnt ++; + tstcnt++; #endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 @@ -3301,8 +3301,8 @@ static void eig2x2_fx( } } #ifdef FIX_1326_SPEEDUP_14 - if (tstcnt>10000) - assert(0); + if ( tstcnt > 10000 ) + assert( 0 ); #endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); -- GitLab From 2986c80dd253c39ee60868f08bd0e89d2b64a683 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 09:52:48 +0100 Subject: [PATCH 131/358] deactivate SPeedup 14, activate Speedup 13 for testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 75 +++++++++++++++---- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index c5b3500b2..ad9769583 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -49,7 +49,6 @@ // NULL: 179.292 -//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence --> DONT USE //#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE @@ -58,12 +57,18 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -->USE? (pipe coming) -#define FIX_1326_SPEEDUP_14 // test +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) +//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) + + + + Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -943,9 +948,9 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); - push_wmops( "IDRBI cov matrices" ); + push_wmops( "IDRBI cov matrices (IDRBCM)" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops(); /*push_wmops( "IDRBI cov matrices" );*/ + pop_wmops(); /*push_wmops( "IDRBI cov matrices (IDRBCM)" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -1168,7 +1173,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ move16(); - + push_wmops( "IDRBCM inits" ); q_earlyPartEneCorrection = s_min( Q31, add( getScaleFactor32( hDiracDecBin->earlyPartEneCorrection_fx, nBins ), hDiracDecBin->q_earlyPartEneCorrection ) ); scale_sig32( hDiracDecBin->earlyPartEneCorrection_fx, nBins, sub( q_earlyPartEneCorrection, hDiracDecBin->q_earlyPartEneCorrection ) ); hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; @@ -1202,6 +1207,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ move16(); } + pop_wmops(); /*push_wmops( "IDRBCM inits" );*/ /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; @@ -1214,11 +1220,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { + push_wmops( "IDRBCM Determine EQ_low_rates" ); FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 move32(); } + pop_wmops(); /*push_wmops( "IDRBCM Determine EQ_low_rates" );*/ } ELSE { @@ -1237,6 +1245,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric exp = sub( 63, shl( q, 1 ) ); // exp for the energy (inRe_fx * inRe_fx + inIm_fx * inIm_fx) computed below + push_wmops( "IDRBCM input Matrix" ); /* Calculate input covariance matrix */ FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -1271,7 +1280,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); } } + pop_wmops(); /*push_wmops( "IDRBCM input Matrix" );*/ + push_wmops( "IDRBCM apply EQ_low" ); /* Apply EQ at low bit rates */ IF( applyLowBitRateEQ != 0 ) { @@ -1324,7 +1335,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } } + pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ + push_wmops( "IDRBCM target matrix" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1484,12 +1497,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 hrtfEneCenter_fx, hrtfEneSides_fx, hrtfEneRealized_fx; Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; - +#ifdef FIX_1326_SPEEDUP_15 + hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); //Q25 +#else hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 - +#endif /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. * spreadCoh = 0: Only panning @@ -1518,11 +1533,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); - +#ifdef FIX_1326_SPEEDUP_15 + hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 +#else hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 +#endif lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 @@ -1610,12 +1628,21 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); } +#ifdef FIX_1326_SPEEDUP_15 + hrtfEne_fx[0] = Madd_32_32( Mpy_32_32( lRealp_fx, lRealp_fx ), lImagp_fx, lImagp_fx ); // Q( 2*q_lr - 31 ) + hrtfEne_fx[1] = Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) + move32(); + move32(); + hrtfCrossRe_fx = Madd_32_32( Mpy_32_32( lRealp_fx, rRealp_fx ), lImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) + hrtfCrossIm_fx = Madd_32_32( Mpy_32_32( -lImagp_fx, rRealp_fx ), lRealp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) +#else hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) move32(); move32(); hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) +#endif /* Add direct part (1 or 2) covariance matrix */ dirEne_fx = Mpy_32_32( ratio_fx, meanEnePerCh_fx ); // Q(q_meanEnePerCh - 1) @@ -1690,7 +1717,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } ELSE { +#ifdef FIX_1326_SPEEDUP_15 + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( Madd_32_16( L_shl( surCoh_fx, 16 ), hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); +#else hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); +#endif } move32(); } @@ -1706,6 +1737,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } + pop_wmops();/*push_wmops( "IDRBCM target matrix" );*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -3435,10 +3467,25 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + +#ifdef FIX_1326_SPEEDUP_16 + + { + Word16 tmp2_exp; + Word32 eps_tmp; + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); + + //Add epsilon if relevant + eps_tmp = L_shl_sat( epsilon_mant, sub(epsilon_exp, tmp2_exp )); + tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); + + exp_tmp3 = add( tmp2_exp, 1 ); + } +#else 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 ); +#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -- GitLab From fb3e05c804ec9194ab97c64ce3769c51424ae600 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 09:54:39 +0100 Subject: [PATCH 132/358] deactivate SPeedup 14, activate Speedup 13 for testing --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index ad9769583..620b4e323 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -61,7 +61,7 @@ //#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) //#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) //#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) -- GitLab From 52740b20377af49c2a78be634f9adf9112b934fa Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 10:09:06 +0100 Subject: [PATCH 133/358] apply clang format patch --- .../ivas_dirac_dec_binaural_functions_fx.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 620b4e323..7721c3eaa 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -67,8 +67,6 @@ //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) - - Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -1498,12 +1496,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; #ifdef FIX_1326_SPEEDUP_15 - hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); //Q25 + hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); // Q25 #else - hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 - L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 - L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 - Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 #endif /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. @@ -1536,15 +1534,15 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #ifdef FIX_1326_SPEEDUP_15 hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 #else - hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 - L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 - L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 - Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 #endif - lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 - lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 - rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 - rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ @@ -1737,7 +1735,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops();/*push_wmops( "IDRBCM target matrix" );*/ + pop_wmops(); /*push_wmops( "IDRBCM target matrix" );*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -3475,12 +3473,12 @@ static void eig2x2_fx( Word32 eps_tmp; tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); - //Add epsilon if relevant - eps_tmp = L_shl_sat( epsilon_mant, sub(epsilon_exp, tmp2_exp )); + // Add epsilon if relevant + eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, tmp2_exp ) ); tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); exp_tmp3 = add( tmp2_exp, 1 ); - } + } #else tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); q_tmp2 = sub( 31, q_tmp2 ); -- GitLab From deae6b08447d0260424ce2f4b4d8455a94172ed5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 10:15:25 +0100 Subject: [PATCH 134/358] fix build warning --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7721c3eaa..4db8980e1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1916,7 +1916,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); Word32 tmp1, tmp2, res1, res2; Word16 q_tmp1, q_tmp2, q_realizedOutputEne, q_targetOutputEne, q_missingOutputEne, q_gain; +#ifdef FIX_1326_SPEEDUP_13 + Word16 exp1, q_processMtx_bin, q_processMtxDec_bin; +#else Word16 exp1, exp2, q_processMtx_bin, q_processMtxDec_bin; +#endif CrEneL_fx = 0; move32(); -- GitLab From 2248f4d1a256b06ffc8e850d8f3c368a1be827e7 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 11:08:02 +0100 Subject: [PATCH 135/358] ctivated speedup 15, 16 to test --- .../ivas_dirac_dec_binaural_functions_fx.c | 118 +----------------- 1 file changed, 6 insertions(+), 112 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 4db8980e1..45e1d2bed 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,18 +53,14 @@ //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE //#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) -//#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) -//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -3246,15 +3242,8 @@ static void eig2x2_fx( a_fx = (e1 + e2) * (e1 + e2) - 4.0f * ((e1 * e2) - crossSquare_fx) = (e1 - e2)^2 + 4 * crossSquare_fx pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ - -#ifdef FIX_1326_SPEEDUP_14 - static int tstcnt = 0; -#endif IF( L_and( c_re == 0, c_im == 0 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 pm_fx = 0.5 * sqrt(max(0, a_fx)) = 0.5 * max(0, (e1 - e2)) */ @@ -3272,9 +3261,6 @@ static void eig2x2_fx( q_crossSquare = sub( add( q_c, q_c ), 31 ); IF( EQ_32( e1, e2 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ test(); @@ -3308,9 +3294,6 @@ static void eig2x2_fx( IF( GT_16( sub( q_c, q_e ), Q15 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif pm_fx = L_shr( L_max( 0, L_abs( L_sub( e1, e2 ) ) ), 1 ); q_tmp2 = q_e; move16(); @@ -3334,10 +3317,6 @@ static void eig2x2_fx( } } } -#ifdef FIX_1326_SPEEDUP_14 - if ( tstcnt > 10000 ) - assert( 0 ); -#endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); q_tmp1 = q_e; @@ -4611,33 +4590,6 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE -#ifdef FIX_1326_SPEEDUP_05 - { - Word16 shift = norm_l( temp ); -#if 1 // oldcode - temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#else - - temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 30, q_ein ); - if ( temp == 0 ) - { - exp_temp = EPSILON_EXP; - move32(); - } - if ( temp == 0 ) - { - temp = EPSILON_MANT; - move32(); - } -#endif - temp = ISqrt32( temp, &exp_temp ); - shift = sub( 31, q_eout ); - Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); - move32(); - exp = add( shift, exp_temp ); - } -#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4648,7 +4600,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } -#endif + #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4677,39 +4629,6 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE -#ifdef FIX_1326_SPEEDUP_06 - { - Word16 shift = norm_l( temp ); -#if 0 // oldcode - temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#else - temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31 - 1, q_ein ); - if ( temp == 0 ) - { - exp_temp = add( 0, EPSILON_EXP ); - } - if ( temp == 0 ) - { - temp = L_add( 0, EPSILON_MANT ); - } -#endif -#if 1 // oldcode - new code introduces too much noise - push_wmops( "formulate2x2MixingMatrix Division" ); - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ - exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif -#else - temp = ISqrt32( temp, &exp_temp ); - shift = sub( 31, q_eout ); - Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); - exp1 = add( shift, exp_temp ); -#endif - } -#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4720,7 +4639,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } -#endif + #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4845,30 +4764,6 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ -#ifdef FIX_1326_SPEEDUP_07 - IF( D_fx[0] == 0 ) - { - // temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - // exp = ONE_DIV_EPSILON_EXP; - div_fx[0] = L_add( 0, 2047986068 ); // Sqrt32( temp, &exp ); // Q = 31 - exp - exp = add( 0, 20 ); - } - ELSE - { -#if 1 // old code - push_wmops( "formulate2x2MixingMatrix Division" ); - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ - div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp - move32(); -#else - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32_2( D_fx[0], &exp ); - move32(); -#endif - } -#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4888,7 +4783,6 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#endif #ifdef FIX_1326_SPEEDUP_08 // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster -- GitLab From 7263a7eebb093028a1980e52b0b2db57ea6182fb Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:26:44 +0100 Subject: [PATCH 136/358] add SPEEDUP 17, 18, inactive --- .../ivas_dirac_dec_binaural_functions_fx.c | 73 +++++++++++++++---- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 45e1d2bed..3a10590f6 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -49,19 +49,20 @@ // NULL: 179.292 -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) - +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? +//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -3343,6 +3344,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) + #ifdef FIX_1326_SPEEDUP_02 IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { @@ -3370,7 +3372,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 // 178.932 +#ifdef FIX_1326_SPEEDUP_03 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) @@ -3469,7 +3471,11 @@ static void eig2x2_fx( #endif #if 1 +#ifdef FIX_1326_SPEEDUP_17 + tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); +#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); +#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3557,7 +3563,11 @@ static void eig2x2_fx( #endif #if 1 +#ifdef FIX_1326_SPEEDUP_17 + tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); +#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); +#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3619,7 +3629,19 @@ static void eig2x2_fx( move16(); } } +#ifdef FIX_1326_SPEEDUP_18 + if( q_U_1 != 0 ) + { + *q_U = q_U_1; + move16(); + } + if (q_U_1 == 0) + { + *q_U = q_U_2; + move16(); + } +#else IF( q_U_1 != 0 ) { *q_U = q_U_1; @@ -3629,6 +3651,7 @@ static void eig2x2_fx( *q_U = q_U_2; } move16(); +#endif return; } @@ -4508,7 +4531,11 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, maxEne_fx, &exp ); +#else maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } @@ -4630,6 +4657,11 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + if ( E_out2 == 0 ) + { + static int a = 0; + a++; + } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); @@ -4777,7 +4809,12 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); +#else + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); +#endif exp = sub( exp, sub( Q30, q_D ) ); pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } @@ -4811,7 +4848,11 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[1], &exp1 ); +#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } @@ -5021,7 +5062,11 @@ static void formulate2x2MixingMatrix_fx( Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, temp, &exp ); +#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); -- GitLab From f2a018b19a1fe121adfedb8c38abe8f8bf8c3604 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:41:59 +0100 Subject: [PATCH 137/358] add modified version of division '1/x' --- lib_com/basop_util.c | 35 +++++++++++++++++++++++++++++++++++ lib_com/basop_util.h | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 609ca234d..0449ff125 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1066,6 +1066,41 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) return z; } +/*1bit HR in x > 0*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) +{ + Word32 z; + //Word16 sx; + Word16 sy; + Word32 sign; + + /* assert (x >= (Word32)0); */ + assert( y != (Word32) 0 ); + + sign = 0; + move16(); + + IF( y < 0 ) + { + y = L_negate( y ); + sign = L_xor( sign, 1 ); + } + + sy = norm_l( y ); + y = L_shl( y, sy ); + move16(); + *s = add( 0, sy ); + move16(); + + z = div_w( x, y ); + + if ( sign != 0 ) + { + z = L_negate( z ); + } + return z; + +} Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { Word16 z; diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index a6db7dc8d..697f0b9c6 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,6 +332,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ + Word32 y, /*!< i : Denominator*/ + + Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! -- GitLab From bdab4c96801c4c19d454e6d280ccc0cbf73752b1 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:46:15 +0100 Subject: [PATCH 138/358] applied clang format patch --- lib_com/basop_util.c | 3 +-- lib_com/basop_util.h | 6 +++--- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 0449ff125..5eee369f8 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1070,7 +1070,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) { Word32 z; - //Word16 sx; + // Word16 sx; Word16 sy; Word32 sign; @@ -1099,7 +1099,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) z = L_negate( z ); } return z; - } Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index 697f0b9c6..1ef2cd8e7 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,10 +332,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ - Word32 y, /*!< i : Denominator*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ + Word32 y, /*!< i : Denominator*/ - Word16 *s ); /*!< o : Additional scalefactor difference*/ + Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 3a10590f6..399ac50ca 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3372,7 +3372,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 +#ifdef FIX_1326_SPEEDUP_03 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) @@ -3630,13 +3630,13 @@ static void eig2x2_fx( } } #ifdef FIX_1326_SPEEDUP_18 - if( q_U_1 != 0 ) + if ( q_U_1 != 0 ) { *q_U = q_U_1; move16(); } - if (q_U_1 == 0) + if ( q_U_1 == 0 ) { *q_U = q_U_2; move16(); @@ -4812,7 +4812,7 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_17 temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); #else - + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); #endif exp = sub( exp, sub( Q30, q_D ) ); -- GitLab From 0fb2d30b8285abdbc76468fc43848939f863a03c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:47:08 +0100 Subject: [PATCH 139/358] activated SPEEDUP 17, 18, for test --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 399ac50ca..682a881cd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -61,8 +61,8 @@ //#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? -//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? +#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From 73f2a5078c6fd02f318924c41ebb28d74ab3abf7 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:35:17 +0100 Subject: [PATCH 140/358] Activate all SPEEDUP macros available and change division 1/x a bit --- lib_com/basop_util.c | 8 +++-- .../ivas_dirac_dec_binaural_functions_fx.c | 35 ++++++++++--------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 5eee369f8..60174c3c9 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1080,12 +1080,16 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) sign = 0; move16(); - IF( y < 0 ) + if( y < 0 ) { - y = L_negate( y ); sign = L_xor( sign, 1 ); } + if ( y < 0 ) + { + y = L_negate( y ); + } + sy = norm_l( y ); y = L_shl( y, sy ); move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 682a881cd..f3e6b54d6 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,23 +46,24 @@ #include "wmc_auto.h" // MHZ NUMBERS: -// NULL: 179.292 - - -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? +// NULL: 178.407 +// ALL: 169.499 + + +#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From f2b3f155d5d77c922553381a7659f1452230a77f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 10:33:50 +0100 Subject: [PATCH 141/358] deactivate 1/x macro, activate all others --- lib_com/basop_util.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 60174c3c9..273667255 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1080,7 +1080,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) sign = 0; move16(); - if( y < 0 ) + if ( y < 0 ) { sign = L_xor( sign, 1 ); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f3e6b54d6..333e7603a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -62,7 +62,7 @@ #define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE +//#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE #define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From d4f5a9acea1e0583a3f4f4ffd2b6e4d2af7a7dec Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:46:33 +0000 Subject: [PATCH 142/358] revert divison variation --- lib_com/basop_util.c | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 273667255..b7ee35ab3 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1010,7 +1010,6 @@ Word32 div_w( Word32 L_num, Word32 L_den ) } } - Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; @@ -1018,8 +1017,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; - // push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); - /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1041,7 +1038,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; - // pop_wmops(); return ( (Word32) 0 ); } @@ -1062,48 +1058,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - // pop_wmops(); - return z; -} - -/*1bit HR in x > 0*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) -{ - Word32 z; - // Word16 sx; - Word16 sy; - Word32 sign; - /* assert (x >= (Word32)0); */ - assert( y != (Word32) 0 ); - - sign = 0; - move16(); - - if ( y < 0 ) - { - sign = L_xor( sign, 1 ); - } - - if ( y < 0 ) - { - y = L_negate( y ); - } - - sy = norm_l( y ); - y = L_shl( y, sy ); - move16(); - *s = add( 0, sy ); - move16(); - - z = div_w( x, y ); - - if ( sign != 0 ) - { - z = L_negate( z ); - } return z; } + Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { Word16 z; -- GitLab From cb8c3aa9793f09e28933e9ca9de5da91447c425b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:47:44 +0000 Subject: [PATCH 143/358] more revert division variation --- lib_com/basop_util.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index 1ef2cd8e7..a6db7dc8d 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,10 +332,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ - Word32 y, /*!< i : Denominator*/ - - Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! -- GitLab From a0f0eac658a432e0bba4ec28c6db3350bdde6f7b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 11:51:31 +0100 Subject: [PATCH 144/358] cleanup useless speedup macros --- .../ivas_dirac_dec_binaural_functions_fx.c | 123 +++--------------- 1 file changed, 15 insertions(+), 108 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 333e7603a..8da4f82e7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -47,22 +47,16 @@ // MHZ NUMBERS: // NULL: 178.407 -// ALL: 169.499 +// ALL: 169.499 77 (170.650 wo 17) #define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE #define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET #define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE -#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE #define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -1333,7 +1327,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ - push_wmops( "IDRBCM target matrix" ); + push_wmops( "IDRBCM target matrix (IDRBCMtm)" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1359,6 +1353,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( q_meanEnePerCh ) q_meanEnePerCh = add( sub( q_earlyPartEneCorrection, subFrameTotalEne_e[bin] ), 1 ); // q_earlyPartEneCorrection + 31 - subFrameTotalEne_e[bin] - 31 + Q1(0.5f) /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + push_wmops( "IDRBCMtm LOOP1" ); FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { Word16 aziDeg, eleDeg; @@ -1437,6 +1432,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness_fx = 0; move32(); } + IF( isIsmDirection ) { /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ @@ -1446,7 +1442,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, ratio_fx ); /*Q30*/ } - IF( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -1493,14 +1488,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 hrtfEneCenter_fx, hrtfEneSides_fx, hrtfEneRealized_fx; Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; -#ifdef FIX_1326_SPEEDUP_15 - hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); // Q25 -#else + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 -#endif + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. * spreadCoh = 0: Only panning @@ -1529,14 +1522,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); -#ifdef FIX_1326_SPEEDUP_15 - hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 -#else + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 -#endif + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 @@ -1624,21 +1615,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); } -#ifdef FIX_1326_SPEEDUP_15 - hrtfEne_fx[0] = Madd_32_32( Mpy_32_32( lRealp_fx, lRealp_fx ), lImagp_fx, lImagp_fx ); // Q( 2*q_lr - 31 ) - hrtfEne_fx[1] = Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) - move32(); - move32(); - hrtfCrossRe_fx = Madd_32_32( Mpy_32_32( lRealp_fx, rRealp_fx ), lImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) - hrtfCrossIm_fx = Madd_32_32( Mpy_32_32( -lImagp_fx, rRealp_fx ), lRealp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) -#else hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) move32(); move32(); hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) -#endif /* Add direct part (1 or 2) covariance matrix */ dirEne_fx = Mpy_32_32( ratio_fx, meanEnePerCh_fx ); // Q(q_meanEnePerCh - 1) @@ -1655,6 +1637,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } + pop_wmops(); //push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 @@ -1713,11 +1696,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } ELSE { -#ifdef FIX_1326_SPEEDUP_15 - hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( Madd_32_16( L_shl( surCoh_fx, 16 ), hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); -#else hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); -#endif } move32(); } @@ -1733,7 +1712,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM target matrix" );*/ + pop_wmops(); /*push_wmops( "IDRBCM target matrix (IDRBCMtm)" );;*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -2183,14 +2162,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); -#ifdef FIX_1326_SPEEDUP_11 - { - Word16 shift1 = s_max( 0, sub( q_tmp2, q_CrEne ) ); - Word16 shift2 = s_max( 0, sub( q_CrEne, q_tmp2 ) ); - realizedOutputEne_fx = L_add( L_shr( tmp1, shift2 ), L_shr( tmp2, shift1 ) ); - q_realizedOutputEne = s_min( q_CrEne, q_tmp2 ); - } -#else + IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2203,7 +2175,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_realizedOutputEne = q_tmp2; move16(); } -#endif + exp = sub( get_min_scalefactor( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_fx[1][bin] ), 1 ); targetOutputEne_fx = L_add( L_shl( hDiracDecBin->ChEneOut_fx[0][bin], exp ), L_shl( hDiracDecBin->ChEneOut_fx[1][bin], exp ) ); q_targetOutputEne = add( hDiracDecBin->q_ChEneOut, exp ); @@ -3373,21 +3345,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 - tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 - IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) - { - Ure_fx[0][0] = ONE_IN_Q30; - move32(); - Ure_fx[1][1] = ONE_IN_Q30; - move32(); - *q_U = Q30; - move16(); - - return; - } -#else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3418,7 +3376,6 @@ static void eig2x2_fx( return; } } -#endif q_U_1 = 0; q_U_2 = 0; @@ -3472,11 +3429,7 @@ static void eig2x2_fx( #endif #if 1 -#ifdef FIX_1326_SPEEDUP_17 - tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); -#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3564,11 +3517,7 @@ static void eig2x2_fx( #endif #if 1 -#ifdef FIX_1326_SPEEDUP_17 - tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); -#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -4531,13 +4480,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, maxEne_fx, &exp ); -#else maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4620,9 +4563,7 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp @@ -4664,9 +4605,7 @@ static void formulate2x2MixingMatrix_fx( a++; } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4797,6 +4736,7 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ + IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4804,20 +4744,15 @@ static void formulate2x2MixingMatrix_fx( exp = sub( exp, sub( Q30, 62 ) ); #else temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + move32(); exp = ONE_DIV_EPSILON_EXP; + move16(); #endif } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); -#else - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); -#endif exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); @@ -4848,13 +4783,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[1], &exp1 ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4869,17 +4798,6 @@ static void formulate2x2MixingMatrix_fx( // 1310720000 = 10,000.0f in Q17 -#ifdef FIX_1326_SPEEDUP_09 - { - Word16 shift1 = s_max( sub( Q17, q_div ), 0 ); - Word16 shift2 = s_max( sub( q_div, Q17 ), 0 ); - - div_fx[0] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[0], shift2 ) ); // q_div - move32(); - div_fx[1] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[1], shift2 ) ); // q_div - move32(); - } -#else IF( LT_16( q_div, Q17 ) ) { div_fx[0] = L_min( L_shr( 1310720000, sub( Q17, q_div ) ), div_fx[0] ); // q_div @@ -4896,7 +4814,6 @@ static void formulate2x2MixingMatrix_fx( q_div = Q17; move16(); } -#endif matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); @@ -4913,11 +4830,7 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpRe_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { -#ifdef FIX_1326_SPEEDUP_10 - hdrm_re[chA][chB] = W_norm( W_tmp ); -#else hdrm_re[chA][chB] = sub( W_norm( W_tmp ), 0 ); -#endif move16(); W_tmp = W_shl( W_tmp, hdrm_re[chA][chB] ); tmpRe_fx[chA][chB] = W_extract_h( W_tmp ); @@ -5062,13 +4975,7 @@ static void formulate2x2MixingMatrix_fx( { Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, temp, &exp ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); -- GitLab From f97ec39f828d4e605dcca2ed09a3bf3d3cce0f44 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 11:54:30 +0100 Subject: [PATCH 145/358] apply clang format patch --- .../ivas_dirac_dec_binaural_functions_fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 8da4f82e7..101f76a37 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1489,10 +1489,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; - hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 - L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 - L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 - Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. @@ -1523,10 +1523,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); - hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 - L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 - L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 - Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 @@ -1637,7 +1637,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } - pop_wmops(); //push_wmops( "IDRBCMtm LOOP1" ); + pop_wmops(); // push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 -- GitLab From 1d475785f8351fd7f3fa6f8021878273a945563e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 12:00:04 +0100 Subject: [PATCH 146/358] deactivate all speedups --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 101f76a37..4a55a37cc 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -50,14 +50,14 @@ // ALL: 169.499 77 (170.650 wo 17) -#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From cc08c7185e22852fd126643e5ba085e19571e393 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 12:16:25 +0000 Subject: [PATCH 147/358] cleaup a bit --- .../ivas_dirac_dec_binaural_functions_fx.c | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 4a55a37cc..ce36e0ae3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1432,7 +1432,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness_fx = 0; move32(); } - IF( isIsmDirection ) { /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ @@ -1442,6 +1441,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, ratio_fx ); /*Q30*/ } + IF( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -1527,11 +1527,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 - - lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 - lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 - rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 - rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ @@ -2162,7 +2161,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); - IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2198,6 +2196,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_missingOutputEne = q_targetOutputEne; move16(); } + tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); #ifdef FIX_1326_SPEEDUP_13 @@ -2258,7 +2257,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_processMtxDec_bin = q_processMtxDec[bin]; move16(); move16(); - /* Store processing matrices */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -3216,6 +3214,7 @@ static void eig2x2_fx( a_fx = (e1 + e2) * (e1 + e2) - 4.0f * ((e1 * e2) - crossSquare_fx) = (e1 - e2)^2 + 4 * crossSquare_fx pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ + IF( L_and( c_re == 0, c_im == 0 ) ) { /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 @@ -3345,7 +3344,6 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ - tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3425,6 +3423,7 @@ static void eig2x2_fx( #else 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 ); #endif @@ -3513,6 +3512,7 @@ static void eig2x2_fx( #else 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 ); #endif @@ -4563,13 +4563,13 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } - #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4599,19 +4599,14 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - if ( E_out2 == 0 ) - { - static int a = 0; - a++; - } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } - #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4796,7 +4791,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = L_shr( div_fx[1], sub( sub( 31, exp1 ), q_div ) ); // q_div move32(); - // 1310720000 = 10,000.0f in Q17 IF( LT_16( q_div, Q17 ) ) { -- GitLab From 4f33c171f1892b375ef96274ab4ada09801f2509 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 13:54:05 +0100 Subject: [PATCH 148/358] activate the big chunks - SPEEDUP 8, 13 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index ce36e0ae3..f63f27eb0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,8 +53,8 @@ //#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE //#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE -- GitLab From 4c1d9288ffd0180ca25a2b0f083d3adf4770accb Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 14:32:17 +0100 Subject: [PATCH 149/358] activated spedups 1 , 2, 4, 16, 18 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f63f27eb0..7dee99218 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -50,14 +50,14 @@ // ALL: 169.499 77 (170.650 wo 17) -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE #define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -4618,7 +4618,7 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); - pop_wmops(); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix RegSMInv" );*/ /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) -- GitLab From 9c07d08c9a8733f22592fb9146b9563e089f45c9 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 15:56:56 +0100 Subject: [PATCH 150/358] rename optimiztion macros, move macros to options.h --- lib_com/options.h | 3 + .../ivas_dirac_dec_binaural_functions_fx.c | 140 +----------------- 2 files changed, 11 insertions(+), 132 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ccaeca46a..ab7efb8fd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,4 +176,7 @@ #define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ #define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ #define NONBE_FIX_1386_STEREO_DMX_EVS_PHA /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */ +#define FIX_1326_SUBSTITUTE_CMPMANT32EXP /* FhG: Minor WMOPS tuning*/ +#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT /* FhG: WMOPS tuning */ +#define FIX_1326_SPEEDUP_eig2x2_fx /* FhG: Minor WMOPS tuning*/ #endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7dee99218..7f2c6b4d4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,18 +46,6 @@ #include "wmc_auto.h" // MHZ NUMBERS: -// NULL: 178.407 -// ALL: 169.499 77 (170.650 wo 17) - - -#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -1892,11 +1880,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); Word32 tmp1, tmp2, res1, res2; Word16 q_tmp1, q_tmp2, q_realizedOutputEne, q_targetOutputEne, q_missingOutputEne, q_gain; -#ifdef FIX_1326_SPEEDUP_13 - Word16 exp1, q_processMtx_bin, q_processMtxDec_bin; -#else Word16 exp1, exp2, q_processMtx_bin, q_processMtxDec_bin; -#endif CrEneL_fx = 0; move32(); @@ -2199,13 +2183,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); -#ifdef FIX_1326_SPEEDUP_13 +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT { - Word16 exp_temp; - tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - tmp2 = ISqrt32( tmp2, &exp_temp ); + tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp2 ); + tmp2 = ISqrt32( tmp2, &exp2 ); gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); - q_gain = sub( 31, add( exp_temp, exp1 ) ); + q_gain = sub( 31, add( exp2, exp1 ) ); } #else { @@ -3317,7 +3300,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) -#ifdef FIX_1326_SPEEDUP_02 +#ifdef FIX_1326_SUBSTITUTE_CMPMANT32EXP IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3406,27 +3389,10 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - -#ifdef FIX_1326_SPEEDUP_16 - - { - Word16 tmp2_exp; - Word32 eps_tmp; - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); - - // Add epsilon if relevant - eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, tmp2_exp ) ); - tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); - - exp_tmp3 = add( tmp2_exp, 1 ); - } -#else 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 ); -#endif - #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); @@ -3499,22 +3465,10 @@ static void eig2x2_fx( q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); -#ifdef FIX_1326_SPEEDUP_04 - Word16 exp_tmp2; - Word32 eps_tmp; - - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); - eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); - - tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); // Add Epsilon if relevant - - exp_tmp3 = add( exp_tmp2, 1 ); -#else 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 ); -#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); @@ -3815,7 +3769,6 @@ static void matrixMul_fx( return; } -#ifndef FIX_1326_SPEEDUP_01 static void matrixTransp1Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -3929,7 +3882,6 @@ static void matrixTransp1Mul_fx( return; } -#endif /*FIX_1326_SPEEDUP_01*/ static void matrixTransp2Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4655,80 +4607,10 @@ static void formulate2x2MixingMatrix_fx( /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); -#ifdef FIX_1326_SPEEDUP_01 - // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); - - { - // Word16 chA, chB; - { - chA = 0, chB = 0; - tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), - Are_fx[1][0], Are_fx[1][0] ), - Aim_fx[0][0], Aim_fx[0][0] ), - Aim_fx[1][0], Aim_fx[1][0] ); - move32(); - } - { - // chA = 0, chB = 1; - tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), - Are_fx[1][1], Are_fx[1][0] ), - Aim_fx[0][1], Aim_fx[0][0] ), - Aim_fx[1][1], Aim_fx[1][0] ); - move32(); - tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), - Are_fx[1][1], Aim_fx[1][0] ), - Aim_fx[0][1], Are_fx[0][0] ), - Aim_fx[1][1], Are_fx[1][0] ); - move32(); - } - { - // chA = 1, chB = 0; - tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), - Are_fx[1][1], Are_fx[1][1] ), - Aim_fx[0][1], Aim_fx[0][1] ), - Aim_fx[1][1], Aim_fx[1][1] ); - move32(); - } - { - // chA = 1, chB = 1; - } - - q_temp = sub( add( q_A, q_A ), 31 ); - - move16(); - Word16 ZeroState = add( 1, 0 ); - if ( tmpRe_fx[0][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpRe_fx[1][1] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpRe_fx[1][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpIm_fx[1][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - - if ( sub( ZeroState, 1 ) == 0 ) - { - q_temp = Q31; - move16(); - } - } - - - eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4753,11 +4635,9 @@ static void formulate2x2MixingMatrix_fx( move32(); #ifdef FIX_1326_SPEEDUP_08 - // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster - { - div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 - exp1 = add( 0, 20 ); // move32(); - } + //Sqrt(1) + div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 + exp1 = add( 0, 20 ); IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt { @@ -4841,11 +4721,7 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpIm_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { -#ifdef FIX_1326_SPEEDUP_10 - hdrm_im[chA][chB] = W_norm( W_tmp ); -#else hdrm_im[chA][chB] = sub( W_norm( W_tmp ), 0 ); -#endif move16(); W_tmp = W_shl( W_tmp, hdrm_im[chA][chB] ); tmpIm_fx[chA][chB] = W_extract_h( W_tmp ); -- GitLab From 596a724fac86c406dc66f1a2353bddeaff67a42f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 15:06:07 +0000 Subject: [PATCH 151/358] fix: rename some mocros Cleanup: push/pop wmops --- .../ivas_dirac_dec_binaural_functions_fx.c | 67 ++----------------- 1 file changed, 6 insertions(+), 61 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7f2c6b4d4..e8052b08c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,8 +45,6 @@ #include "wmc_auto.h" -// MHZ NUMBERS: - Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -506,9 +504,8 @@ void ivas_dirac_dec_binaural_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - pop_wmops(); /*push_wmops( "IDR binaural internal (IDRBI)" );*/ + FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -711,7 +708,6 @@ static void ivas_dirac_dec_binaural_internal_fx( } } /* CLDFB Analysis of input */ - push_wmops( "IDRBI CLDFB ANALYSYS" ); FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) @@ -861,7 +857,6 @@ static void ivas_dirac_dec_binaural_internal_fx( } } } - pop_wmops(); /*push_wmops( "IDRBI CLDFB ANALYSYS" );*/ test(); IF( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) @@ -926,9 +921,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); - push_wmops( "IDRBI cov matrices (IDRBCM)" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops(); /*push_wmops( "IDRBI cov matrices (IDRBCM)" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -966,9 +959,7 @@ static void ivas_dirac_dec_binaural_internal_fx( move16(); } - push_wmops( "IDRBI proc matrices (IRDBI pm)" ); ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); - pop_wmops(); /*push_wmops( "IDRBI proc matrices (IRDBI pm)" );*/ q_inp = Q6; move16(); @@ -1014,10 +1005,8 @@ static void ivas_dirac_dec_binaural_internal_fx( hDiracDecBin->q_processMtxDecPrev = q_mat; move16(); - push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); - pop_wmops(); /*push_wmops( "IDRBI processOutput" ); - */ + hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -1151,7 +1140,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ move16(); - push_wmops( "IDRBCM inits" ); + q_earlyPartEneCorrection = s_min( Q31, add( getScaleFactor32( hDiracDecBin->earlyPartEneCorrection_fx, nBins ), hDiracDecBin->q_earlyPartEneCorrection ) ); scale_sig32( hDiracDecBin->earlyPartEneCorrection_fx, nBins, sub( q_earlyPartEneCorrection, hDiracDecBin->q_earlyPartEneCorrection ) ); hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; @@ -1185,7 +1174,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ move16(); } - pop_wmops(); /*push_wmops( "IDRBCM inits" );*/ /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; @@ -1198,13 +1186,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { - push_wmops( "IDRBCM Determine EQ_low_rates" ); FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM Determine EQ_low_rates" );*/ } ELSE { @@ -1223,7 +1209,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric exp = sub( 63, shl( q, 1 ) ); // exp for the energy (inRe_fx * inRe_fx + inIm_fx * inIm_fx) computed below - push_wmops( "IDRBCM input Matrix" ); /* Calculate input covariance matrix */ FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -1258,9 +1243,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); } } - pop_wmops(); /*push_wmops( "IDRBCM input Matrix" );*/ - push_wmops( "IDRBCM apply EQ_low" ); /* Apply EQ at low bit rates */ IF( applyLowBitRateEQ != 0 ) { @@ -1313,9 +1296,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } } - pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ - push_wmops( "IDRBCM target matrix (IDRBCMtm)" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1341,7 +1322,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( q_meanEnePerCh ) q_meanEnePerCh = add( sub( q_earlyPartEneCorrection, subFrameTotalEne_e[bin] ), 1 ); // q_earlyPartEneCorrection + 31 - subFrameTotalEne_e[bin] - 31 + Q1(0.5f) /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - push_wmops( "IDRBCMtm LOOP1" ); FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { Word16 aziDeg, eleDeg; @@ -1624,7 +1604,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } - pop_wmops(); // push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 @@ -1699,7 +1678,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM target matrix (IDRBCMtm)" );;*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -1865,7 +1843,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); } - push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" ); FOR( bin = 0; bin < nBins; bin++ ) { Word32 tmpMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain_fx; @@ -1889,7 +1866,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_CrEne = Q31; move16(); - push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" ); IF( GT_16( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ) { hDiracDecBin->ChEne_fx[1][bin] = L_shr( hDiracDecBin->ChEne_fx[1][bin], sub( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ); @@ -1959,9 +1935,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->q_ChCrossOut, prototypeMtx_fx, Mre_fx, Mim_fx, &q_M, hDiracDecBin->reqularizationFactor_fx ); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" );*/ - push_wmops( "IDRBI pm LOOP1 sec B" ); IF( LT_16( hDiracDecBin->q_ChEne, hDiracDecBin->q_ChCross ) ) { CxRe_fx[0][0] = hDiracDecBin->ChEne_fx[0][bin]; @@ -2015,13 +1989,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( #endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec B" );*/ - /* When below the frequency limit where decorrelation is applied, we inject the decorrelated * residual (or missing) signal component. The procedure is active when there are not enough independent * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ - - push_wmops( "IDRBI pm LOOP1 sec C" ); IF( LT_16( bin, max_band_decorr ) ) { Word32 decorrelationReductionFactor_fx; @@ -2137,9 +2107,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_Mdec = Q31; move16(); } - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec C" );*/ - push_wmops( "IDRBI pm LOOP1 sec D" ); /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ tmp1 = L_add( CrEneL_fx, CrEneR_fx ); exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); @@ -2274,10 +2242,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); q_processMtxDec[bin] = sub( q_Mdec, 16 ); move16(); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec D" );*/ - - push_wmops( "IDRBI pm LOOP1 sec E" ); IF( separateCenterChannelRendering ) { /* The rendering of the separate center channel in masa + mono mode. @@ -2367,10 +2332,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec E" );*/ } - pop_wmops(); /*push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" );*/ - /* Aligning Q-factors of all bins in the processing matrices to a common Q-factor */ minimum_s( q_processMtx, nBins, &hDiracDecBin->q_processMtx ); minimum_s( q_processMtxPrev, nBins, &hDiracDecBin->q_processMtxPrev ); @@ -2390,7 +2352,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( minimum_s( q_processMtxDec, nBins, &hDiracDecBin->q_processMtxDec ); minimum_s( q_processMtxDecPrev, nBins, &hDiracDecBin->q_processMtxDecPrev ); - push_wmops( "IRDBI pm LOOP2" ); FOR( bin = 0; bin < nBins; bin++ ) { FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2430,7 +2391,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } - pop_wmops(); /*push_wmops( "IRDBI pm LOOP2" );*/ return; } @@ -3393,6 +3353,7 @@ static void eig2x2_fx( q_tmp2 = sub( 31, q_tmp2 ); tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); + #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); @@ -3464,7 +3425,6 @@ static void eig2x2_fx( 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 ); @@ -3533,7 +3493,7 @@ static void eig2x2_fx( move16(); } } -#ifdef FIX_1326_SPEEDUP_18 +#ifdef FIX_1326_SPEEDUP_eig2x2_fx if ( q_U_1 != 0 ) { *q_U = q_U_1; @@ -4455,12 +4415,9 @@ static void formulate2x2MixingMatrix_fx( Cout_im = Mpy_32_32( Cout_im, maxEneDiv_fx ); q_cout = sub( add( q_cout, q_maxEneDiv ), 31 ); - push_wmops( "formulate2x2MixingMatrix cholesky" ); /* Cholesky decomposition of target / output covariance matrix */ chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix cholesky" );*/ - push_wmops( "formulate2x2MixingMatrix Eigendecomp" ); /* Eigendecomposition of input covariance matrix */ eig2x2_fx( E_in1, E_in2, q_ein, Cin_re, Cin_im, q_cin, Uxre_fx, Uxim_fx, &q_Ux, Sx_fx, &q_Sx ); @@ -4478,9 +4435,7 @@ static void formulate2x2MixingMatrix_fx( move32(); matrixDiagMul_fx( Uxre_fx, Uxim_fx, q_Ux, Sx_fx, q_Sx, Kxre_fx, Kxim_fx, &q_Kx ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Eigendecomp" );*/ - push_wmops( "formulate2x2MixingMatrix RegSMInv" ); /* Regularize the diagonal Sx for matrix inversion */ Sx_fx[0] = L_max( L_shr( Sx_fx[0], 1 ), Mpy_32_16_1( Sx_fx[1], regularizationFactor_fx ) ); Sx_fx[1] = L_max( L_shr( Sx_fx[1], 1 ), L_shl( Mpy_32_16_1( Sx_fx[0], regularizationFactor_fx ), 1 ) ); @@ -4570,7 +4525,6 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix RegSMInv" );*/ /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4603,17 +4557,12 @@ static void formulate2x2MixingMatrix_fx( /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ - push_wmops( "oPtoA MT1M" ); matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); - pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ - - IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4634,7 +4583,7 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#ifdef FIX_1326_SPEEDUP_08 +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT //Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 exp1 = add( 0, 20 ); @@ -4760,9 +4709,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );*/ - push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ #if ( BINAURAL_CHANNELS != 2 ) FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4916,8 +4863,6 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Mre_fx, Mim_fx, q_M ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" );*/ - return; } -- GitLab From cfab49b3830826388292f9fe62787a1c773e620c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 16:44:16 +0100 Subject: [PATCH 152/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e8052b08c..be86281ef 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4584,9 +4584,9 @@ static void formulate2x2MixingMatrix_fx( move32(); #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT - //Sqrt(1) + // Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 - exp1 = add( 0, 20 ); + exp1 = add( 0, 20 ); IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt { -- GitLab From 5f45790784cd617c8a35309386167a8b4ff6a65b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 07:55:08 +0000 Subject: [PATCH 153/358] revert:push_wmops: renamed label --- lib_dec/ivas_jbm_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index ce60c0d65..1918ce3f3 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1875,7 +1875,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - push_wmops( "ivas_dec_render (IDR)" ); + push_wmops( "ivas_dec_render" ); /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ -- GitLab From 7ab17f0711234491d62a812cbb9755d5152bfc71 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 09:52:45 +0100 Subject: [PATCH 154/358] introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 --- .../ivas_dirac_dec_binaural_functions_fx.c | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index be86281ef..141fe8c4b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - +#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 #include #include "options.h" #include @@ -4563,6 +4563,28 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); + +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 + IF( D_fx[0] == 0 ) + { +#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 + exp = sub( exp, sub( Q30, 62 ) ); +#else + temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + move32(); + exp = ONE_DIV_EPSILON_EXP; + move16(); +#endif + div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); + } + ELSE + { + exp = sub( 31, q_D ); + div_fx[0] = ISqrt32( D_fx[0], &exp ); + } +#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4582,6 +4604,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); +#endif /*FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2*/ #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) -- GitLab From 49363e47e693b6ea13b06be69fae0947b1c0d33c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 10:40:35 +0100 Subject: [PATCH 155/358] Revert "introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2" This reverts commit 18d10e60341ba2cd76c8161c396c02a8e7293290. --- .../ivas_dirac_dec_binaural_functions_fx.c | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 141fe8c4b..be86281ef 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 + #include #include "options.h" #include @@ -4563,28 +4563,6 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); - -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 - IF( D_fx[0] == 0 ) - { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 - exp = sub( exp, sub( Q30, 62 ) ); -#else - temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - move32(); - exp = ONE_DIV_EPSILON_EXP; - move16(); -#endif - div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp - move32(); - } - ELSE - { - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32( D_fx[0], &exp ); - } -#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4604,7 +4582,6 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#endif /*FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2*/ #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) -- GitLab From 08714e91ed77822c6202f130621c6bf6a5219c6c Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 10:26:18 +0530 Subject: [PATCH 156/358] Scaling related fix in ivas_enc_fx --- lib_enc/ivas_enc_fx.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index e8e1bc59e..ff5f65b32 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -344,13 +344,22 @@ ivas_error ivas_enc_fx( { norm_data_in = s_min( norm_data_in, L_norm_arr( data_fx[i], input_frame ) ); } - norm_data_in = sub( norm_data_in, 7 ); /*guard bit is 4->to handle overflow in cldfbAnalysis*/ - FOR( i = 0; i < hEncoderConfig->nchan_ism + st_ivas->nchan_transport; i++ ) + IF( LT_16( norm_data_in, 31 ) ) + { + norm_data_in = sub( norm_data_in, 7 ); /*guard bit is 4->to handle overflow in cldfbAnalysis*/ + norm_data_in = s_min( norm_data_in, 20 ); // limit Q to 31 (11 + norm) + FOR( i = 0; i < hEncoderConfig->nchan_ism + st_ivas->nchan_transport; i++ ) + { + scale_sig32( data_fx[i], input_frame, norm_data_in ); /* st_ivas->q_data_fx + norm_data_in */ + } + st_ivas->q_data_fx = add( st_ivas->q_data_fx, norm_data_in ); + move16(); + } + ELSE { - scale_sig32( data_fx[i], input_frame, norm_data_in ); /* st_ivas->q_data_fx + norm_data_in */ + st_ivas->q_data_fx = 31; + move16(); } - st_ivas->q_data_fx = add( st_ivas->q_data_fx, norm_data_in ); - move16(); } /* Estimate MASA parameters for the objects */ -- GitLab From 40d86c8bcee1e0e4af87fe44f6688fa553e23764 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 10:57:19 +0530 Subject: [PATCH 157/358] Fix for 3GPP issue 1404: Stereo LTV signal at 24.4kbps and 32kbps: Modulated noise in BWE region for one-sided signal Link #1404 --- lib_com/rom_com.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index e6f392ff0..03eae8a5a 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -22050,27 +22050,8 @@ const Word32 sigma_BWE_fx[] = {//Q31 40792208 }; /* for 3 bits first stage */ -const Word16 inv_modified_sigma_BWE_fx[] = {//Q1 - 259, -254, -267, -266, -293, -315, -598, -622, -288, -288, -297, -297, -319, -346, -598, -622 -}; - -const Word16 modified_sigma_BWE_fx[] =//Q(log2(2.56) -{ 323, +const Word16 inv_modified_sigma_BWE_fx[] = {//x2.56 +323, 329, 313, 314, @@ -22085,8 +22066,27 @@ const Word16 modified_sigma_BWE_fx[] =//Q(log2(2.56) 262, 242, 140, -134 }; +134 +}; +const Word16 modified_sigma_BWE_fx[] =//Q15 +{ 259, +254, +267, +266, +293, +315, +598, +622, +288, +288, +297, +297, +319, +346, +598, +622 }; + const Word16 SHB_LSF_mean_fx[10] = {//Q15 1353, 2646, 4046, -- GitLab From 12e48fda59637f7114c70df3f2cd79efa5133e03 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 14:43:50 +0530 Subject: [PATCH 158/358] Fix for 3GPP issue 1390: Stereo Encoder 13.2 kbps: Wrong Classification for Noisy Content on LTV Link #1390 --- lib_enc/analy_sp_fx.c | 4 ++++ lib_enc/ivas_cpe_enc_fx.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 185bac26b..bd4ad12ba 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -399,6 +399,10 @@ static void find_enr_dft_ivas_fx( BinE_fx[STEREO_DFT_N_12k8_ENC / 2 - 1] = BinE_fx[STEREO_DFT_N_12k8_ENC / 2 - 2]; // // *q_Bin_E move32(); + Word16 norm = getScaleFactor32( BinE_fx, L_FFT ); + scale_sig32( BinE_fx, L_FFT, norm ); + *q_Bin_E = add( *q_Bin_E, norm ); + move16(); L_lerp_fx( BinE_fx, Bin_E_fx, L_FFT / 2, STEREO_DFT_N_12k8_ENC / 2, q_Bin_E ); MVR2R_WORD32( Bin_E_fx, ptE_fx, VOIC_BINS ); // *q_Bin_E diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index ea70a33d3..a98aa4f53 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -707,7 +707,7 @@ ivas_error ivas_cpe_enc_fx( sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); move16(); shift = getScaleFactor16( sts[1]->input_fx, input_frame ); - Scale_sig( sts[1]->input_fx, input_frame, shift ); /* sts[1]->q_inp + shift */ + Copy_Scale_sig_32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, sub( add( sts[1]->q_inp, shift ), sts[1]->q_inp32 ) ); /* sts[1]->q_inp + shift */ sts[1]->q_inp = add( sts[1]->q_inp, shift ); move16(); Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[1]->q_inp, sts[1]->q_old_inp ), sts[1]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ @@ -722,7 +722,7 @@ ivas_error ivas_cpe_enc_fx( sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); move16(); shift = getScaleFactor16( sts[0]->input_fx, input_frame ); - Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[0]->q_inp + shift */ + Copy_Scale_sig_32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, sub( add( sts[0]->q_inp, shift ), sts[0]->q_inp32 ) ); /* sts[0]->q_inp + shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); move16(); Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), sts[0]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ -- GitLab From 9e6a9b23e43baf835c90a13a79b5ba19b69b730a Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 16:08:21 +0530 Subject: [PATCH 159/358] Cleanup of pre-processor macros in the main branch --- apps/renderer.c | 4 - lib_com/basop32.c | 4 - lib_com/bits_alloc_fx.c | 62 -- lib_com/bitstream_fx.c | 2 - lib_com/cldfb.c | 6 - lib_com/cnst.h | 2 - lib_com/disclaimer.c | 4 - lib_com/edct_fx.c | 2 - lib_com/fft_fx.c | 26 - lib_com/gs_bitallocation_fx.c | 2 - lib_com/gs_inact_switching_fx.c | 9 - lib_com/ivas_dirac_com_fx.c | 68 -- lib_com/ivas_prot_fx.h | 28 - lib_com/ivas_qmetadata_com_fx.c | 68 -- lib_com/ivas_spar_com_fx.c | 18 - lib_com/ivas_tools_fx.c | 221 ------- lib_com/lerp.c | 4 - lib_com/low_rate_band_att_fx.c | 4 - lib_com/lsf_tools_fx.c | 2 - lib_com/mslvq_com_fx.c | 8 - lib_com/options.h | 110 ---- lib_com/prot_fx.h | 15 - lib_com/rom_com.c | 12 - lib_com/swb_bwe_com_fx.c | 16 - lib_com/swb_bwe_com_lr_fx.c | 4 - lib_com/swb_tbe_com_fx.c | 10 - lib_com/tcq_position_arith_fx.c | 8 - lib_com/tcx_mdct_fx.c | 6 - lib_com/tools.c | 45 -- lib_com/tools_fx.c | 59 -- lib_com/trans_direct_fx.c | 2 - lib_com/trans_inv_fx.c | 6 - lib_dec/FEC_HQ_phase_ecu_fx.c | 28 - lib_dec/FEC_fx.c | 8 - lib_dec/TonalComponentDetection_fx.c | 8 - lib_dec/acelp_core_dec_fx.c | 10 - lib_dec/acelp_core_dec_ivas_fx.c | 166 ----- lib_dec/acelp_core_switch_dec_fx.c | 12 - lib_dec/core_switching_dec_fx.c | 27 - lib_dec/dec_gen_voic_fx.c | 4 - lib_dec/dec_tcx_fx.c | 34 - lib_dec/decision_matrix_dec_fx.c | 2 - lib_dec/fd_cng_dec_fx.c | 14 - lib_dec/gs_dec_fx.c | 16 - lib_dec/hq_core_dec_fx.c | 5 - lib_dec/hq_hr_dec_fx.c | 10 - lib_dec/igf_dec_fx.c | 45 -- lib_dec/init_dec_fx.c | 6 - lib_dec/ivas_binRenderer_internal_fx.c | 70 --- lib_dec/ivas_core_dec_fx.c | 75 --- lib_dec/ivas_cpe_dec_fx.c | 8 - lib_dec/ivas_dirac_dec_fx.c | 20 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 144 ----- lib_dec/ivas_init_dec.c | 2 - lib_dec/ivas_ism_param_dec_fx.c | 6 - lib_dec/ivas_jbm_dec_fx.c | 97 --- lib_dec/ivas_mc_param_dec_fx.c | 69 -- lib_dec/ivas_mc_paramupmix_dec_fx.c | 14 - lib_dec/ivas_mct_dec_fx.c | 28 - lib_dec/ivas_mct_dec_mct_fx_fx.c | 24 - lib_dec/ivas_mdct_core_dec_fx.c | 33 - lib_dec/ivas_omasa_dec_fx.c | 8 - lib_dec/ivas_osba_dec_fx.c | 12 - lib_dec/ivas_out_setup_conversion_fx.c | 2 - lib_dec/ivas_post_proc_fx.c | 24 - lib_dec/ivas_qmetadata_dec_fx.c | 22 - lib_dec/ivas_sba_dec_fx.c | 22 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 20 - lib_dec/ivas_spar_decoder_fx.c | 153 ----- lib_dec/ivas_stat_dec.h | 2 - lib_dec/ivas_stereo_cng_dec.c | 4 - lib_dec/ivas_stereo_dft_dec_fx.c | 42 -- lib_dec/ivas_stereo_ica_dec_fx.c | 5 - lib_dec/ivas_stereo_icbwe_dec_fx.c | 14 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 5 - lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 5 - lib_dec/ivas_stereo_switching_dec_fx.c | 10 - lib_dec/ivas_svd_dec_fx.c | 592 ------------------ lib_dec/ivas_tcx_core_dec_fx.c | 18 - lib_dec/ivas_td_low_rate_dec_fx.c | 5 - lib_dec/jbm_pcmdsp_apa.c | 2 - lib_dec/lead_deindexing_fx.c | 4 - lib_dec/lib_dec_fx.c | 82 --- lib_dec/stat_dec.h | 9 - lib_dec/swb_tbe_dec_fx.c | 6 - lib_dec/tonalMDCTconcealment_fx.c | 20 - lib_dec/transition_dec_fx.c | 4 - lib_dec/waveadjust_fec_dec_fx.c | 16 - lib_enc/acelp_core_enc_fx.c | 40 -- lib_enc/acelp_core_switch_enc_fx.c | 8 - lib_enc/bass_psfilter_enc_fx.c | 4 - lib_enc/cng_enc_fx.c | 2 - lib_enc/cod_ace_fx.c | 43 -- lib_enc/cod_tcx_fx.c | 11 - lib_enc/cod_uv_fx.c | 18 - lib_enc/core_enc_init_fx.c | 8 - lib_enc/core_enc_ol_fx.c | 2 - lib_enc/core_enc_reconf_fx.c | 2 - lib_enc/core_enc_switch_fx.c | 4 - lib_enc/core_switching_enc_fx.c | 2 - lib_enc/decision_matrix_enc_fx.c | 2 - lib_enc/dtx_fx.c | 25 - lib_enc/enc_acelp_fx.c | 6 - lib_enc/enc_acelpx_fx.c | 4 - lib_enc/enc_gen_voic_fx.c | 4 - lib_enc/enc_pit_exc_fx.c | 12 - lib_enc/enc_tran_fx.c | 2 - lib_enc/enc_uv_fx.c | 4 - lib_enc/energy_fx.c | 4 - lib_enc/ext_sig_ana_fx.c | 18 - lib_enc/find_tilt_fx.c | 4 - lib_enc/gaus_enc_fx.c | 5 - lib_enc/hq_classifier_enc_fx.c | 4 - lib_enc/hq_core_enc_fx.c | 6 - lib_enc/igf_enc.c | 35 -- lib_enc/init_enc_fx.c | 14 - lib_enc/inov_enc_fx.c | 2 - lib_enc/ivas_core_enc_fx.c | 13 - lib_enc/ivas_core_pre_proc_front_fx.c | 32 - lib_enc/ivas_core_pre_proc_fx.c | 6 - lib_enc/ivas_cpe_enc_fx.c | 44 -- lib_enc/ivas_dirac_enc_fx.c | 66 -- lib_enc/ivas_front_vad_fx.c | 4 - lib_enc/ivas_ism_dtx_enc_fx.c | 4 - lib_enc/ivas_ism_enc_fx.c | 10 - lib_enc/ivas_ism_metadata_enc_fx.c | 6 - lib_enc/ivas_masa_enc_fx.c | 4 - lib_enc/ivas_mc_param_enc_fx.c | 8 - lib_enc/ivas_mc_paramupmix_enc_fx.c | 6 - lib_enc/ivas_mcmasa_enc_fx.c | 4 - lib_enc/ivas_mct_core_enc_fx.c | 11 - lib_enc/ivas_mct_enc_mct_fx.c | 8 - lib_enc/ivas_mdct_core_enc_fx.c | 29 - lib_enc/ivas_omasa_enc_fx.c | 4 - lib_enc/ivas_osba_enc_fx.c | 22 - lib_enc/ivas_qmetadata_enc_fx.c | 17 - lib_enc/ivas_sce_enc_fx.c | 6 - lib_enc/ivas_sns_enc_fx.c | 5 - lib_enc/ivas_stat_enc.h | 12 - lib_enc/ivas_stereo_classifier_fx.c | 4 - lib_enc/ivas_stereo_dft_enc_fx.c | 12 - lib_enc/ivas_stereo_dft_enc_itd_fx.c | 51 -- lib_enc/ivas_stereo_dmx_evs_fx.c | 131 ---- lib_enc/ivas_stereo_ica_enc_fx.c | 22 - lib_enc/ivas_stereo_icbwe_enc_fx.c | 10 - lib_enc/ivas_stereo_mdct_core_enc_fx.c | 10 - lib_enc/ivas_stereo_mdct_igf_enc_fx.c | 2 - lib_enc/ivas_stereo_switching_enc_fx.c | 8 - lib_enc/ivas_stereo_td_analysis_fx.c | 29 - lib_enc/ivas_stereo_td_enc_fx.c | 2 - lib_enc/ivas_tcx_core_enc_fx.c | 20 - lib_enc/ivas_td_low_rate_enc_fx.c | 38 -- lib_enc/lib_enc.c | 4 - lib_enc/nois_est_fx.c | 2 - lib_enc/pit_enc_fx.c | 2 - lib_enc/pre_proc_fx.c | 4 - lib_enc/prot_fx_enc.h | 8 - lib_enc/spec_flatness_fx.c | 4 - lib_enc/speech_music_classif_fx.c | 47 -- lib_enc/stat_enc.h | 5 - lib_enc/swb_bwe_enc_fx.c | 21 - lib_enc/swb_pre_proc_fx.c | 4 - lib_enc/swb_tbe_enc_fx.c | 4 - lib_enc/tcx_ltp_enc_fx.c | 4 - lib_enc/tcx_utils_enc_fx.c | 6 - lib_enc/tns_base_enc_fx.c | 4 - lib_enc/transient_detection_fx.c | 9 - lib_enc/transition_enc_fx.c | 16 - .../ivas_dirac_dec_binaural_functions_fx.c | 426 ------------- lib_rend/ivas_dirac_decorr_dec_fx.c | 115 ---- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 34 - lib_rend/ivas_dirac_rend_fx.c | 30 - lib_rend/ivas_mcmasa_ana_fx.c | 2 - lib_rend/ivas_objectRenderer_hrFilt_fx.c | 2 - lib_rend/ivas_objectRenderer_sources_fx.c | 2 - lib_rend/ivas_output_init_fx.c | 4 - lib_rend/ivas_prot_rend_fx.h | 2 - lib_rend/ivas_reverb_fx.c | 9 - lib_rend/ivas_rotation_fx.c | 2 - lib_rend/ivas_stat_rend.h | 4 - lib_rend/lib_rend.c | 2 - lib_rend/lib_rend.h | 2 - lib_util/hrtf_file_reader.c | 4 - 183 files changed, 4669 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index ceb1a448e..47548d438 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -699,10 +699,8 @@ int main( lfeRoutingConfigs[i] = NULL; } -#ifdef FIX_DISCLAIMER IVAS_REND_PrintDisclaimer(); -#endif CmdlnArgs args = parseCmdlnArgs( argc, argv ); if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) || @@ -864,7 +862,6 @@ int main( exit( -1 ); } -#ifdef FIX_DISCLAIMER fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); fprintf( stdout, "Output audio file: %s\n\n", args.outputFilePath ); @@ -907,7 +904,6 @@ int main( exit( -1 ); } -#endif /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { diff --git a/lib_com/basop32.c b/lib_com/basop32.c index 7fab24660..20dbe663e 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -2563,10 +2563,8 @@ Word16 shr_ro( Word16 var1, Word16 var2, Flag *Overflow ) { var_out = shr_o( var1, var2, Overflow ); -#ifdef FIX_1049_SHR_RO_COMPLEXITY #ifdef WMOPS multiCounter[currCounter].shr--; -#endif #endif if ( var2 > 0 ) { @@ -2577,13 +2575,11 @@ Word16 shr_ro( Word16 var1, Word16 var2, Flag *Overflow ) } } -#ifdef FIX_1049_SHR_RO_COMPLEXITY #ifdef WMOPS multiCounter[currCounter].shr_r++; #endif BASOP_CHECK(); -#endif return ( var_out ); } diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 88b276126..cb71f0f28 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -773,9 +773,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signalling_bits, /* i : number of signalling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -795,9 +793,7 @@ ivas_error config_acelp1( Word16 flag_hardcoded, coder_type_sw, fix_first; Word32 core_brate; #ifdef DEBUGGING -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) active_cnt; -#endif #endif ivas_error error; @@ -1078,13 +1074,9 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) || ( coder_type == INACTIVE && GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx( core_brate, coder_type, -1, -1 )]; move16(); @@ -1205,11 +1197,7 @@ ivas_error config_acelp1( { test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; move16(); @@ -1427,14 +1415,10 @@ ivas_error config_acelp1( acelp_cfg->fixed_cdk_index[3] = -1; move16(); } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || /* @12.8kHz core except of GSC */ ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || EQ_16( core, HQ_CORE ) /* ACELP -> HQ switching in EVS */ ) -#else - ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) || coder_type != INACTIVE ) ) || EQ_16( core, HQ_CORE ) ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ FOR( i = 0; i < nb_subfr; i++ ) @@ -1498,13 +1482,9 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( flag_hardcoded /* EVS */ || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( flag_hardcoded || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -1613,12 +1593,8 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -1658,13 +1634,9 @@ ivas_error config_acelp1( } } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) || ( coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { Word32 Local_BR, Pitch_BR; Word16 Pitch_CT; @@ -1805,12 +1777,8 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* IVAS GSC @16kHz */ -#else - IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; move16(); @@ -1930,9 +1898,7 @@ ivas_error config_acelp1_IVAS( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signaling_bits, /* i : number of signaling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -2214,12 +2180,8 @@ ivas_error config_acelp1_IVAS( test(); test(); /* gain Q bit-budget - part 1: 'Es_pred' of memory-less gain Q */ -#ifdef NONBE_FIX_GSC_BSTR IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && ( coder_type != INACTIVE ) && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) || ( ( coder_type == INACTIVE ) && GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX( core_brate, coder_type, -1, -1 )]; move16(); @@ -2344,11 +2306,7 @@ ivas_error config_acelp1_IVAS( { test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; move16(); @@ -2564,13 +2522,9 @@ ivas_error config_acelp1_IVAS( acelp_cfg->fixed_cdk_index[3] = -1; move16(); } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) /* @12.8kHz core except of GSC */ || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || EQ_16( core, HQ_CORE ) /* ACELP -> HQ switching in EVS */ ) -#else - ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) || coder_type != INACTIVE ) ) || EQ_16( core, HQ_CORE ) ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ FOR( i = 0; i < nb_subfr; i++ ) @@ -2634,13 +2588,9 @@ ivas_error config_acelp1_IVAS( test(); test(); /* algebraic codebook bit-budget */ -#ifdef NONBE_FIX_GSC_BSTR IF( flag_hardcoded /* EVS */ || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( flag_hardcoded || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -2741,12 +2691,8 @@ ivas_error config_acelp1_IVAS( test(); test(); /* AVQ codebook */ -#ifdef NONBE_FIX_GSC_BSTR IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -2784,13 +2730,9 @@ ivas_error config_acelp1_IVAS( } } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) || ( coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { Word32 Local_BR, Pitch_BR; Word16 Pitch_CT; @@ -2931,12 +2873,8 @@ ivas_error config_acelp1_IVAS( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* IVAS GSC @16kHz */ -#else - IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; move16(); diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 712a6905e..e144c2cc9 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -526,10 +526,8 @@ void reset_indices_enc_fx( { Word16 i; -#ifdef MSAN_FIX hBstr->nb_ind_tot = 0; move16(); -#endif hBstr->nb_bits_tot = 0; move16(); hBstr->next_ind_fx = 0; diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 48fe4d9bc..408580169 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1101,9 +1101,7 @@ void cldfbSynthesis_ivas_fx( Word32 **imagBuffer_fx, /* i : imag values Qx*/ Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ const Word16 samplesToProcess, /* i : number of processed samples */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE const Word16 shift, /* i : scale for state buffer */ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) { @@ -1269,10 +1267,8 @@ void cldfbSynthesis_ivas_fx( } /* synthesis prototype filter */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( 0 == shift ) { -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = 0; i < L2; i++ ) { 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 @@ -1292,7 +1288,6 @@ void cldfbSynthesis_ivas_fx( synthesisBuffer_fx[4 * L2 + i] = accu4; move32(); } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE } ELSE { @@ -1318,7 +1313,6 @@ void cldfbSynthesis_ivas_fx( move32(); } } -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = 0; i < M1; i++ ) { diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7c93498af..1cc1a8ffe 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -932,9 +932,7 @@ typedef enum #define GAIN_PRED_ORDER 4 /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */ #define MEAN_ENER 30 /* Gain quantization - average innovation energy */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR 5 /* DTX - lp_noise threshold for DTX at higher bitrates */ -#endif #define DTX_HIST_SIZE 8 /* CNG & DTX - number of last signal frames used for CNG averaging */ #define CNG_ISF_FACT 0.9f /* CNG & DTX - CNG spectral envelope smoothing factor */ diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index 1a01c2c32..3b1677365 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -44,11 +44,7 @@ int16_t print_disclaimer( FILE *fPtr ) { fprintf( fPtr, "\n==================================================================================================\n" ); -#ifdef FIX_DISCLAIMER fprintf( fPtr, " IVAS Codec BASOP Baseline\n" ); -#else - fprintf( fPtr, " IVAS Codec Baseline\n" ); -#endif fprintf( fPtr, " \n" ); fprintf( fPtr, " Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,\n" ); fprintf( fPtr, " Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0\n" ); diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index b1e2a7dd9..1b303d285 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -395,9 +395,7 @@ void edct_16fx( Word16 Len2, i2; const Word16 *px, *pt; Word16 *py; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 7b63e9c67..31b11a9ea 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7596,12 +7596,6 @@ Word16 L_norm_arr( const Word32 *arr, Word16 size ) Word16 q = 31; move16(); FOR( Word16 i = 0; i < size; i++ ) -#ifndef FIX_1103_OPT_L_NORM_ARR - IF( arr[i] != 0 ) - { - q = s_min( q, norm_l( arr[i] ) ); - } -#else { Word16 q_tst; @@ -7612,7 +7606,6 @@ Word16 L_norm_arr( const Word32 *arr, Word16 size ) } } -#endif return q; } @@ -7658,24 +7651,6 @@ Word16 W_norm_arr( Word64 *arr, Word16 size ) Word16 get_min_scalefactor( Word32 x, Word32 y ) { -#ifndef FIX_1104_OPT_GETMINSCALEFAC - Word16 scf = Q31; - move16(); - test(); - IF( x == 0 && y == 0 ) - { - return 0; - } - IF( x != 0 ) - { - scf = s_min( scf, norm_l( x ) ); - } - IF( y != 0 ) - { - scf = s_min( scf, norm_l( y ) ); - } - return scf; -#else Word16 scf_y; Word16 scf = Q31; move16(); @@ -7699,7 +7674,6 @@ Word16 get_min_scalefactor( Word32 x, Word32 y ) } return scf; -#endif } diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 87ba794d4..0ce59482f 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -75,10 +75,8 @@ void bands_and_bit_alloc_fx( Word16 SWB_bit_budget; Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; Word16 w_sum_bit; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) GSC_IVAS_mode; (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index c0feb91f5..421b2a705 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -162,13 +162,8 @@ void Inac_switch_ematch_ivas_fx( Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ const Word16 coder_type, /* i : Coding mode */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 L_frame, /* i : Frame lenght */ -#ifndef NONBE_FIX_GSC_BSTR - const Word32 total_brate, /* i : total bit rate */ -#endif const Word16 Q_exc, /* i : input and output format of exc2 */ const Word16 bfi, /* i : frame lost indicator */ const Word16 last_core, /* i : Last core used */ @@ -224,11 +219,7 @@ void Inac_switch_ematch_ivas_fx( move16(); } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type == INACTIVE ) && inactive_coder_type_flag ) -#else - ELSE IF( ( coder_type == INACTIVE ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) -#endif { /* Find spectrum and energy per band for inactive frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 146587791..7d481d181 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -609,10 +609,8 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_y, /* o: Q30*/ Word32 *direction_vector_z, /* o: Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 *i_e_band -#endif ) { Word16 i; @@ -631,7 +629,6 @@ void computeDirectionVectors_fixed( scaled_x = L_shl( *intensity_real_x, norm_x ); scaled_y = L_shl( *intensity_real_y, norm_y ); scaled_z = L_shl( *intensity_real_z, norm_z ); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC IF( i_e_band != NULL ) { e_x = sub( Q31, add( i_e_band[i - enc_param_start_band], norm_x ) ); @@ -644,12 +641,6 @@ void computeDirectionVectors_fixed( e_y = sub( i_e, norm_y ); e_z = sub( i_e, norm_z ); } -#else - - e_x = sub( i_e, norm_x ); - e_y = sub( i_e, norm_y ); - e_z = sub( i_e, norm_z ); -#endif temp1 = BASOP_Util_Add_Mant32Exp( Mult_32_32( scaled_x, scaled_x ), shl( e_x, 1 ), Mult_32_32( scaled_y, scaled_y ), shl( e_y, 1 ), &exp1 ); intensityNorm = BASOP_Util_Add_Mant32Exp( temp1, exp1, Mult_32_32( scaled_z, scaled_z ), shl( e_z, 1 ), &intensityNorm_e ); @@ -966,17 +957,12 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv = L_add( 0, 0 ); Word16 shift_qtotal; if ( shift_q < 0 ) { -#ifdef FIX_USAN_ISSUES shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); -#else - shiftEquiv = L_lshl( 0x80000000, shift_q ); -#endif } if ( shift_q >= 0 ) { @@ -990,27 +976,6 @@ void computeDiffuseness_fixed( energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); move32(); } -#else - Word16 shift_q = sub( q_tmp, q_ene ); - IF( shift_q < 0 ) - { - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp_c[k], min_q_shift1 ); - energy_slow[k] = L_add( L_shl( energy_slow[k], shift_q ), tmp ); - move32(); - } - } - ELSE - { - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp_c[k], min_q_shift1 ); - energy_slow[k] = L_add( energy_slow[k], L_shr( tmp, shift_q ) ); - move32(); - } - } -#endif q_ene = s_min( q_ene, q_tmp ); @@ -1019,14 +984,9 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS if ( shift_q < 0 ) { -#ifdef FIX_USAN_ISSUES shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); -#else - shiftEquiv = L_lshl( 0x80000000, shift_q ); -#endif } if ( shift_q >= 0 ) { @@ -1044,34 +1004,6 @@ void computeDiffuseness_fixed( move32(); } } -#else - IF( shift_q > 0 ) - { - FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) - { - p_tmp = buffer_intensity[j][i]; - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp[k], min_q_shift2 ); - intensity_slow[j * num_freq_bands + k] = L_add( intensity_slow[j * num_freq_bands + k], L_shr( tmp, shift_q ) ); - move32(); - } - } - } - ELSE - { - FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) - { - p_tmp = buffer_intensity[j][i]; - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp[k], min_q_shift2 ); - intensity_slow[j * num_freq_bands + k] = L_add( L_shl( intensity_slow[j * num_freq_bands + k], shift_q ), tmp ); - move32(); - } - } - } -#endif q_intensity = s_min( q_intensity, q_tmp ); } diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index ab043fc0f..fab166b6d 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1309,7 +1309,6 @@ Word16 matrix_diag_product_fx( Word32 *Z, /* o : resulting matrix after the matrix multiplication */ Word16 *Z_e ); -#ifdef OPT_BASOP_ADD_v1 Word16 matrix_diag_product_fx_2( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ const Word16 X_e, @@ -1321,7 +1320,6 @@ Word16 matrix_diag_product_fx_2( const Word16 entriesY, /* i : number of entries in the diagonal Q0*/ Word32 *Z, /* o : resulting matrix after the matrix multiplication Q31 - Z_e*/ Word16 *Z_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 matrix_diag_product_fx_1( const Word32 *X, /* i : left hand matrix */ @@ -3238,10 +3236,8 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_y, /*Q30*/ Word32 *direction_vector_z, /*Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 *i_e_band -#endif ); @@ -3787,10 +3783,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal */ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); ivas_error ivas_osba_ism_metadata_dec_fx( @@ -4706,21 +4698,11 @@ Word32 dot_product_cholesky_fx( const Word16 N /* i : vector & matrix size */ ); -#ifndef DOT_PROD_CHOLESKY_64BIT -Word32 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N, /* i : vector & matrix size */ - const Word16 exp_x, - const Word16 exp_A, - Word16 *exp_sum ); -#else Word64 dot_product_cholesky_fixed( const Word32 *x, /* i : vector x */ const Word32 *A, /* i : Cholesky matrix A */ const Word16 N /* i : vector & matrix size */ ); -#endif void v_mult_mat_fx( Word32 *y_fx, /* o : the product x*A */ @@ -5347,20 +5329,12 @@ ivas_error ivas_sba_dec_render_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); void ivas_spar_dec_upmixer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Word32 *output_fx[], /* o : output audio channels */ const Word16 nchan_internal /* i : number of internal channels */ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); ivas_error ivas_spar_md_enc_open_fx( @@ -5967,9 +5941,7 @@ ivas_error pre_proc_front_ivas_fx( const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index c9ad84097..ee11f2b02 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -152,10 +152,8 @@ ivas_error ivas_qmetadata_allocate_memory_fx( { set32_fx( hQMetaData->q_direction[dir].band_data[j].elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); set32_fx( hQMetaData->q_direction[dir].band_data[j].azimuth_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef MSAN_FIX set32_fx( hQMetaData->q_direction[dir].band_data[j].q_elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); set32_fx( hQMetaData->q_direction[dir].band_data[j].q_azimuth_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif set32_fx( hQMetaData->q_direction[dir].band_data[j].energy_ratio_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } } @@ -315,14 +313,8 @@ ivas_error only_reduce_bits_direction_fx( Word16 *bits_dir0; Word16 bits_sph_idx_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_QMETADATA_PENALTY Word32 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 tmp; -#else - Word16 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; - Word16 shift, tmp, tmp_e, flag; - Word32 tmp_32; -#endif FOR( j = 0; j < coding_subbands; j++ ) { FOR( k = 0; k < no_subframes; k++ ) @@ -407,7 +399,6 @@ ivas_error only_reduce_bits_direction_fx( } ELSE { -#ifdef FIX_QMETADATA_PENALTY Word16 m, sorted, index1, index2; @@ -457,65 +448,6 @@ ivas_error only_reduce_bits_direction_fx( } -#else - FOR( j = 0; j < coding_subbands; j++ ) - { - penalty[j] = 0; - move16(); - tmp_32 = 0; - move32(); - shift = find_guarded_bits_fx( no_subframes ); - - flag = 1; - move16(); - // This change was done due to loss of precision from BASOP_Util_Divide3232_Scale which was leading to penalty getting calculated wrongly - // and hence ind_order being sorted incorrectly which might cause infinite loop. - FOR( k = 0; k < no_subframes - 1; k++ ) - { - IF( NE_16( bits_sph_idx_orig[j][k], bits_sph_idx_orig[j][k + 1] ) ) - { - flag = 0; - move16(); - } - } - - IF( flag ) - { - tmp = 0; - move16(); - FOR( k = 0; k < no_subframes; k++ ) - { - IF( bits_sph_idx_orig[j][k] > 0 ) - { - tmp = add( tmp, sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ); - } - } - - tmp = BASOP_Util_Divide1616_Scale( tmp, bits_sph_idx_orig[j][0], &tmp_e ); - - tmp_32 = L_shl( tmp, tmp_e ); /* Q15 */ - - penalty[j] = extract_l( L_shr( tmp_32, shift ) ); /* Q15 - shift */ - move16(); - // Division by no_subframes for penalty[j] not required - } - ELSE - { - FOR( k = 0; k < no_subframes; k++ ) - { - IF( bits_sph_idx_orig[j][k] > 0 ) - { - tmp = BASOP_Util_Divide3232_Scale( extract_l( L_sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ), bits_sph_idx_orig[j][k], &tmp_e ); - tmp_32 = L_add( tmp_32, L_shl( tmp, tmp_e ) ); - } - } - penalty[j] = extract_l( L_shr( tmp_32, shift ) ); /* Q15 - shift */ - move16(); - // Division by no_subframes for penalty[j] not required - } - } - sort_desc_ind_16_fx( penalty, coding_subbands, ind_order ); -#endif } *reduce_bits_out = negate( reduce_bits ); diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 929eaa2c5..9f6d8b422 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -2631,11 +2631,7 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( test(); IF( W_norm( re ) == 0 || W_norm( recon_uu_re[i][j] ) == 0 ) { -#ifdef FIX_ISSUE_1122 recon_uu_re[i][j] = L_shr( recon_uu_re[i][j], 1 ); // q_recon_uu_re[i][j] - 1 -#else - re1[m] = L_shr( re1[m], 1 ); // q_recon_uu_re[i][j]-1 -#endif move32(); q_recon_uu_re[i][j] = sub( q_recon_uu_re[i][j], 1 ); move16(); @@ -3834,11 +3830,7 @@ void ivas_compute_spar_params_fx( } ELSE { -#ifdef FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i] = L_shr_r( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i], sub( tmp, 22 ) ); // q22 -#else - hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i] = L_shr( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i], sub( tmp, 22 ) ); // q22 -#endif move32(); } } @@ -3865,7 +3857,6 @@ void ivas_compute_spar_params_fx( Word16 q_tmp = hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].q_C_re_fx; IF( NE_16( ndm, 1 ) ) { -#ifdef MSAN_FIX FOR( i = 0; i < ( num_ch - ndm ); i++ ) { FOR( j = 0; j < sub( ndm, 1 ); j++ ) @@ -3874,15 +3865,6 @@ void ivas_compute_spar_params_fx( move32(); } } -#else - for ( i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++ ) - { - for ( j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++ ) - { - hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub( q_tmp, 22 ) ); - } - } -#endif hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].q_C_re_fx = Q22; move16(); } diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 04d6f7bf5..ca8dec276 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -306,12 +306,6 @@ void v_add_inc_fx( const Word16 N /* i : Vector length Q0*/ ) { -#ifndef FIX_1107_VADDINC - Word16 i; - Word16 ix1 = 0; - Word16 ix2 = 0; - Word16 iy = 0; -#else Word16 i, ix1, ix2, iy; /* The use of this function is currently always for the interleaved input format, */ @@ -334,7 +328,6 @@ void v_add_inc_fx( ix1 = 0; ix2 = 0; iy = 0; -#endif move16(); move16(); move16(); @@ -604,44 +597,6 @@ void v_sub32_fx( * Therefore, S=A*A' where A is upper triangular matrix of size (m*m+m)/2 (zeros ommitted, column-wise) *---------------------------------------------------------------------*/ -#ifndef DOT_PROD_CHOLESKY_64BIT -/*! r: the dot product x'*A*A'*x */ -Word32 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x Q31 - exp_x*/ - const Word32 *A, /* i : Cholesky matrix A Q31 - exp_A*/ - const Word16 N, /* i : vector & matrix size Q0*/ - const Word16 exp_x, - const Word16 exp_A, - Word16 *exp_sum ) -{ - Word16 i, j; - Word32 suma, tmp_sum, mul; - const Word32 *pt_x, *pt_A; - Word16 mul_exp, tmp_sum_exp; - mul_exp = add( exp_x, exp_A ); - pt_A = A; - suma = 0; - move32(); - FOR( i = 0; i < N; i++ ) - { - tmp_sum = 0; - move32(); - tmp_sum_exp = 0; - move16(); - pt_x = x; - - FOR( j = 0; j <= i; j++ ) - { - mul = Mpy_32_32( *pt_x++, *pt_A++ ); /*Q31 - (exp_x + exp_A)*/ - tmp_sum = BASOP_Util_Add_Mant32Exp( tmp_sum, tmp_sum_exp, mul, mul_exp, &tmp_sum_exp ); // exp_x+exp_A - } - - suma = BASOP_Util_Add_Mant32Exp( suma, *exp_sum, Mpy_32_32( tmp_sum, tmp_sum ), shl( tmp_sum_exp, 1 ), exp_sum ); /*Q31 - exp_sum*/ - } - - return suma; -} -#else /*! r: the dot product x'*A*A'*x */ Word64 dot_product_cholesky_fixed( const Word32 *x, /* i : vector x Q31 - exp_x*/ @@ -677,7 +632,6 @@ Word64 dot_product_cholesky_fixed( return suma; } -#endif void v_mult_mat_fixed( Word32 *y, /* o : the product x*A Qx - guardbits*/ @@ -978,9 +932,6 @@ Word16 matrix_product_mant_exp_fx( Word16 out_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word16 *Zp_fx_e = out_e; Word16 row, col; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word64 temp; Word16 temp_e; Word16 prod_e = add( X_fx_e, Y_fx_e ); @@ -1007,13 +958,7 @@ Word16 matrix_product_mant_exp_fx( FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = k + i * rowsX; - y_idx = k + j * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1051,13 +996,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = i + k * rowsX; - y_idx = j + k * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1095,13 +1034,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = k + i * rowsX; - y_idx = j + k * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1140,13 +1073,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = i + k * rowsX; - y_idx = k + j * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1204,9 +1131,6 @@ Word16 matrix_product_fx( ) { Word16 i, j, k; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word32 *Zp_fx = Z_fx; /* Processing */ @@ -1227,13 +1151,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp_fx++; @@ -1254,13 +1172,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp_fx++; @@ -1281,13 +1193,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } @@ -1310,13 +1216,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ // TODO: overflow of Z_fx to be checked move32(); } @@ -1341,9 +1241,6 @@ Word16 matrix_product_q30_fx( ) { Word16 i, j, k; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word32 *Zp_fx = Z_fx; Word64 W_tmp; @@ -1366,14 +1263,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1397,14 +1287,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1428,11 +1311,6 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifndef OPT_BASOP_ADD_v1 - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ -#endif /* OPT_BASOP_ADD_v1 */ W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 } @@ -1459,14 +1337,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1499,9 +1370,6 @@ Word16 matrix_product_mant_exp( Word16 *Zp_e = Z_e; Word32 L_tmp; Word16 tmp_e; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ test(); @@ -1523,16 +1391,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[k + i * rowsX], Y_e[k + j * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - //( *Zp ) += X[k + i * rowsX] * Y[k + j * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1560,16 +1420,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[i + k * rowsX], Y_e[j + k * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[j + k * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); ( *Zp_e ) = tmp_e; @@ -1596,16 +1448,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[k + i * rowsX], Y_e[j + k * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[k + i * rowsX] * Y_fx[j + k * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1635,16 +1479,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[i + k * rowsX], Y_e[k + j * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[k + j * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1675,9 +1511,6 @@ Word16 matrix_diag_product_fx( { Word16 i, j; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1690,12 +1523,7 @@ Word16 matrix_diag_product_fx( { FOR( i = 0; i < colsX; ++i ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[j + i * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( j, imult1616( i, rowsX ) ); - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; } @@ -1726,7 +1554,6 @@ Word16 matrix_diag_product_fx( return EXIT_SUCCESS; } -#ifdef OPT_BASOP_ADD_v1 Word16 matrix_diag_product_fx_2( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ const Word16 X_e, @@ -1818,7 +1645,6 @@ Word16 matrix_diag_product_fx_2( return EXIT_SUCCESS; } -#endif /* OPT_BASOP_ADD_v1 */ Word16 matrix_diag_product_fx_1( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ @@ -1835,9 +1661,6 @@ Word16 matrix_diag_product_fx_1( Word16 i, j; Word32 *Zp = Z; Word16 *Z_ep = Z_e; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1850,19 +1673,10 @@ Word16 matrix_diag_product_fx_1( { FOR( i = 0; i < colsX; ++i ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[j + i * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( j, imult1616( i, rowsX ) ); /*Q0*/ - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; -#ifdef OPT_BASOP_ADD_v1 *( Z_ep ) = add( X_e[j + i * rowsX], Y_e[j] ); -#else /* OPT_BASOP_ADD_v1 */ - *( Z_ep ) = add( X_e[tmp], Y_e[j] ); -#endif /* OPT_BASOP_ADD_v1 */ move16(); Z_ep++; } @@ -1908,9 +1722,6 @@ Word16 diag_matrix_product_fx( { Word16 i, j; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1923,12 +1734,7 @@ Word16 diag_matrix_product_fx( { FOR( j = 0; j < entriesY; ++j ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[i + j * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( i, imult1616( j, rowsX ) ); /*Q0*/ - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; } @@ -1974,9 +1780,6 @@ Word16 matrix_product_diag_fx( { Word16 j, k; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 y_idx, x_idx; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ test(); @@ -1995,13 +1798,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[k + j * rowsX], Y[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( j, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; @@ -2019,13 +1816,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[j + k * rowsX], Y[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( j, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; @@ -2045,13 +1836,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[k + j * rowsX], Y[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( j, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } @@ -2071,13 +1856,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[j + k * rowsX], Y[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( j, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 4e306b936..6f148057f 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -356,10 +356,6 @@ void L_lerp_fx( Word32 *f /*q*/, Word32 *f_out /*q*/, Word16 bufferNewSize /*Q0* f[ind] = L_shr( f[ind], guard_bits ); /*Q(guard_bits)*/ move32(); } -#ifndef MSAN_FIX - FOR( Word16 ind = 0; ind < bufferNewSize; ind++ ) - f_out[ind] = L_shr( f_out[ind], guard_bits ); -#endif } IF( GT_32( L_mult0( 128, bufferNewSize ), L_mult0( bufferOldSize, 507 ) ) ) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 9958b9d5f..e51d2807b 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -75,15 +75,11 @@ void ivas_fine_gain_pred_fx( L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ -#ifndef FIX_ISSUE_987 - Mpy_32_16_ss( L_tmp, ivas_fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#else Word16 norm = norm_s( bw ); Word16 tmp1, tmp_exp = sub( 15, norm ); tmp1 = Sqrt16( shl( bw, norm ), &tmp_exp ); tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#endif gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ test(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 08e74b9b7..54f0ae3ed 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -604,7 +604,6 @@ Word16 lpc2lsp_fx( return ( 1 ); } -#ifdef FIX_ISSUE_1165 /*===================================================================*/ /* FUNCTION : lpc2lsp_ivas_fx () */ /*-------------------------------------------------------------------*/ @@ -749,7 +748,6 @@ Word16 lpc2lsp_ivas_fx( return ( 1 ); } -#endif /*===================================================================*/ /* FUNCTION : lsp2lpc_fx () */ diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 10e560433..cf2ad8a8a 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -461,12 +461,10 @@ static Word16 decode_indexes_ivas_fx( IF( index[i] < 0 ) { set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); scales_mslvq[1] = 0; move16(); -#endif index[i] = 0; return 1; } @@ -491,10 +489,8 @@ static Word16 decode_indexes_ivas_fx( FOR( i = 0; i < LATTICE_DIM; i++ ) { x_lvq[i] = 0; -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); -#endif } } ELSE @@ -503,12 +499,10 @@ static Word16 decode_indexes_ivas_fx( { /* safety check in case of bit errors */ set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); scales_mslvq[1] = 0; move16(); -#endif return 1; } @@ -549,10 +543,8 @@ static Word16 decode_indexes_ivas_fx( x_lvq[i] = 0; move16(); } -#ifdef MSAN_FIX scales_mslvq[1] = 0; move16(); -#endif } ELSE { diff --git a/lib_com/options.h b/lib_com/options.h index ab7efb8fd..76bfee2ae 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -67,116 +67,6 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif -#define IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */ -#define MSAN_FIX -#define FIX_TMP_714 -#define BASOP_NOGLOB_TMP_715 -#define EVS_FUNC_MODIFIED -#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ -#define MOD_BIT_ALLOC_ROM_TABLE /* Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/ -#define SIMPLIFY_CODE_BE // Simplify synthesis loop -#define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ -#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ -#define FIX_1013_CRASH_HQ_CORE_DEC /* Ittiam: Saturation added on the lines of EVS */ -#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/ -#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ -#define FIX_ISSUE_1062_AND_1068_TON_ENE_EST_FX -#define FIX_ISSUE_987 -#define FIX_1054_IF_ELSE_CMPLX /* VA: Fix 1054 incorrect counting of complexity when ELSE-IF sequence is encoutered in two functions */ -#define FIX_1052_COPY_CMPLX_DISCREPANCY /* VA: modify IF-ELSE statements used in Copy*() functions to avoid dependency on x[] and y[] in RAM */ -#define FIX_1049_SHR_RO_COMPLEXITY /* VA: fix for issue 1049: incorrect counting of complexity in the shr_ro() function */ -#define NONBE_IMPROVE_DIRAC_INTENSITY_PREC -#define FIX_1103_OPT_L_NORM_ARR /* FhG: Optimize L_norm_arr(), avoid IF */ -#define FIX_1105_OPT_MINIMUM_SL /* FhG: Optimize minimum_s(), minimum_l(), avoid IF */ -#define FIX_1104_OPT_GETMINSCALEFAC /* FhG: Optimize get_min_scalefactor(), avoid IF */ -#define FIX_1106_SIMPLIFY_SET32FX /* FhG: simplify set32_fx() */ -#define FIX_1107_VADDINC /* FhG: Optimize v_add_inc_fx() for most frequent case */ -#define FIX_1009_OPT_PARAMMC_RENDER /* FhG: Optimize ivas_param_mc_dec_render_fx() */ -#define FIX_1109_OPTIM_MCT_STEREO_IGF_DEC /* FhG: optimize mctStereoIGF_dec_fx() */ -#define FIX_1110_OPTIM_DIRAC_DECORR_PROC /* FhG: optimize ivas_dirac_dec_decorr_process() */ -#define FIX_1127_IMPROVE_SBA_MLD /* Ittiam: Avoid saturation for DiRAC reference power */ -#define FIX_1100_REMOVE_LPC_RESCALING /* VA: Remove the rescaling of LPC coefficient to Q12 as residu and syn-filt are already taking care of it*/ -#define FIX_1133_IMPROVE_MC_MLD /* Ittiam: Correcting wrong updation of exponents in ivas_mc_paramupmix_param_est_enc_fx() */ -#define FIX_ISSUE_1122 /* Ittiam: Fix issue 1122: corrected incorrect scaling of a buffer leading to incorrect metadata bits */ -#define FIX_ISSUE_1125 /* Ittiam: Fix issue 1125: interfering talker flag not triggered on short test vector */ -#define FIX_1132_STACK_CORRUPTION /* Stack corruption issue due of extending index access*/ -#define FIX_ISSUE_1092 /* Ittiam: Fix for Issue 1092: BASOP asserts in stereo fx encoder for selection test inputs*/ -#define FIX_ISSUE_1135 /* Ittiam: Fix for Issue 1135: downmixing difference between float and fixed-point (DFT - stereo) */ -#define FIX_ISSUE_1148 -#define FIX_ISSUE_1147 /* Ittiam: Fix for issue 1147: Added saturation in DetectTnsFilt_fx.*/ -#define FIX_ISSUE_1150 /* Ittiam: Fix for Issue 1150: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from tcx_ltp_find_gain function*/ -#define FIX_ISSUE_1151 /* Ittiam: Fix for Issue 1151: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from sp_mus_classif_gmm_fx function*/ -#define FIX_ISSUE_1153 /* Ittiam: Fix for Issue 1153: Assertion error observed in stereo_dmx_evs_enc_fx from calc_poc_fx function*/ -#define FIX_ISSUE_1154 /* Ittiam: Fix for Issue 1154: Encoder crash for ParamMC 7.1 at 96kbps in ivas_param_mc_param_est_enc_fx() */ -#define FIX_ISSUE_1157 /* Ittiam: Fix for Issue 1157: Encoder crash for Stereo at 48/64kbps DTX on/off in kernel_switch_trafo_fx() */ -#define FIX_ISSUE_1152 /* Ittiam: Fix for issue 1152: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from find_tilt_fx function*/ -#define FIX_ISSUE_1156 /* Ittiam: Fix for Issue 1156: Encoder crash for Stereo at 32kbps in SWB_BWE_encoding_ivas_fx() */ -#define FIX_DISCLAIMER /* VA: Add disclaimer for external renderer + Add info about IVAS reference version (FLP issue 1225) */ -#define FIX_ISSUE_1167 /* Ittiam: Fix for Issue 1167: Encoder crash for OSBA ISM3SBA1 at 13.2 and 16.4 kbps in gauss_L2_ivas_fx() */ -#define FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC /* FhG: Reduce workload of binaural rendering: replace 1./tmp & sqrt by Isqrt32 */ -#define FIX_1113_OPT_DIRAC_BIN_REND /* FhG: Various optimizations to ivas_dirac_dec_binaual_functions.c */ -#define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ -#define FIX_ISSUE_1186 /* Ittiam: Fix for Issue 1186: Energy/scaling issue for ISM-1 at all bitrates */ -#define FIX_ISSUE_1165 /* Ittiam: Fix for issue 1165: Assertion in lpc2lsp_fx for OMASA LTV input */ -#define FIX_ISSUE_1185 /* Ittiam: Fix for issue 1185: Assertion in ivas_dirac_dec_binaural_internal_fx() for crash in decoder in fft30_with_cmplx_data()*/ -#define FIX_ISSUE_1209 /* Ittiam: Fix for issue 1209: Assertion exit in BASOP encoder (stereo_dmx_evs)*/ -#define FIX_ISSUE_1218 /* Ittiam: Fix for issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps*/ -#define FIX_ISSUE_1290 /* Ittiam: Fix for issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps*/ -#define IVAS_ISSUE_1188_EVS_CRASH /* Ittiam: Fix for issue 1188: Issue due to ASAN */ -#define FIX_ISSUE_1155 /* Ittiam: Fix for issue 1155: Encoder crash for Stereo at 32kbps in PostShortTerm_ivas_enc_fx()*/ -#define FIX_1010_OPT_DIV /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_SINGLE_RESCALE /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_GIVENS /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_GIVENS_INV /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_NORM_NOSAT /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_SEC_SINGLE_RESCALE /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1072_SPEEDUP_matrixTransp2Mul_fx /* FhG: complexity optimization (non-be) */ -#define FIX_1072_REDUCE_DIVS /* FhG: complexity optimization (non-be) */ -#define FIX_ISSUE_1230 /* Ittiam: Fix for issue 1230: Basop Enc audible differences and distortion @16kbps */ -#define NONBE_1211_DTX_BR_SWITCHING /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */ -#define FIX_1189_GSC_IVAS_OMASA /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */ -#define NONBE_1273_ISM_METADATA_COUNTER /* VA: BASOP issue 1265, FLP issue 1273: fix counter overflow in ISM metadata encoder */ -#define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF /* FhG: fix for issue 1101: complexity of spar dec upmixer */ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS /* FhG: Defines 1.0f-weight variables, uses Madd operation instead of L_add_sat */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS /* FhG: Splits single loop with IF-statements into two low-complex loops */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS /* FhG: IMPROVE PRECISION: Uses 1/6 and 1/20 in full-precise Q31 constants instead of Q15 */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL /* FhG: Uses unique shift amount in each loop iteration */ -#define FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS /* FhG ivas_spar_com.c: Zeroes very small negative coeffs via L_shr_r (was L_shr) */ -#define FIX_ISSUE_1237 /* VA: replacement of Copy_Scale_sig_16_32_DEPREC() that are doing 16 bits left shift by Copy_Scale_sig_16_32_no_sat() */ -#define FIX_ISSUE_1237_KEEP_EVS_BE /* VA: Fix to keep EVS bitexactness to 26.444 */ -#define FIX_ISSUE_1214 /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/ -#define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ -#define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ -#define FIX_ISSUE_1291 /* Ittiam: Wrong use of imult1616() in ACELP rescaling */ -#define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ -#define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ -#define FIX_USAN_ISSUES /* Ittiam: Fix issues reported by USAN */ -#define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ -#define FIX_ISSUE_1247 -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define FIX_1285_DECODER_CRASH -#define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1320_LOWRATE_ACELP -#define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ -#define FIX_1298 /* VA: fix possible assert in gaus_enc */ -#define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ -#define FIX_1301_CORRECT_TD_CNST /* VA: Fix 1301, correct wrong constant in TD stereo */ -#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ -#define NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH /* FhG: issue 708: fix crash in OSBA BR switching with long test vectors */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ -#define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ -#define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ -#define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ -#define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ -#define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ -#define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ -#define NONBE_FIX_1386_STEREO_DMX_EVS_PHA /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */ -#define FIX_1326_SUBSTITUTE_CMPMANT32EXP /* FhG: Minor WMOPS tuning*/ -#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT /* FhG: WMOPS tuning */ -#define FIX_1326_SPEEDUP_eig2x2_fx /* FhG: Minor WMOPS tuning*/ #endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 70b70859c..71c1590c2 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -881,13 +881,11 @@ Word16 lpc2lsp_fx( Word16 *old_freq, Word16 order ); -#ifdef FIX_ISSUE_1165 Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ); -#endif void lsp2lpc_fx( Word16 *a, @@ -4864,9 +4862,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signalling_bits, /* i : number of signalling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -5854,13 +5850,8 @@ void Inac_switch_ematch_ivas_fx( Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ const Word16 coder_type, /* i : Coding mode */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 L_frame, /* i : Frame lenght */ -#ifndef NONBE_FIX_GSC_BSTR - const Word32 core_brate, /* i : Core bit rate */ -#endif const Word16 Q_exc, /* i : input and output format of exc2 */ const Word16 bfi, /* i : frame lost indicator */ const Word16 last_core, /* i : Last core used */ @@ -9753,9 +9744,7 @@ void cldfbSynthesis_ivas_fx( Word32 **imagBuffer_fx, /* i : imag values Qx*/ Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ const Word16 samplesToProcess, /* i : number of processed samples */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE const Word16 shift, /* i : scale for state buffer */ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); @@ -10995,9 +10984,7 @@ ivas_error config_acelp1_IVAS( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signaling_bits, /* i : number of signaling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -11064,9 +11051,7 @@ void calculate_hangover_attenuation_gain_ivas_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR const Word32 igf_brate, /* i : IGF configuration bitrate */ -#endif const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index e6f392ff0..551a84feb 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -16790,7 +16790,6 @@ const Word16 GSC_freq_bits[] = 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_22k60*/ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4 /* ACELP_24k40*/ }; // Q0 -#ifdef MOD_BIT_ALLOC_ROM_TABLE const Word32 GSC_freq_bits_fx[] =/*Q18*/ { 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_5k00*/ @@ -16823,17 +16822,6 @@ const Word32 GSC_freq_bits_fx_Q18[] =/*Q18*/ 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, }; -#else -const Word32 GSC_freq_bits_fx[] = -{ - 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/ - 5505024, 19660800, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_11k60*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k15*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/ - 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ -}; -#endif const Word16 Compl_GSC_freq_bits[] = { 5, 10, 10, 10 /* bitrate > ACELP_16k40 && FS = 16kHz */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index eda099cd9..228d43247 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2533,11 +2533,7 @@ void hq_generic_decoding_fx( IF( L_tmp != 0 ) { exp = norm_l( L_tmp ); -#ifdef EVS_FUNC_MODIFIED frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#else - frac = round_fx( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#endif tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ @@ -2868,11 +2864,7 @@ void hq_generic_decoding_fx( tmp4_fx = mult_r( tmp3_fx, 1638 /* 0.05 in Q15 */ ); WHILE( tmp3_fx > 1024 /* 1 in Q10*/ ) { -#ifdef EVS_FUNC_MODIFIED L_tmp1 = L_shl( Mult_32_16( *pit1_fx, tmp3_fx ), 5 ); /*15 + 5 + 10 -15 */ -#else - L_tmp1 = Mult_32_16( L_shl( *pit1_fx, 5 ), tmp3_fx ); /*15 + 5 + 10 -15 */ -#endif *pit1_fx-- = L_tmp1; move32(); tmp3_fx = sub( tmp3_fx, tmp4_fx ); @@ -3089,11 +3081,7 @@ void hq_generic_decoding_ivas_fx( IF( L_tmp != 0 ) { exp = norm_l( L_tmp ); -#ifdef EVS_FUNC_MODIFIED frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#else - frac = round_fx( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#endif tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ @@ -3424,11 +3412,7 @@ void hq_generic_decoding_ivas_fx( tmp4_fx = mult_r( tmp3_fx, 1638 /* 0.05 in Q15 */ ); WHILE( tmp3_fx > 1024 /* 1 in Q10*/ ) { -#ifdef EVS_FUNC_MODIFIED L_tmp1 = L_shl( Mult_32_16( *pit1_fx, tmp3_fx ), 5 ); /*15 + 5 + 10 -15 */ -#else - L_tmp1 = Mult_32_16( L_shl( *pit1_fx, 5 ), tmp3_fx ); /*15 + 5 + 10 -15 */ -#endif *pit1_fx-- = L_tmp1; move32(); tmp3_fx = sub( tmp3_fx, tmp4_fx ); diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index d0b8d0100..8fd876f1c 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2366,11 +2366,7 @@ void ton_ene_est_fx( exp_normn = norm_s( peak_fx[k] ); fac_fx = div_s( shl( temp2_fx, exp_normd ), shl( peak_fx[k], exp_normn ) ); -#ifdef FIX_ISSUE_1062_AND_1068_TON_ENE_EST_FX fac_fx = shl_sat( fac_fx, sub( add( Qss, exp_normn ), add( Qtemp2, exp_normd ) ) ); /* Qtemp2+exp_normd-(Qss+exp_normn)+15 -> 15*/ -#else - fac_fx = shl( fac_fx, sub( add( Qss, exp_normn ), add( Qtemp2, exp_normd ) ) ); /* Qtemp2+exp_normd-(Qss+exp_normn)+15 -> 15*/ -#endif } ni_gain_fx[k] = mult_r( avg_pe_fx[k], fac_fx ); /* Qavg_pe[k] */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 04b6ba187..2a2841966 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1036,11 +1036,7 @@ static void filt_mu_fx( FOR( n = 0; n < SubFrameLength; n++ ) { temp = mult_r( mu, ( *ptrs++ ) ); -#ifdef FIX_ISSUE_1155 temp = add_sat( temp, *ptrs ); /*Q12 */ -#else - temp = add( temp, *ptrs ); /*Q12 */ -#endif sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); move16(); /*Q12 */ } @@ -5087,7 +5083,6 @@ void GenSHBSynth_fx32( Word32 speech_buf_32k[L_FRAME32k]; Word16 i; -#ifdef FIX_881_HILBERT_FILTER Word16 shift = 0; Word32 maxm32, input_synspeech_temp[L_FRAME16k]; move16(); @@ -5123,9 +5118,6 @@ void GenSHBSynth_fx32( } Interpolate_allpass_steep_fx32( input_synspeech_temp, state_lsyn_filt_shb_local, L_FRAME16k, speech_buf_32k ); -#else - Interpolate_allpass_steep_fx32( input_synspeech, state_lsyn_filt_shb_local, L_FRAME16k, speech_buf_32k ); -#endif IF( EQ_16( L_frame, L_FRAME ) ) { @@ -5148,14 +5140,12 @@ void GenSHBSynth_fx32( } } -#ifdef FIX_881_HILBERT_FILTER IF( maxm32 != 0 ) { Scale_sig32( shb_syn_speech_32k, L_FRAME32k, negate( shift ) ); Scale_sig32( state_lsyn_filt_shb_local, 2 * ALLPASSSECTIONS_STEEP, negate( shift ) ); Scale_sig32( Hilbert_Mem, HILBERT_MEM_SIZE, negate( shift ) ); } -#endif return; } diff --git a/lib_com/tcq_position_arith_fx.c b/lib_com/tcq_position_arith_fx.c index 0466dc133..3abd527ca 100644 --- a/lib_com/tcq_position_arith_fx.c +++ b/lib_com/tcq_position_arith_fx.c @@ -1983,11 +1983,7 @@ Word32 encode_magnitude_tcq_fx( move16(); bits_fx = L_deposit_l( 0 ); -#ifdef IVAS_ISSUE_1188_EVS_CRASH tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - ( nzpos - 1 )] ) ); -#else - tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - nzpos - 1] ) ); -#endif *est_frame_bits_fx = L_add( *est_frame_bits_fx, tcq_bits_fx ); move32(); @@ -2470,11 +2466,7 @@ void decode_mangitude_tcq_fx( move16(); bits_fx = L_deposit_l( 0 ); -#ifdef IVAS_ISSUE_1188_EVS_CRASH tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - ( nzpos - 1 )] ) ); -#else - tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - nzpos - 1] ) ); -#endif IF( EQ_16( nzpos, npulses ) ) { diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 1fc57871d..b2cee32e6 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -106,9 +106,7 @@ void TCX_MDCT( Word16 i; Word16 factor, neg_factor; Word16 factor_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -164,9 +162,7 @@ void TCX_MDST( Word16 i; Word16 factor, neg_factor; Word16 factor_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -226,9 +222,7 @@ void TCX_MDCT_Inverse( Word16 L2 = l, R2 = r; Word32 tmp_buf[N_MAX + L_MDCT_OVLP_MAX / 2]; Word16 fac_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif L2 = shr( l, 1 ); R2 = shr( r, 1 ); diff --git a/lib_com/tools.c b/lib_com/tools.c index e4ccd9955..b1a9f4d13 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -628,45 +628,23 @@ Word16 minimum_s( Word16 *min_val /* o : minimum value in the input vector */ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL Word16 i, ind; -#else - Word16 i, ind, tmp; -#endif ind = 0; move16(); -#ifndef FIX_1105_OPT_MINIMUM_SL - tmp = vec[0]; - move16(); -#endif FOR( i = 1; i < lvec; i++ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL if ( LT_16( vec[i], vec[ind] ) ) { ind = i; move16(); } -#else - IF( LT_16( vec[i], tmp ) ) - { - ind = i; - move16(); - tmp = vec[i]; - move16(); - } -#endif } if ( min_val != NULL ) { -#ifdef FIX_1105_OPT_MINIMUM_SL *min_val = vec[ind]; -#else - *min_val = tmp; -#endif move16(); } @@ -687,45 +665,22 @@ Word16 minimum_l( ) { Word16 i, ind; -#ifndef FIX_1105_OPT_MINIMUM_SL - Word32 tmp; -#endif ind = 0; -#ifndef FIX_1105_OPT_MINIMUM_SL - tmp = vec[0]; -#endif move16(); -#ifndef FIX_1105_OPT_MINIMUM_SL - move32(); -#endif FOR( i = 1; i < lvec; i++ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL if ( LT_32( vec[i], vec[ind] ) ) { ind = i; move16(); } -#else - IF( LT_32( vec[i], tmp ) ) - { - ind = i; - tmp = vec[i]; - move16(); - move32(); - } -#endif } if ( min_val != NULL ) { -#ifdef FIX_1105_OPT_MINIMUM_SL *min_val = vec[ind]; -#else - *min_val = tmp; -#endif move32(); } diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index fad2d64a8..d403c583d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -483,16 +483,10 @@ void Copy( move16(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; @@ -500,9 +494,6 @@ void Copy( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } /*-------------------------------------------------------------------* * Copy64: @@ -524,16 +515,10 @@ void Copy64( move64(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; @@ -541,9 +526,6 @@ void Copy64( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } void set64_fx( @@ -580,16 +562,10 @@ void Copy_pword( move16(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i].v.im = x[i].v.im; @@ -599,9 +575,6 @@ void Copy_pword( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } /*-------------------------------------------------------------------* * Copy32: @@ -623,23 +596,14 @@ void Copy32( move32(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; move32(); } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } void set8_fx( @@ -688,7 +652,6 @@ void set32_fx( const Word16 N /* i : Lenght of the vector */ ) { -#ifdef FIX_1106_SIMPLIFY_SET32FX Word16 i; FOR( i = 0; i < N; i++ ) @@ -696,26 +659,6 @@ void set32_fx( y[i] = a; move32(); } -#else - Word16 i, tmp; - tmp = extract_l( a ); - IF( EQ_32( L_deposit_l( tmp ), a ) ) - { - FOR( i = 0; i < N; i++ ) - { - y[i] = L_deposit_l( tmp ); - move32(); - } - } - ELSE - { - FOR( i = 0; i < N; i++ ) - { - y[i] = a; - move32(); - } - } -#endif return; } @@ -801,7 +744,6 @@ void Copy_Scale_sig_16_32_DEPREC( } return; } -#ifdef FIX_ISSUE_1237 #ifdef DEBUGGING if ( exp0 >= 16 ) { @@ -809,7 +751,6 @@ void Copy_Scale_sig_16_32_DEPREC( } #else assert( exp0 < 16 ); -#endif #endif tmp = shl_o( 1, exp0, &Overflow ); FOR( i = 0; i < lg; i++ ) diff --git a/lib_com/trans_direct_fx.c b/lib_com/trans_direct_fx.c index d4792fb75..6a3cdf108 100644 --- a/lib_com/trans_direct_fx.c +++ b/lib_com/trans_direct_fx.c @@ -40,9 +40,7 @@ void direct_transform_fx( Word16 shift, Qmin = 31; Word32 L_tmp; Word16 Qs[NUM_TIME_SWITCHING_BLOCKS]; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( element_mode ); -#endif move16(); segment_length = shr( L, 1 ); diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 0033e2c9e..0683e266c 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -515,11 +515,7 @@ void preecho_sb_fx( tmp_fx1 = norm_l( es_mdct_hb_fx[i] ); tmp_fxL1 = L_shl( es_mdct_hb_fx[i], tmp_fx1 ); tmp_fxL2 = L_shl( mean_prev_hb_fx_loc, tmp_fx1 ); -#ifdef FIX_1013_CRASH_HQ_CORE_DEC tmp_fx1 = round_fx_sat( tmp_fxL1 ); -#else - tmp_fx1 = round_fx( tmp_fxL1 ); -#endif tmp_fx2 = round_fx( tmp_fxL2 ); tmp_fx3 = div_s( tmp_fx2, tmp_fx1 ); min_g_hb_fx[i] = Frac_sqrt( tmp_fx3 ); @@ -996,9 +992,7 @@ void Inverse_Transform( Word16 segment_length_div2, segment_length_div4; Word16 tmp, q_out; Word32 L_temp; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( element_mode ); -#endif /* This value is used to right shift all vectors returned by 'iedct_short_fx()' */ /* to bring them to a scaling that is equal to the 1st 'Q' returned by the 1st */ /* call to 'iedct_short_fx()' minus these guard bits. */ diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 34d01d7fe..74f1bfc09 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1590,11 +1590,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[*pPlocs], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( *pPlocs ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1605,11 +1601,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && EQ_16( *pPlocs, 1 ) ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[*pPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( *pPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1655,11 +1647,7 @@ static void ivas_spec_ana_fx( IF( EQ_16( currPlocs, ( sub( Lprot2_1, DELTA_CORR_F0_INT ) ) ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[currPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( currPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1673,11 +1661,7 @@ static void ivas_spec_ana_fx( * whould point */ IF( n > 0 ) /* fs/2 which makes special case . */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[currPlocs - 2], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( currPlocs, 2 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -4005,11 +3989,7 @@ static void ivas_fec_ecu_dft_fx( tmp = Exp16Array( *Nfft, Tfr16 ); *exp = add( tmp, add( 2, norm_s( *Nfft ) ) ); move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#else - Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif *exp = s_min( *exp, 15 ); DoRTFTn_fx( Tfr32, Tfi32, *Nfft ); @@ -4125,20 +4105,12 @@ static void fec_ecu_dft_fx( tmp = Exp16Array( *Nfft, Tfr16 ); *exp = add( tmp, add( 2, norm_s( *Nfft ) ) ); move16(); -#ifdef FIX_ISSUE_1237 { -#ifdef FIX_ISSUE_1237_KEEP_EVS_BE Word16 loctmp = *exp; move16(); loctmp = s_min( 15, loctmp ); Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, loctmp ); /*Qin+exp; */ /*Even with limiting loctmp, if Copy_Scale_sig_16_32_no_sat() is used, can lead to 1 difference */ -#else - Copy_Scale_sig_16_32_no_sat( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif } -#else - Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif DoRTFTn_fx( Tfr32, Tfi32, *Nfft ); N_LP = shr( *Nfft, 1 ); diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 35bb254af..612816efd 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -504,11 +504,7 @@ void FEC_exc_estim_fx( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && st_fx->inactive_coder_type_flag && !st_fx->Opt_AMR_WB ) ) -#else - IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && LE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && !st_fx->Opt_AMR_WB ) ) -#endif { st_fx->GSC_noisy_speech = st_fx->Last_GSC_noisy_speech_flag; move16(); @@ -670,11 +666,7 @@ void FEC_exc_estim_fx( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && st_fx->inactive_coder_type_flag && !st_fx->Opt_AMR_WB ) ) -#else - IF( ( EQ_16( st_fx->last_coder_type, AUDIO ) || EQ_16( st_fx->last_good, INACTIVE_CLAS ) ) && LE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && !st_fx->Opt_AMR_WB ) -#endif { /* For GSC - the excitation is already computed */ Copy( exc, exc2, st_fx->L_frame ); diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index e50abddd6..e820f1399 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -76,13 +76,11 @@ void ivas_DetectTonalComponents_fx( pScaledMdctSpectrum[i] = L_shl( lastMDCTSpectrum[i], 16 ); /*15-lastMDCTSpectrum_exp+16 -> 31 - lastMDCTSpectrum_exp*/ move32(); } -#ifdef MSAN_FIX FOR( Word16 i = 0; i < FDNS_NPTS; i++ ) { sns_int_scf_fx[i] = L_shl_sat( scaleFactors[i], add( 1, scaleFactors_exp[i] ) ); // Q16 move32(); } -#endif IF( psychParamsCurrent == NULL ) { nBands = FDNS_NPTS; @@ -94,12 +92,6 @@ void ivas_DetectTonalComponents_fx( } ELSE { -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < FDNS_NPTS; i++ ) - { - sns_int_scf_fx[i] = L_shl( scaleFactors[i], add( 1, scaleFactors_exp[i] ) ); // Q16 - } -#endif q_pScaledMdctSpectrum = sub( 31, lastMDCTSpectrum_exp ); sns_shape_spectrum_fx( pScaledMdctSpectrum, &q_pScaledMdctSpectrum, psychParamsCurrent, sns_int_scf_fx, 16, nSamplesCore, NULL ); q_pScaledMdctSpectrum = add( q_pScaledMdctSpectrum, 1 ); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 0f94a7558..7a3c78644 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -113,7 +113,6 @@ ivas_error acelp_core_dec_fx( FD_BWE_DEC_HANDLE hBWE_FD; TCX_DEC_HANDLE hTcxDec; ivas_error error; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( tdm_lspQ_PCh ); (void) ( tdm_lsfQ_PCh ); (void) ( use_cldfb_for_dft ); @@ -125,7 +124,6 @@ ivas_error acelp_core_dec_fx( (void) ( output ); (void) ( read_sid_info ); (void) hStereoCng; -#endif hMusicPF = st_fx->hMusicPF; hBPF = st_fx->hBPF; hBWE_TD = st_fx->hBWE_TD; @@ -666,21 +664,13 @@ ivas_error acelp_core_dec_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif test(); test(); IF( EQ_16( st_fx->coder_type, TRANSITION ) && LT_16( tc_subfr_fx, L_SUBFR ) && EQ_16( st_fx->L_frame, L_FRAME ) ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, TRANSITION, -1, tc_subfr_fx, 2, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_fx, 2, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif } } diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 2ca524bb0..5807f2c67 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -83,22 +83,14 @@ ivas_error acelp_core_dec_ivas_fx( Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ -#ifdef MSAN_FIX Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ -#else - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ -#endif Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ Word32 enr_q_fx; /* E information for FER protection */ Word16 tmp_noise_fx; /* Long term temporary noise energy */ Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ Word16 FEC_pitch_fx; /* FEC pitch */ -#ifdef MSAN_FIX Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ -#else - Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ -#endif Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ Word16 i, j, int_fs; Word16 tc_subfr; @@ -133,13 +125,9 @@ ivas_error acelp_core_dec_ivas_fx( ivas_error error; Word32 bpf_error_signal_fx[L_FRAME16k]; -#ifdef MSAN_FIX set32_fx( bpf_error_signal_fx, 0, L_FRAME16k ); -#endif Word16 bpf_error_signal_16fx[L_FRAME16k]; -#ifdef MSAN_FIX set16_fx( bpf_error_signal_16fx, 0, L_FRAME16k ); -#endif set16_fx( Aq_fx, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( old_bwe_exc_fx, 0, ( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ) ); Word16 tmp; @@ -178,7 +166,6 @@ ivas_error acelp_core_dec_ivas_fx( IF( EQ_32( st->core_brate, SID_2k40 ) ) { FdCng_decodeSID_ivas_fx( st ); -#ifdef FIX_ISSUE_1218 Word16 n1, n2; n1 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART ); n2 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART ); @@ -188,9 +175,6 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( old_NoiseEstExp, common_e ) ); st->hFdCngDec->hFdCngCom->sidNoiseEstExp = common_e; move16(); -#else - rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ); -#endif } FOR( i = 0; i < NPART; i++ ) { @@ -621,11 +605,7 @@ ivas_error acelp_core_dec_ivas_fx( { test(); test(); -#ifdef FIX_1189_GSC_IVAS_OMASA IF( EQ_16( st->coder_type, AUDIO ) || ( EQ_16( st->coder_type, INACTIVE ) && EQ_16( st->inactive_coder_type_flag, 1 ) ) ) -#else - IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { st->GSC_IVAS_mode = get_next_indice_fx( st, 2 ); move16(); @@ -642,14 +622,6 @@ ivas_error acelp_core_dec_ivas_fx( IF( st->cng_type == LP_CNG ) { CNG_dec_ivas_fx( st, last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, sid_bw, q_env_fx ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING - FOR( Word32 nsf = 0; nsf < NB_SUBFR16k; nsf++ ) - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif Copy( Aq_fx, st->Aq_cng, add( M, 1 ) ); /* comfort noise generation */ @@ -746,11 +718,7 @@ ivas_error acelp_core_dec_ivas_fx( IF( st->hMusicPF && st->hGSCDec ) { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, -#ifdef FIX_ISSUE_1291 L_FRAME32k, 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); -#else - imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); -#endif } IF( st->hPFstat != NULL ) { @@ -781,9 +749,6 @@ ivas_error acelp_core_dec_ivas_fx( /* synthesis at 12.8kHz sampling rate */ -#ifndef FIX_1100_REMOVE_LPC_RESCALING - Aq_fx[0] = ONE_IN_Q12; -#endif move16(); syn_12k8_fx( st->L_frame, Aq_fx, exc2_fx, psyn_fx, st->mem_syn2_fx, 1, st->Q_exc, st->Q_syn ); syn_12k8_fx( st->L_frame, Aq_fx, exc3_fx, syn1_fx, st->mem_syn3_fx, 1, st->Q_exc, st->Q_syn ); @@ -804,11 +769,7 @@ ivas_error acelp_core_dec_ivas_fx( Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn -> Q(-1) IF( st->hBWE_FD != NULL ) { -#ifdef FIX_ISSUE_1290 save_old_syn_fx( st->L_frame, temp_buf_fx, old_syn_12k8_16k_fx, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); -#else - save_old_syn_fx( st->L_frame, syn1_fx, old_syn_12k8_16k_fx, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); -#endif } } @@ -848,21 +809,13 @@ ivas_error acelp_core_dec_ivas_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif test(); test(); IF( EQ_16( st->coder_type, TRANSITION ) && LT_16( tc_subfr, L_SUBFR ) && EQ_16( st->L_frame, L_FRAME ) ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } } @@ -944,18 +897,6 @@ ivas_error acelp_core_dec_ivas_fx( st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame ); move16(); } -#ifndef FIX_1100_REMOVE_LPC_RESCALING -#ifndef MSAN_FIX - for ( int nsf = 0; nsf < NB_SUBFR16k; nsf++ ) -#else - FOR( Word32 nsf = 0; nsf < st->nb_subfr; nsf++ ) -#endif - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); // Q(x-2) - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif test(); IF( EQ_16( st->last_core, HQ_CORE ) && st->element_mode > EVS_MONO ) { @@ -1129,11 +1070,7 @@ ivas_error acelp_core_dec_ivas_fx( * Apply energy matching when switching to inactive frames *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->L_frame, st->total_brate, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /*------------------------------------------------------------* * Decode information and modify the excitation signal of stationary unvoiced frames @@ -1291,18 +1228,6 @@ ivas_error acelp_core_dec_ivas_fx( lsf_dec_bfi( MODE1, lsf_new_fx, st->lsf_old_fx, st->lsf_adaptive_mean_fx, NULL, st->mem_MA_fx, st->mem_AR_fx, st->stab_fac_fx, st->last_coder_type, st->L_frame, st->last_good, st->nbLostCmpt, 0, NULL, NULL, NULL, st->hGSCDec->Last_GSC_pit_band_idx, st->Opt_AMR_WB, 0, st->bwidth ); FEC_lsf2lsp_interp( st, st->L_frame, Aq_fx, lsf_new_fx, lsp_new_fx ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING -#ifndef MSAN_FIX - for ( int nsf = 0; nsf < NB_SUBFR16k; nsf++ ) -#else - FOR( Word32 nsf = 0; nsf < st->nb_subfr; nsf++ ) -#endif - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); // Qx->Q(x-2) - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif IF( EQ_16( st->nelp_mode_dec, 1 ) ) { /* SC-VBR */ @@ -1340,11 +1265,7 @@ ivas_error acelp_core_dec_ivas_fx( } /* Apply energy matching when switching to inactive frames */ -#ifdef NONBE_FIX_GSC_BSTR Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->L_frame, st->total_brate, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /* update past excitation signals for LD music post-filter */ IF( st->hMusicPF != NULL ) @@ -1766,23 +1687,14 @@ ivas_error acelp_core_dec_ivas_fx( pRealSave_fx[i] = realBufferSave_fx[i]; pImagSave_fx[i] = imagBufferSave_fx[i]; } -#ifndef MSAN_FIX - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 -#endif IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 -#endif Copy32( bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame ); Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); // Q11 } -#ifdef MSAN_FIX FOR( i = 0; i < st->L_frame; i++ ) -#else - for ( i = 0; i < L_FRAME16k; i++ ) -#endif { syn_32_fx[i] = L_shr( L_deposit_h( psyn_fx[i] ), add( 4, st->Q_syn ) ); // Q12 move32(); @@ -1803,15 +1715,7 @@ ivas_error acelp_core_dec_ivas_fx( q_bpf_error_signal = Q6; move16(); -#ifdef MSAN_FIX -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, st->L_frame, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, st->L_frame, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#endif -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, q_bpf_error_signal - st->Q_syn ); // Q6 -#endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, -Q7 ); // Q0 @@ -1910,9 +1814,6 @@ ivas_error acelp_core_dec_ivas_fx( #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifndef MSAN_FIX - Scale_sig32( save_hb_synth_fx, L_FRAME48k, sub( Q_real, 1 ) ); // Q_real-1 -#endif FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { @@ -1932,11 +1833,7 @@ ivas_error acelp_core_dec_ivas_fx( } } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, 0, st->cldfbSynHB ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, st->cldfbSynHB ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( save_hb_synth_fx, L_FRAME48k, negate( ( sub( Q_real, 1 ) ) ) ); // Q0 Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 @@ -1956,11 +1853,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // Q_real-1 st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( synth_fx, L_FRAME48k, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSynHB->Q_cldfb_state = Q10; @@ -2003,20 +1896,9 @@ ivas_error acelp_core_dec_ivas_fx( #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 ); -#endif -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ -#ifdef MSAN_FIX scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 -#else - Scale_sig32( synth_fx, L_FRAME48k, -( Q_real - 1 ) ); -#endif scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -2030,11 +1912,7 @@ ivas_error acelp_core_dec_ivas_fx( Word16 nSamples = NS2SA_FX2( i_mult( st->L_frame, FRAMES_PER_SEC ), FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ); /* IVAS-64: optimization is likely possible here (don't resample the whole frame) */ /* analysis of the synthesis at internal sampling rate - needed for DFT stereo -> TD stereo switching */ -#ifndef MSAN_FIX - for ( i = 0; i < L_FRAME16k; i++ ) -#else FOR( i = 0; i < st->L_frame; i++ ) -#endif { syn_32_fx[i] = L_shr( L_deposit_h( psyn_fx[i] ), add( 4, st->Q_syn ) ); move32(); @@ -2057,11 +1935,7 @@ ivas_error acelp_core_dec_ivas_fx( // Get Q-factor q_bpf_error_signal = Q6; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, -Q7 ); // Q0 @@ -2116,21 +1990,10 @@ ivas_error acelp_core_dec_ivas_fx( #else /* OPT_STEREO_32KBPS_V1 */ scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 ); -#endif -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ -#ifdef MSAN_FIX Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 -#else - Scale_sig32( synth_fx, L_FRAME48k, -( Q_real - 1 ) ); -#endif Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -2146,11 +2009,7 @@ ivas_error acelp_core_dec_ivas_fx( } /* Copy output signal */ -#ifndef MSAN_FIX - Scale_sig( syn_tmp_fx, L_FRAME16k + L_SUBFR, -st->Q_syn ); -#else Scale_sig( syn_tmp_fx, add( st->L_frame, L_SUBFR ), negate( st->Q_syn ) ); // Q0 -#endif IF( st->element_mode > EVS_MONO ) { Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/ @@ -2173,24 +2032,14 @@ ivas_error acelp_core_dec_ivas_fx( IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 -#else - Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); -#endif hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); -#ifdef MSAN_FIX Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 ); -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, L_FRAME48k, 0 ); -#endif } ELSE { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } } @@ -2225,11 +2074,7 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( !st->ppp_mode_dec && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#else - Copy_Scale_sig_16_32_DEPREC( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#endif non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } @@ -2270,18 +2115,7 @@ ivas_error acelp_core_dec_ivas_fx( { Copy_Scale_sig_32_16( save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0 ); // Q0 } -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2 -#else - Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); -#endif -#ifndef FIX_1100_REMOVE_LPC_RESCALING - if ( st->hFdCngDec ) - { - st->hFdCngDec->hFdCngCom->A_cng[0] = ONE_IN_Q12; - move16(); - } -#endif } pop_wmops(); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 6a1e60b06..9013f2f03 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -128,11 +128,7 @@ ivas_error acelp_core_switch_dec_fx( * Excitation decoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 ); -#else - config_acelp1( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 ); -#endif decod_gen_voic_core_switch_fx( st_fx, L_frame_for_cs, 0, Aq, exc, cbrate, &st_fx->Q_exc ); @@ -819,11 +815,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( *----------------------------------------------------------------*/ /* CLDFB analysis of the synthesis at internal sampling rate */ Qtmp = sub( 11, st_fx->Q_syn ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( syn, syn32, L_FRAME16k, Qtmp ); // Q(11) -#else - Copy_Scale_sig_16_32_DEPREC( syn, syn32, L_FRAME16k, Qtmp ); // Q(11) -#endif IF( NE_32( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbAna ) ), IVAS_ERR_OK ) ) { return error; @@ -845,11 +837,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( move16(); Copy_Scale_sig_16_32_DEPREC( synth_out, synth32, L_FRAME48k, 5 ); /*11-5-1*/ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), 0, st_fx->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), st_fx->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( st_fx->cldfbSyn->cldfb_state_fx, st_fx->cldfbSyn->cldfb_state_length, -1 ); // Q_cldfb_state-1 st_fx->cldfbSyn->Q_cldfb_state = sub( st_fx->cldfbSyn->Q_cldfb_state, 1 ); move16(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 1f6b0dd51..05125318f 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -898,9 +898,7 @@ ivas_error core_switching_post_dec_fx( HQ_DEC_HANDLE hHQ_core; ivas_error error; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( last_element_mode ); -#endif hBWE_TD = st_fx->hBWE_TD; hBWE_FD = st_fx->hBWE_FD; hHQ_core = st_fx->hHQ_core; @@ -2058,11 +2056,7 @@ static void core_switch_lb_upsamp_fx( } /* synthesis of the combined signal */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ /*rescaling whole buffer to a common Q*/ no_col = st->cldfbSyn->no_col; @@ -2100,13 +2094,8 @@ static void smoothTransitionDtxToTcx_fx( Word16 i, filter_len; Word16 w, step, fade_in; Word32 mem; -#ifdef MSAN_FIX - Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; -#else Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; -#endif set16_fx( smoothing_input_buffer, 0, 2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k ); set16_fx( smoothing_out_buffer, 0, 2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k ); @@ -2241,10 +2230,8 @@ ivas_error core_switching_pre_dec_ivas_fx( test(); IF( st->hBWE_TD != NULL && ( st->last_core != ACELP_CORE ) ) { -#ifdef MSAN_FIX st->hBWE_TD->prev_hb_synth_fx_exp = 31; move16(); -#endif // MSAN_FIX /* reset BWE memories */ set16_fx( st->hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; @@ -2262,9 +2249,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2379,11 +2364,7 @@ ivas_error core_switching_pre_dec_ivas_fx( return error; } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ cldfb_restore_memory_ivas_fx( st->cldfbSyn ); Copy_Scale_sig_32_16( syn_Overl_fx, st->hTcxDec->syn_Overl, 320, 15 ); Copy_Scale_sig_32_16( fer_samples_fx, st->hHQ_core->fer_samples_fx, 960, 9 ); @@ -2587,9 +2568,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2639,9 +2618,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2662,11 +2639,7 @@ ivas_error core_switching_pre_dec_ivas_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for old_synth_lenFB (32 bit) \n" ) ); } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hTcxDec->old_synthFB_fx, old_synthFB_fx, st->hTcxDec->old_synth_lenFB, sub( Q10, Q_old_synthFB ) ); // Q10 -#else - Copy_Scale_sig_16_32_DEPREC( st->hTcxDec->old_synthFB_fx, old_synthFB_fx, st->hTcxDec->old_synth_lenFB, sub( Q10, Q_old_synthFB ) ); // Q10 -#endif Copy32( old_synthFB_fx + st->hTcxDec->old_synth_lenFB - offset, st->cldfbAna->cldfb_state_fx, offset ); st->cldfbAna->Q_cldfb_state = Q10; move16(); diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index bdfac224f..325beb9f3 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -693,11 +693,7 @@ ivas_error decod_gen_voic_ivas_fx( * Transform domain contribution decoding *-----------------------------------------------------------------*/ test(); -#ifdef NONBE_FIX_GSC_BSTR IF( !st_fx->inactive_coder_type_flag && st_fx->coder_type == INACTIVE ) -#else - IF( GE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && ( st_fx->coder_type == INACTIVE ) ) -#endif { transf_cdbk_dec_fx( st_fx, harm_flag_acelp, i_subfr_fx, Es_pred_fx, gain_code_fx, &gain_preQ_fx, &norm_gain_preQ_fx, code_preQ_fx, unbits ); } diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 8ff50f8a5..e2ea02dcc 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -2682,11 +2682,7 @@ void IMDCT_ivas_fx( } move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE set16_fx( win_fx, 0, ( L_FRAME_PLUS + L_MDCT_OVLP_MAX ) >> 1 ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - set16_fx( win_fx, 0, shr( add( L_FRAME_PLUS, L_MDCT_OVLP_MAX ), 1 ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 tcx_offset_tmp = add( tcx_offset, shr( L_ola, 1 ) ); set16_fx( xn_buf_fx, 0, tcx_offset_tmp ); /* zero left end of buffer */ @@ -2865,16 +2861,10 @@ void IMDCT_ivas_fx( q_tmp_fx_32 = q_xn_buf_fx_32; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 diff = sub( q_tmp_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx_32[ind] = L_shl( old_out_fx[ind], diff ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx_32[ind] = L_shl( old_out_fx[ind], sub( q_tmp_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move32(); } @@ -2882,13 +2872,8 @@ void IMDCT_ivas_fx( FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx[ind] = extract_l( L_shr( old_out_fx_32[ind], diff ) ); xn_buf_fx[ind] = extract_l( L_shr( xn_buf_fx_32[ind], diff ) ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx[ind] = (Word16) L_shr( old_out_fx_32[ind], sub( q_tmp_fx_32, q_win ) ); - xn_buf_fx[ind] = (Word16) L_shr( xn_buf_fx_32[ind], sub( q_tmp_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move16(); move16(); } @@ -2912,39 +2897,24 @@ void IMDCT_ivas_fx( q_tmp_fx_32 = sub( q_xn_buf_fx_32, res_e ); // v_multc_fixed( xn_buf_fx_32 + overlap / 2 + nz, (float) sqrt( (float) L_frame / NORM_MDCT_FACTOR ), tmp_fx_32, L_frame ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 q_diff = sub( q_xn_buf_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE xn_buf_fx[( ind + ( overlap / 2 ) ) + nz] = extract_l( L_shr( xn_buf_fx_32[( ind + ( overlap / 2 ) ) + nz], q_diff ) ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - xn_buf_fx[( ind + ( overlap / 2 ) ) + nz] = (Word16) L_shr( xn_buf_fx_32[( ind + ( overlap / 2 ) ) + nz], sub( q_xn_buf_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move16(); } window_ola_fx( tmp_fx_32, xn_buf_fx, &q_tmp_fx_32, old_out_fx, &q_old_out, L_frame, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE q_diff = sub( q_old_out, q_win ); Word16 diff = sub( q_tmp_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx[ind] = shr_sat( old_out_fx[ind], q_diff ); move16(); xn_buf_fx[ind] = shr_sat( xn_buf_fx[ind], diff ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx[ind] = shr_sat( old_out_fx[ind], sub( q_old_out, q_win ) ); - move16(); - xn_buf_fx[ind] = shr_sat( xn_buf_fx[ind], sub( q_tmp_fx_32, q_win ) ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } } aldo = 1; @@ -4441,11 +4411,7 @@ void decoder_tcx_noisefilling_fx( /* get the starting location of the subframe in the frame */ IF( EQ_16( st->core, TCX_10_CORE ) ) { -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->subframe_fx = extract_l( L_mult0( frame_cnt, L_frameTCX_glob ) ); -#else - st->hPlcInfo->subframe = extract_l( L_mult0( frame_cnt, L_frameTCX_glob ) ); -#endif move16(); } } diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index f9833e80a..0bc7794dc 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -713,7 +713,6 @@ void decision_matrix_dec_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ @@ -727,6 +726,5 @@ void decision_matrix_dec_fx( move16(); } -#endif return; } diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index c509d5d10..df18d3dba 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -187,9 +187,7 @@ void initFdCngDec_ivas_fx( st->CNG_mode = -1; move16(); Copy( st->lsp_old_fx, st->lspCNG_fx, M ); /*Q15*/ -#ifdef MSAN_FIX hFdCngDec->hFdCngCom->sid_frame_counter = 0; -#endif return; } @@ -1765,12 +1763,8 @@ Word16 ApplyFdCng_ivas_fx( { FOR( ; j <= hFdCngCom->part[k]; j++ ) { -#ifdef FIX_ISSUE_1218 /* NOTE: saturation is added here as part of issue 1218 fix. after rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ cngNoiseLevel[j] = L_shl_sat( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ -#else - cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ -#endif move32(); } } @@ -5275,11 +5269,7 @@ void generate_stereo_masking_noise_fx( IF( st->idchan == 0 ) { hFdCngCom = st->hFdCngDec->hFdCngCom; -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ -#else - Copy_Scale_sig_16_32_DEPREC( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ -#endif Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ set32_fx( &Np_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); @@ -5287,11 +5277,7 @@ void generate_stereo_masking_noise_fx( IF( !fadeOut ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ -#else - Copy_Scale_sig_16_32_DEPREC( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ -#endif generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 /* Generate masking noise for secondary channel */ IF( flag_sec_CNA ) diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c index 6c63377fd..8f29eb9d1 100644 --- a/lib_dec/gs_dec_fx.c +++ b/lib_dec/gs_dec_fx.c @@ -92,11 +92,7 @@ void decod_audio_fx( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics @@ -522,11 +518,7 @@ void decod_audio_ivas_fx( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics @@ -1372,14 +1364,10 @@ void gsc_dec_ivas_fx( } pvq_core_dec_fx( st_fx, gsc_sfm_start, gsc_sfm_end, gsc_sfm_size, concat_out, &Q_tmp, bit, nb_subbands, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE ); -#ifdef MSAN_FIX IF( nb_subbands > 0 ) { Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */ } -#else - Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */ -#endif seed_init = 0; move16(); @@ -1435,11 +1423,7 @@ void gsc_dec_ivas_fx( } if ( concat_out[j] < 0 ) { -#ifdef BASOP_NOGLOB_TMP_715 seed_init = add_sat( seed_init, 3 ); /* Q0 */ -#else - seed_init = add( seed_init, 3 ); -#endif } } diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 714245514..4d1ef6774 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -627,9 +627,7 @@ void ivas_hq_core_dec_fx( set16_fx( gapsynth_fx, 0, L_FRAME48k ); set16_fx( num_bands_p, 0, MAX_SB_NB ); set16_fx( ynrm, 39, NB_SFM ); /* Initialize to the smallest value */ -#ifdef MSAN_FIX set16_fx( wtda_audio_16, 0, 2 * L_FRAME48k ); -#endif mean_en_high_fx = 0; move16(); Q_audio = 12; @@ -951,9 +949,6 @@ void ivas_hq_core_dec_fx( index = tcx_cfg->tcx_last_overlap_mode; /* Q0 */ move16(); -#ifndef MSAN_FIX - Copy_Scale_sig_32_16( wtda_audio, wtda_audio_16, 2 * L_FRAME48k, -13 ); -#endif /* LB synthesis */ E_audio = sub( 31, Q_audio ); diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c index d72f0ec45..89864bc3b 100644 --- a/lib_dec/hq_hr_dec_fx.c +++ b/lib_dec/hq_hr_dec_fx.c @@ -100,7 +100,6 @@ void hq_pred_hb_bws_fx( } ELSE { -#ifdef EVS_FUNC_MODIFIED st_fx->prev_ener_shb_fx = 0; move16(); L_tmp = L_deposit_l( 0 ); @@ -111,15 +110,6 @@ void hq_pred_hb_bws_fx( L_tmp = Mpy_32_16_1( L_tmp, 2979 ); // Q1 st_fx->prev_ener_shb_fx = extract_l( L_tmp ); /*Q1*/ move16(); -#else - st_fx->prev_ener_shb_fx = 0; - move16(); - FOR( i = 0; i < SWB_FENV - 3; i++ ) - { - st_fx->prev_ener_shb_fx = add( st_fx->prev_ener_shb_fx, SWB_fenv[i] ); /*Q1*/ - } - st_fx->prev_ener_shb_fx = mult( st_fx->prev_ener_shb_fx, 2979 ); /*Q1*/ -#endif } } diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 5bfa7476a..60e649a08 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2883,9 +2883,6 @@ static void IGF_getWhiteSpectralData_ivas( Word16 j; Word32 ak; Word16 ak_e; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Word16 tmp_16; -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 tmp_e; Word16 out_e_arr[IGF_START_MX + MAX_IGF_SFB_LEN]; Word16 max_out_e; @@ -2904,23 +2901,18 @@ static void IGF_getWhiteSpectralData_ivas( Word16 guard_bits = add( find_guarded_bits_fx( add( i_mult( 2, level ), 1 ) ), 1 ) / 2; s_l = sub( s_l, guard_bits ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 shift = sub( shl( s_l, 1 ), 32 ); Word16 eff_e = sub( shl( sub( in_e, s_l ), 1 ), 15 ); Word16 diff = add( 21, in_e ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 quo = BASOP_Util_Divide3216_Scale( ONE_IN_Q30, add( shl( level, 1 ), 1 ), &tmp_e ); tmp_e = add( tmp_e, 1 ); ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15 -#ifdef OPT_SBA_AVOID_SPAR_RESCALE ak_e = sub( ak_e, 1 ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = start; i < stop - level; i++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word64 temp = 0; move64(); FOR( j = i - level; j < i + level + 1; j++ ) @@ -2935,30 +2927,11 @@ static void IGF_getWhiteSpectralData_ivas( out_e_arr[i] = sub( diff, n ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ak = 0; - move32(); - move32(); - FOR( j = i - level; j < i + level + 1; j++ ) - { - tmp_16 = extract_h( L_shl( in[j], s_l ) ); // e: in_e - s_l - ak = L_mac( ak, tmp_16, tmp_16 ); // e: 2 * (in_e - s_l) - } - ak = Mult_32_16( ak, quo ); // add( shl( level, 1 ), 1 ), &tmp_e ) ); - - - n = sub( 30, add( norm_l( ak ), sub( 31, ak_e ) ) ); - n = shr( n, 1 ); - - out_e_arr[i] = add( sub( 21, n ), in_e ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ max_out_e = s_max( max_out_e, out_e_arr[i] ); } FOR( ; i < stop; i++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word64 temp = 0; move64(); @@ -2974,24 +2947,6 @@ static void IGF_getWhiteSpectralData_ivas( out_e_arr[i] = sub( diff, n ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ak = 0; - move32(); - - FOR( j = i - level; j < stop; j++ ) - { - tmp_16 = extract_h( L_shl( in[j], s_l ) ); // e: in_e - s_l - ak = L_mac( ak, tmp_16, tmp_16 ); // e: 2 * (in_e - s_l) - } - ak = L_deposit_h( BASOP_Util_Divide3216_Scale( ak, sub( stop, sub( i, level ) ), &tmp_e ) ); - ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15 - - n = sub( 30, add( norm_l( ak ), sub( 31, ak_e ) ) ); - n = shr( n, 1 ); - - out_e_arr[i] = add( sub( 21, n ), in_e ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ max_out_e = s_max( max_out_e, out_e_arr[i] ); } diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 934433132..b588fdce1 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -315,10 +315,8 @@ ivas_error init_decoder_fx( move16(); /*1; Q15*/ st_fx->exc_pe_fx = 0; // Q_stat_noise move16(); -#ifdef MSAN_FIX st_fx->Q_stat_noise = 31; move16(); -#endif // MSAN_FIX /*-----------------------------------------------------------------* * LD music post-filter *-----------------------------------------------------------------*/ @@ -1036,10 +1034,8 @@ ivas_error init_decoder_ivas_fx( move16(); st_fx->exc_pe_fx = 0; move16(); -#ifdef MSAN_FIX st_fx->Q_stat_noise = 31; move16(); -#endif st_fx->prev_coder_type = GENERIC; move16(); @@ -1139,9 +1135,7 @@ ivas_error init_decoder_ivas_fx( } hf_synth_init_fx( st_fx->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } ELSE { diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 85fefadbc..f78f14e8e 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -66,17 +66,11 @@ static void ivas_binRenderer_filterModule_fx( { Word16 bandIdx, k, chIdx, tapIdx; Word32 *filterStatesLeftRealPtr_fx, *filterStatesLeftImagPtr_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStates; -#else /* OPT_BASOP_ADD_v1 */ - Word16 *Q_filterStates; -#endif /* OPT_BASOP_ADD_v1 */ const Word32 *filterTapsLeftRealPtr_fx, *filterTapsLeftImagPtr_fx, *filterTapsRightRealPtr_fx, *filterTapsRightImagPtr_fx; Word16 shift_q; -#ifdef OPT_BASOP_ADD_v1 Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStatesLeft; move16(); -#endif /* OPT_BASOP_ADD_v1 */ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -84,9 +78,6 @@ static void ivas_binRenderer_filterModule_fx( { filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] ); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates = (Word16 *) &( hBinRenderer->hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx][0] ); -#endif /* OPT_BASOP_ADD_v1 */ filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29 filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29 @@ -108,13 +99,6 @@ static void ivas_binRenderer_filterModule_fx( filterStatesLeftImagPtr_fx[tapIdx] = filterStatesLeftImagPtr_fx[tapIdx - 1]; move32(); -#ifndef OPT_BASOP_ADD_v1 - shift_q = sub( Q_filterStates[tapIdx], Q_filterStates[tapIdx - 1] ); - outRealLeft_fx = W_shr( outRealLeft_fx, shift_q ); - outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); - outRealRight_fx = W_shr( outRealRight_fx, shift_q ); - outImagRight_fx = W_shr( outImagRight_fx, shift_q ); -#endif /* OPT_BASOP_ADD_v1 */ outRealLeft_fx = W_mac_32_32( outRealLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates outRealLeft_fx = W_mac_32_32( outRealLeft_fx, L_negate( filterStatesLeftImagPtr_fx[tapIdx] ), filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates @@ -127,40 +111,24 @@ static void ivas_binRenderer_filterModule_fx( outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates[tapIdx] = Q_filterStates[tapIdx - 1]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ } -#ifdef OPT_BASOP_ADD_v1 shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); -#else /* OPT_BASOP_ADD_v1 */ - shift_q = add( sub( Q_filterStates[1], Q_curr ), 1 ); -#endif /* OPT_BASOP_ADD_v1 */ -#ifdef OPT_BASOP_ADD_v1 IF( shift_q != 0 ) { -#endif /* OPT_BASOP_ADD_v1 */ outRealLeft_fx = W_shr( outRealLeft_fx, shift_q ); // Q_curr outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); // Q_curr outRealRight_fx = W_shr( outRealRight_fx, shift_q ); // Q_curr outImagRight_fx = W_shr( outImagRight_fx, shift_q ); // Q_curr -#ifdef OPT_BASOP_ADD_v1 hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx]; move32(); filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx]; move32(); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates[0] = Q_curr; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ /* Left Real and Imag */ @@ -346,12 +314,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft = (Word16 ***) malloc( hBinRenderer->conv_band * sizeof( Word16 ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -365,12 +327,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[bandIdx] = (Word16 **) malloc( hBinRenderer->nInChannels * sizeof( Word16 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { @@ -384,12 +340,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] = (Word16 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ } } /* set memories */ @@ -434,12 +384,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); -#endif /* OPT_BASOP_ADD_v1 */ IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp]; @@ -453,12 +399,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); -#endif /* OPT_BASOP_ADD_v1 */ IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp]; @@ -1323,10 +1265,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] ); - hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); @@ -1335,10 +1273,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft[bandIdx] ); - hBinRenConvModule->Q_filterStatesLeft[bandIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx ); @@ -1347,10 +1281,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx ); hBinRenConvModule->filterStatesLeftImag_fx = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft ); - hBinRenConvModule->Q_filterStatesLeft = NULL; -#endif /* OPT_BASOP_ADD_v1 */ free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 37c32a8b1..4e654030b 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -336,11 +336,7 @@ ivas_error ivas_core_dec_fx( Word16 ovl, fade_len; IF( NE_16( sts[0]->L_frame, sts[0]->last_L_frame ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, sts[0]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, sts[0]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#endif L_lerp_fx_q11( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->L_frame, sts[0]->last_L_frame ); Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( sts[0]->hHQ_core->Q_old_wtda_LB, Q11 ) ); // Q_old_wtda_LB } @@ -527,11 +523,7 @@ ivas_error ivas_core_dec_fx( return error; } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 -#else - Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 -#endif Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 IF( st->cldfbAna ) { @@ -551,9 +543,6 @@ ivas_error ivas_core_dec_fx( st->cldfbSyn->Q_cldfb_state = Q11; move16(); } -#ifndef FIX_ISSUE_1279 /* the update of prev_Q_syn is already done inside rescale_mem( ) */ - st->prev_Q_syn = st->Q_syn; -#endif move16(); IF( save_hb_synth_32_fx ) @@ -641,11 +630,7 @@ ivas_error ivas_core_dec_fx( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_output ) ); // Q11 -#ifdef MSAN_FIX Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 -#else - Scale_sig( synth_16_fx[n], L_FRAME48k, negate( Q_synth ) ); -#endif Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 } @@ -660,11 +645,7 @@ ivas_error ivas_core_dec_fx( td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 -#endif } } /* n_channels loop */ @@ -910,19 +891,11 @@ ivas_error ivas_core_dec_fx( /* Memories Re-Scaling */ IF( hBWE_TD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, hBWE_TD->prev_Q_bwe_syn2 ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, st->prev_Q_bwe_syn2 ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, st->prev_Qx ) ); // Q11 -#endif Copy( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->state_32and48k_WB_upsample_fx, ( 2 * ALLPASSSECTIONS_STEEP ) ); } @@ -936,11 +909,7 @@ ivas_error ivas_core_dec_fx( test(); IF( sba_dirac_stereo_flag && NE_16( st->element_mode, IVAS_CPE_MDCT ) && !( EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#else - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#endif } IF( NE_32( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode, &Q_synth ) ), IVAS_ERR_OK ) ) @@ -954,11 +923,7 @@ ivas_error ivas_core_dec_fx( test(); IF( sba_dirac_stereo_flag && hSCE && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#else - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#endif } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ @@ -985,11 +950,7 @@ ivas_error ivas_core_dec_fx( } ELSE { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->delay_buf_out_fx, st->delay_buf_out32_fx, ( HQ_DELTA_MAX * HQ_DELAY_COMP ), sub( Q11, st->hHQ_core->Q_old_postdec ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( st->delay_buf_out_fx, st->delay_buf_out32_fx, ( HQ_DELTA_MAX * HQ_DELAY_COMP ), sub( Q11, st->hHQ_core->Q_old_postdec ) ); // Q11 -#endif } Scale_sig32( output_32_fx[n], L_FRAME48k, ( Q11 - Q4 ) ); // Q11 @@ -1003,16 +964,12 @@ ivas_error ivas_core_dec_fx( move16(); } -#ifdef MSAN_FIX IF( Q_synth > 0 ) { Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 Q_synth = 0; move16(); } -#else - Scale_sig( synth_16_fx[n], L_FRAME48k, negate( Q_synth ) ); -#endif /*------------------reset-code-start---------------------*/ @@ -1078,31 +1035,17 @@ ivas_error ivas_core_dec_fx( } /* Memories Re-Scaling */ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, sub( Q11, Q_synth_fx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, sub( Q11, Q_synth_fx ) ); // Q11 -#endif IF( hBWE_FD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_FD->L_old_wtda_swb_fx, hBWE_FD->L_old_wtda_swb_fx32, L_FRAME48k, sub( Q11, hBWE_FD->old_wtda_swb_fx_exp ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_FD->L_old_wtda_swb_fx, hBWE_FD->L_old_wtda_swb_fx32, L_FRAME48k, sub( Q11, hBWE_FD->old_wtda_swb_fx_exp ) ); // Q11 -#endif } IF( hBWE_TD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#endif } /*---------------------------------------------------------------------* @@ -1205,11 +1148,7 @@ ivas_error ivas_core_dec_fx( q = 2; move16(); Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 -#else - Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, L_FRAME48k, negate( add( Q11, q ) ) ); -#endif Scale_sig( hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, hBWE_TD->prev_Q_bwe_syn ) ); // Q8 Copy_Scale_sig_32_16( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, ( 2 * ALLPASSSECTIONS_STEEP ), sub( hBWE_TD->prev_Q_bwe_syn2, Q11 ) ); // prev_Q_bew_syn2 @@ -1242,7 +1181,6 @@ ivas_error ivas_core_dec_fx( move32(); } stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q, Q_white_exc ); -#ifdef MSAN_FIX test(); test(); test(); @@ -1254,10 +1192,6 @@ ivas_error ivas_core_dec_fx( Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); // Q11 Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); // Q11 } -#else - Scale_sig32( hb_synth_32_fx[0], L_FRAME48k, sub( Q11, q ) ); - Scale_sig32( hb_synth_32_fx[1], L_FRAME48k, sub( Q11, q ) ); -#endif } IF( EQ_16( st->element_mode, EVS_MONO ) ) @@ -1286,11 +1220,7 @@ ivas_error ivas_core_dec_fx( } waveform_adj2_fix( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, tmps, add( st->hPlcInfo->nbLostCmpt, 1 ), st->bfi ); -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->Pitch_fx = 0; -#else - st->hPlcInfo->Pitch = 0; -#endif move16(); } } @@ -1476,13 +1406,8 @@ ivas_error ivas_core_dec_fx( IF( st->hHQ_core != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, st->hHQ_core->Q_old_wtda_LB ) ); // Q11 Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, st->hHQ_core->Q_old_wtda ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, st->hHQ_core->Q_old_wtda_LB ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, st->hHQ_core->Q_old_wtda ) ); // Q11 -#endif } IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 05fec7736..c10c6beda 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -124,22 +124,14 @@ ivas_error ivas_cpe_dec_fx( test(); IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda ) ); // Q11 -#endif } } FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { IF( hCPE->hCoreCoder[ind1]->hHQ_core ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#endif hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = Q11; move16(); } diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index ae4098f19..b45f54d48 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2113,11 +2113,7 @@ void ivas_dirac_dec_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { -#ifdef MSAN_FIX ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local_fx, nchan_transport, NULL, NULL ); -#else - ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local, nchan_transport, NULL, NULL ); -#endif // MSAN_FIX n_samples_sf = i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->slot_size ); @@ -3747,11 +3743,7 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[ch]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col; move16(); @@ -3854,11 +3846,7 @@ void ivas_dirac_dec_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; move32(); } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, 0, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ IF( !st_ivas->hLsSetupCustom->separate_ch_found ) { @@ -3898,11 +3886,7 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub( ( Q6 - 1 ), st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state ) ); // Q6-1 st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[cldfbSynIdx] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[cldfbSynIdx] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ // Calculating length of output Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col; @@ -3971,11 +3955,7 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ // Scaling output from Q6-1 to Q11 Scale_sig32( p_out, out_len, ( Q11 - ( Q6 - 1 ) ) ); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index b247fd653..114083fad 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -723,11 +723,7 @@ Word16 computeMixingMatrices_fx( Word32 G_hat_fx[MAX_OUTPUT_CHANNELS]; Word16 G_hat_buff_e[MAX_OUTPUT_CHANNELS]; -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer2_e, mat_mult_buffer3_e; -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer1_e, mat_mult_buffer2_e, mat_mult_buffer3_e; -#endif /* OPT_BASOP_ADD_v1 */ Word32 mat_mult_buffer3_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; @@ -777,9 +773,7 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( Cy_fx, svd_in_buffer_fx, lengthCy, lengthCy, 0 ); svd_fx( svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCy, lengthCy ); -#ifdef OPT_BASOP_ADD_v1 Word16 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ /* Computing Ky */ FOR( i = 0; i < lengthCy; ++i ) { @@ -792,12 +786,9 @@ Word16 computeMixingMatrices_fx( move32(); Ky_fx_e[i + ( j * lengthCy )] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCy * lengthCy; ++i ) { Ky_fx[i] = L_shr( Ky_fx[i], sub( max_e, Ky_fx_e[i] ) ); @@ -805,7 +796,6 @@ Word16 computeMixingMatrices_fx( Ky_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Decomposition of Cx @@ -816,9 +806,7 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( Cx_fx, svd_in_buffer_fx, lengthCx, lengthCx, 0 ); svd_fx( svd_in_buffer_fx, Cx_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCx, lengthCx ); -#ifdef OPT_BASOP_ADD_v1 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { FOR( j = 0; j < lengthCx; ++j ) @@ -830,12 +818,9 @@ Word16 computeMixingMatrices_fx( move32(); Kx_fx_e[( i + ( j * lengthCx ) )] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCx * lengthCx; ++i ) { Kx_fx[i] = L_shr( Kx_fx[i], sub( max_e, Kx_fx_e[i] ) ); @@ -843,7 +828,6 @@ Word16 computeMixingMatrices_fx( Kx_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { @@ -967,49 +951,15 @@ Word16 computeMixingMatrices_fx( /* Computing the input matrix Kx'*Q'*G_hat'*Ky */ -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer1_fx_e; -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer1_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - Word16 Q_e_arr[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS]; - set16_fx( Q_e_arr, Q_e, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); - - matrix_product_mant_exp( Kx_fx, Kx_fx_e, lengthCx, lengthCx, 1, Q_fx, Q_e_arr, lengthCy, lengthCx, 1, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mat_mult_buffer2_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Kx_fx, Kx_fx_e[0], lengthCx, lengthCx, 1, Q_fx, Q_e, lengthCy, lengthCx, 1, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); matrix_diag_product_fx_2( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCx, lengthCy, 0, G_hat_fx, G_hat_buff_e, lengthCy, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); matrix_product_mant_exp_fx( mat_mult_buffer2_fx, mat_mult_buffer2_fx_e[0], lengthCx, lengthCy, 0, Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_diag_product_fx_1( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCx, lengthCy, 0, G_hat_fx, G_hat_buff_e, lengthCy, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); - - matrix_product_mant_exp( mat_mult_buffer2_fx, mat_mult_buffer2_fx_e, lengthCx, lengthCy, 0, Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); - - exp = mat_mult_buffer1_fx_e[0]; - move16(); - FOR( i = 1; i < lengthCy * lengthCx; i++ ) - { - if ( LT_16( exp, mat_mult_buffer1_fx_e[i] ) ) - { - exp = mat_mult_buffer1_fx_e[i]; - move16(); - } - } - - FOR( i = 0; i < lengthCy * lengthCx; i++ ) - { - mat_mult_buffer1_fx[i] = L_shr( mat_mult_buffer1_fx[i], sub( exp, mat_mult_buffer1_fx_e[i] ) ); // Q(31-exp) - move32(); - } - - mat_mult_buffer1_e = exp; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ IF( LT_16( lengthCx, lengthCy ) ) { @@ -1018,11 +968,7 @@ Word16 computeMixingMatrices_fx( move16(); nC = lengthCx; move16(); -#ifdef OPT_BASOP_ADD_v1 svd_fx( svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, svd_s_buffer_e, nL, nC ); -#else /* OPT_BASOP_ADD_v1 */ - svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, svd_s_buffer_e, nL, nC ); -#endif /* OPT_BASOP_ADD_v1 */ } ELSE { @@ -1031,11 +977,7 @@ Word16 computeMixingMatrices_fx( move16(); nC = lengthCy; move16(); -#ifdef OPT_BASOP_ADD_v1 svd_fx( svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, nL, nC ); -#else /* OPT_BASOP_ADD_v1 */ - svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, nL, nC ); -#endif /* OPT_BASOP_ADD_v1 */ } /* Actually Processing P */ @@ -1046,46 +988,25 @@ Word16 computeMixingMatrices_fx( svdMat2mat_fx( svd_v_buffer_fx, mat_mult_buffer1_fx, lengthCy, lengthCx ); svdMat2mat_fx( svd_u_buffer_fx, mat_mult_buffer2_fx, lengthCx, lengthCx ); -#ifdef OPT_BASOP_ADD_v1 mat_mult_buffer1_fx_e = 0; -#else /* OPT_BASOP_ADD_v1 */ - mat_mult_buffer1_e = 0; -#endif /* OPT_BASOP_ADD_v1 */ move16(); mat_mult_buffer2_e = 0; move16(); -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer2_fx, mat_mult_buffer2_e, lengthCx, lengthCx, 1, mat_mult_buffer3_fx, &mat_mult_buffer3_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp_fx( mat_mult_buffer1_fx, mat_mult_buffer1_e, lengthCy, lengthCx, 0, - mat_mult_buffer2_fx, mat_mult_buffer2_e, lengthCx, lengthCx, 1, - mat_mult_buffer3_fx, &mat_mult_buffer3_e ); -#endif /* OPT_BASOP_ADD_v1 */ /************************ Formulate M **********************/ -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer3_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - set16_fx( mat_mult_buffer3_fx_e, mat_mult_buffer3_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); - - matrix_product_mant_exp( Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer1_fx_e1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; set16_fx( mat_mult_buffer1_fx_e1, mat_mult_buffer1_fx_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1, lengthCy, lengthCx, 0, Kx_reg_inv_fx, Kx_reg_inv_e, lengthCx, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, Kx_reg_inv_fx, Kx_reg_inv_e, lengthCx, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Formulate Cr @@ -1096,15 +1017,9 @@ Word16 computeMixingMatrices_fx( Word16 Cx_e_arr[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; set16_fx( Cx_e_arr, Cx_fx_e, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1 ); matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1, lengthCy, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 1, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); - - matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 1, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ exp = mixing_matrix_fx_e[0]; move16(); @@ -1143,11 +1058,7 @@ Word16 computeMixingMatrices_fx( } /* Avoid Meaningless negative main diagonal elements */ -#ifdef OPT_BASOP_ADD_v1 IF( Cr_fx[i + ( i * lengthCy )] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Cr_fx[i + ( i * lengthCy )], exp, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { Cr_fx[i + ( i * lengthCy )] = 0; move32(); @@ -1209,11 +1120,7 @@ Word16 computeMixingMatrices_fx( { /* Avoid correction for very small energies, main diagonal elements of Cy_tilde_p may be negative */ -#ifdef OPT_BASOP_ADD_v1 IF( Cy_tilde_p_fx[i + ( i * lengthCy )] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Cy_tilde_p_fx[i + ( i * lengthCy )], mat_mult_buffer2_e, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -1232,12 +1139,8 @@ Word16 computeMixingMatrices_fx( move16(); } -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, adj_e[i] ) ); IF( GT_32( adj_fx_p[i], temp ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx_p[i], adj_e[i], 1073741824, 3 ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -1322,11 +1225,7 @@ Word16 computeMixingMatricesResidual_fx( Word16 mixing_matrix_e = 0, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e; move16(); -#ifdef MSAN_FIX Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS] = { 0 }; -#else - Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; -#endif Word16 svd_s_buffer_e[MAX_OUTPUT_CHANNELS]; Word32 L_tmp; Word16 tmp_e; @@ -1370,9 +1269,7 @@ Word16 computeMixingMatricesResidual_fx( svd_fx( svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCy, lengthCy ); /* Computing Ky */ -#ifdef OPT_BASOP_ADD_v1 Word16 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCy; ++i ) { FOR( j = 0; j < lengthCy; ++j ) @@ -1384,13 +1281,10 @@ Word16 computeMixingMatricesResidual_fx( move32(); Ky_fx_e[i + j * lengthCy] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCy * lengthCy; ++i ) { Ky_fx[i] = L_shr( Ky_fx[i], sub( max_e, Ky_fx_e[i] ) ); @@ -1398,7 +1292,6 @@ Word16 computeMixingMatricesResidual_fx( Ky_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Decomposition of Cx @@ -1410,9 +1303,7 @@ Word16 computeMixingMatricesResidual_fx( * square root of the diagonal of Cx */ /* Computing Kx */ -#ifdef OPT_BASOP_ADD_v1 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { exp = Cx_e; @@ -1421,12 +1312,9 @@ Word16 computeMixingMatricesResidual_fx( move32(); Kx_fx_e[i] = exp; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, exp ); -#endif /* OPT_BASOP_ADD_v1 */ } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCx; ++i ) { Kx_fx[i] = L_shr( Kx_fx[i], sub( max_e, Kx_fx_e[i] ) ); @@ -1434,7 +1322,6 @@ Word16 computeMixingMatricesResidual_fx( Kx_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Regularization of Sx @@ -1442,25 +1329,13 @@ Word16 computeMixingMatricesResidual_fx( limit_fx = Kx_fx[0]; move32(); -#ifndef OPT_BASOP_ADD_v1 - limit_e = Kx_fx_e[0]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 1; i < lengthCx; i++ ) { -#ifdef OPT_BASOP_ADD_v1 IF( GT_32( Kx_fx[i], limit_fx ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Kx_fx[i], Kx_fx_e[i], limit_fx, limit_e ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { limit_fx = Kx_fx[i]; move32(); -#ifndef OPT_BASOP_ADD_v1 - limit_e = Kx_fx_e[i]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ } } @@ -1468,11 +1343,7 @@ Word16 computeMixingMatricesResidual_fx( L_tmp = L_add( L_tmp, EPSILLON_FX ); limit_fx = L_tmp; move16(); -#ifdef OPT_BASOP_ADD_v1 limit_e = add( Kx_fx_e[0], reg_Sx_e ); -#else /* OPT_BASOP_ADD_v1 */ - limit_e = add( limit_e, reg_Sx_e ); -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { @@ -1622,15 +1493,8 @@ Word16 computeMixingMatricesResidual_fx( *-----------------------------------------------------------------*/ -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); set16_fx( mat_mult_buffer1_buff_e, mat_mult_buffer1_buff_e[0], MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer3_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - set16_fx( mat_mult_buffer3_fx_e, mat_mult_buffer3_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); - - matrix_product_mant_exp( Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; @@ -1715,12 +1579,8 @@ Word16 computeMixingMatricesResidual_fx( move32(); adj_buff_e[i] = scale; move16(); -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, scale ) ); IF( GT_32( adj_fx_p[i], temp ) ) // 1073741824 -> 1.0f in Q30 -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx_p[i], scale, 1073741824, 3 ) > 0 ) // 1073741824 -> 1.0f in Q30 -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -2115,12 +1975,8 @@ Word16 computeMixingMatricesISM_fx( } } -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, temp_e[i] ) ); IF( GT_32( adj_fx[i], temp ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx[i], temp_e[i], MAX_32, 2 ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx[i] = MAX_32; move32(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 292721723..4770d2193 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1266,9 +1266,7 @@ ivas_error ivas_init_decoder_fx( { return error; } -#ifdef MSAN_FIX set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); -#endif test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) { diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index c818af237..7686a5e8a 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -511,9 +511,7 @@ static ivas_error ivas_param_ism_rendering_init_fx( { set32_fx( hParamIsmRendering->mixing_matrix_lin_old_fx[bin_idx], 0, PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX ); } -#ifdef MSAN_FIX set16_fx( hParamIsmRendering->exp_mixing_matrix_lin_old_fx, 0, CLDFB_NO_CHANNELS_MAX ); -#endif /* memory allocation for proto matrix and interpolator */ IF( ( hParamIsmRendering->proto_matrix_fx = (Word16 *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( Word16 ) ) ) == NULL ) @@ -1535,11 +1533,7 @@ static void ivas_ism_param_dec_render_sf_fx( Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( sub( Q_real, 1 ), Q11 ) ); // Q_real-1 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( Q11, sub( Q_real, 1 ) ) ); // Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1918ce3f3..93e8bb4eb 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -129,10 +129,8 @@ ivas_error ivas_jbm_dec_tc_fx( set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } -#ifdef MSAN_FIX st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); -#endif } Word16 ch; @@ -434,19 +432,13 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } IF( hCPE->hStereoDft != NULL ) { -#ifdef MSAN_FIX IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; @@ -494,9 +486,6 @@ ivas_error ivas_jbm_dec_tc_fx( } } } -#else - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); -#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; move16(); @@ -517,14 +506,10 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx } -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -532,14 +517,10 @@ ivas_error ivas_jbm_dec_tc_fx( { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 } -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -555,7 +536,6 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hStereoDft != NULL ) { -#ifdef MSAN_FIX IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; @@ -603,9 +583,6 @@ ivas_error ivas_jbm_dec_tc_fx( } } } -#else - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 -#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; test(); @@ -971,13 +948,8 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } @@ -1004,24 +976,16 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( 11, hCPE->q_prev_synth_fx ) ); // Q11 -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -1420,13 +1384,8 @@ ivas_error ivas_jbm_dec_tc_fx( IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } @@ -1458,23 +1417,15 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif // MSAN_FIX scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -1916,10 +1867,8 @@ ivas_error ivas_jbm_dec_render_fx( } } -#ifdef MSAN_FIX st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full; move16(); -#endif // MSAN_FIX /*----------------------------------------------------------------* * Update combined orientation access index *----------------------------------------------------------------*/ @@ -2014,7 +1963,6 @@ ivas_error ivas_jbm_dec_render_fx( ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef MSAN_FIX FOR( i = 0; i < st_ivas->nchan_transport; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -2025,16 +1973,6 @@ ivas_error ivas_jbm_dec_render_fx( move32(); } } -#else - FOR( i = 0; i < 15; i++ ) - { - FOR( j = 0; j < 16; j++ ) - { - st_ivas->hIsmRendererData->gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q30 -> Q29 - st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q30 -> Q29 - } - } -#endif ivas_ism2sba_sf_fx( st_ivas->hTcBuffer->tc_fx, p_output_fx, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); Word16 sba_num_chans = imult1616( add( st_ivas->hIntSetup.ambisonics_order, 1 ), add( st_ivas->hIntSetup.ambisonics_order, 1 ) ); FOR( j = 0; j < sba_num_chans; j++ ) @@ -2043,7 +1981,6 @@ ivas_error ivas_jbm_dec_render_fx( } -#ifdef MSAN_FIX FOR( i = 0; i < st_ivas->nchan_transport; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -2054,16 +1991,6 @@ ivas_error ivas_jbm_dec_render_fx( move32(); } } -#else - FOR( i = 0; i < 15; i++ ) - { - FOR( j = 0; j < 16; j++ ) - { - st_ivas->hIsmRendererData->gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q29 -> Q30 - st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q29 -> Q30 - } - } -#endif } /* Binaural rendering */ @@ -2136,11 +2063,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2188,11 +2111,7 @@ ivas_error ivas_jbm_dec_render_fx( hSpar->hMdDec->Q_mixer_mat = 30; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2230,11 +2149,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) /*EXT output = individual objects + HOA3*/ { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output_fx[st_ivas->nchan_ism] ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output_fx[st_ivas->nchan_ism], 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2246,11 +2161,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2262,11 +2173,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2868,11 +2775,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( set16_fx( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available ); /* render the last subframe */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx, L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index b2a8bd30b..4c0e7fcc6 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1862,9 +1862,6 @@ void ivas_param_mc_dec_render_fx( /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; UWord16 nband_synth; -#ifndef MSAN_FIX - UWord16 nchan_out_init, nbands_to_zero; -#endif UWord32 output_Fs; Word16 tmp_q = 0; move16(); @@ -1878,10 +1875,6 @@ void ivas_param_mc_dec_render_fx( nchan_transport = st_ivas->nchan_transport; move16(); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); -#ifndef MSAN_FIX - nchan_out_init = nchan_out_transport; - move16(); -#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); @@ -1891,12 +1884,6 @@ void ivas_param_mc_dec_render_fx( { nchan_out_cldfb = BINAURAL_CHANNELS; set16_fx( channel_active, 1, nchan_out_cldfb ); -#ifndef MSAN_FIX - IF( st_ivas->hCombinedOrientationData ) - { - nchan_out_init = MAX_INTERN_CHANNELS; - } -#endif nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); } ELSE IF( EQ_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) ) @@ -1924,21 +1911,12 @@ void ivas_param_mc_dec_render_fx( /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; move16(); -#ifdef MSAN_FIX FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) -#else - FOR( ch = 0; ch < nchan_out_init; ch++ ) -#endif { FOR( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) { -#ifdef MSAN_FIX set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX ); -#else - set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); - set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); -#endif } } @@ -1973,31 +1951,8 @@ void ivas_param_mc_dec_render_fx( slot_idx_start_cldfb_synth = 0; move16(); -#ifndef FIX_1009_OPT_PARAMMC_RENDER - Flag is_zero = 1; - move32(); -#endif FOR( j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++ ) { -#ifndef FIX_1009_OPT_PARAMMC_RENDER - is_zero = 1; - move16(); - FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++ ) - { - IF( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i] != 0 ) - { - is_zero = 0; - move16(); - } - } - IF( is_zero ) - { - hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0; - move16(); - } - is_zero = 1; - move16(); -#else Flag is_zero = is_zero_arr( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j], hParamMC->h_output_synthesis_cov_state.mixing_matrix_len ); { if ( is_zero != 0 ) @@ -2006,23 +1961,10 @@ void ivas_param_mc_dec_render_fx( move16(); } } -#endif IF( LT_16( st_ivas->hParamMC->band_grouping[j], st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) ) { -#ifndef FIX_1009_OPT_PARAMMC_RENDER - FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++ ) - { - IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0 ) ) - { - is_zero = 0; - move16(); - } - } - IF( is_zero ) -#else is_zero = is_zero_arr( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len ); if ( is_zero != 0 ) -#endif { hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0; move16(); @@ -2247,13 +2189,8 @@ void ivas_param_mc_dec_render_fx( Word16 len = add( imult1616( slot_idx_start_cldfb_synth, hParamMC->num_freq_bands ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ) ); scale_sig32( output_f_fx[ch], len, 5 - 11 ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), - imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( output_f_fx[ch], len, 11 - 5 ); // Q11 } @@ -2742,9 +2679,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); set_zero_fx( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); -#ifdef MSAN_FIX set_zero_fx( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); -#endif Word16 proto_matrix_noLFE_e = 0; move16(); @@ -2941,11 +2876,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( FOR( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ ) { -#ifdef OPT_BASOP_ADD_v1 if ( Cproto_diag_fx[ch_idx1] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - if ( BASOP_Util_Cmp_Mant32Exp( Cproto_diag_fx[ch_idx1], Cproto_diag_e, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { Cproto_diag_fx[ch_idx1] = 0; move16(); diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index f4d6cb535..40f9f46e2 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -716,13 +716,8 @@ static void ivas_mc_paramupmix_dec_sf( Word16 noparamupmix_delay, n_samples_rendered; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; Word16 subframeIdx, idx_in, maxBand; -#ifdef MSAN_FIX Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; -#else - Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif // MSAN_FIX Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -874,11 +869,7 @@ static void ivas_mc_paramupmix_dec_sf( scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q5 - Q11 ); // Q11 -> Q5 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 0, st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q5 -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q5 -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q11 - Q5 ); // Q5 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); @@ -913,13 +904,8 @@ static void ivas_mc_paramupmix_dec_sf( ptr_re_fx[0] = Cldfb_RealBuffer_fx[ch][slot_idx]; // Q6 ptr_im_fx[0] = Cldfb_ImagBuffer_fx[ch][slot_idx]; // Q6 -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), hMCParamUpmix->num_freq_bands, 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), - hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, sub( Q11, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); // Q6 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 4eb0ad686..7e1597749 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -84,10 +84,8 @@ ivas_error ivas_mct_dec_fx( set16_fx( x_len[0], 0, NB_DIV ); set16_fx( x_len[1], 0, NB_DIV ); Decoder_State **sts; -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS Word32 *p_output_orig_fx[2]; Word32 synth_32_fx[CPE_CHANNELS][L_FRAME_PLUS]; -#endif Word16 synth_fx[CPE_CHANNELS][L_FRAME_PLUS]; //(Q_synth) Word32 ivas_total_brate; ivas_error error; @@ -164,7 +162,6 @@ ivas_error ivas_mct_dec_fx( /* MCT side bits decoder */ ivas_mct_side_bits_fx( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */ IF( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { @@ -174,7 +171,6 @@ ivas_error ivas_mct_dec_fx( output_fx[n] = synth_32_fx[n]; } } -#endif FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -348,13 +344,8 @@ ivas_error ivas_mct_dec_fx( 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 } -#ifdef FIX_ISSUE_1237 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 ) ) ) ) ); -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ); - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ); -#endif ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, e_sig ); Word16 hdrm, sh; @@ -385,7 +376,6 @@ ivas_error ivas_mct_dec_fx( } } -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* set pointers back */ test(); IF( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) @@ -396,7 +386,6 @@ ivas_error ivas_mct_dec_fx( } } -#endif /*----------------------------------------------------------------* * CoreCoder Post-processing and updates @@ -409,19 +398,10 @@ ivas_error ivas_mct_dec_fx( test(); IF( ( st_ivas->sba_dirac_stereo_flag != 0 ) && ( NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) || GE_16( cpe_id, sub( nCPE, 2 ) ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_fx[n], synth_fx_32[n], L_FRAME48k, sub( Q11, ( sub( 15, e_sig[n] ) ) ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->old_out_fx32, output_frame, sub( Q11, hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda ) ); -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx[n], synth_fx_32[n], L_FRAME48k, sub( Q11, ( sub( 15, e_sig[n] ) ) ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->old_out_fx32, output_frame, sub( Q11, hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda ) ); -#endif ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1, Q11 ); -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx_32[n], synth_fx[n], output_frame, sub( sub( 15, e_sig[n] ), Q11 ) ); // Q0 -#else - Copy_Scale_sig_32_16( synth_fx_32[n], synth_fx[n], L_FRAME48k, 0 - Q11 ); -#endif } /* Postprocessing for ACELP/MDCT core switching and synchronization */ @@ -452,11 +432,7 @@ ivas_error ivas_mct_dec_fx( { return error; } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_fx[n], output_fx[( cpe_id * CPE_CHANNELS ) + n], output_frame, sub( Q11, Q_synth ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx[n], output_fx[( cpe_id * CPE_CHANNELS ) + n], output_frame, sub( Q11, Q_synth ) ); // Q11 -#endif /* Save synthesis for HQ FEC */ Word32 output_fx_[L_FRAME48k]; Copy32( output_fx[( cpe_id * CPE_CHANNELS ) + n], output_fx_, L_FRAME48k ); // Q11 @@ -476,11 +452,7 @@ ivas_error ivas_mct_dec_fx( { IF( hCPE->hCoreCoder[n] ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11 ); // Q0 -> Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11 ); // Q0 -> Q11 -#endif } } diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index c275820fb..0f20c1ec0 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -313,17 +313,6 @@ void mctStereoIGF_dec_fx( test(); IF( NE_16( hMCT->hBlockData[b]->hStereoMdct->IGFStereoMode[k], SMDCT_DUAL_MONO ) || NE_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[k], SMDCT_DUAL_MONO ) ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxCfg->tcx_coded_lines, nSubframes, &tmp_e ); - L_spec[0] = shr( tmp, add( 15, negate( tmp_e ) ) ); - move16(); - - tmp = BASOP_Util_Divide1616_Scale( sts[0]->L_frame, nSubframes, &tmp_e ); - L_frame_nSubframe = shr( tmp, add( 15, negate( tmp_e ) ) ); - - tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxDec->L_frameTCX, nSubframes, &tmp_e ); - L_frameTCX_nSubframe = shr( tmp, add( 15, negate( tmp_e ) ) ); -#else Word16 shr_div, shr_k; assert( nSubframes == 1 || nSubframes == 2 ); @@ -334,7 +323,6 @@ void mctStereoIGF_dec_fx( move16(); L_frame_nSubframe = shr( sts[0]->L_frame, shr_div ); L_frameTCX_nSubframe = shr( sts[0]->hTcxDec->L_frameTCX, shr_div ); -#endif init_tcx_info_fx( sts[0], 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] ); @@ -344,28 +332,16 @@ 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 FIX_1109_OPTIM_MCT_STEREO_IGF_DEC shr_k = sub( 31 - Q12, p_x_e[0][k] ); -#endif FOR( Word16 i = 0; i < p_x_len[0][k]; i++ ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - p_x[0][k][i] = L_shr( p_x[0][k][i], sub( 31 - Q12, p_x_e[0][k] ) ); -#else p_x[0][k][i] = L_shr( p_x[0][k][i], shr_k ); -#endif move32(); } -#ifdef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC shr_k = sub( 31 - Q12, p_x_e[1][k] ); -#endif FOR( Word16 i = 0; i < p_x_len[1][k]; i++ ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - p_x[1][k][i] = L_shr( p_x[1][k][i], sub( 31 - Q12, p_x_e[1][k] ) ); -#else p_x[1][k][i] = L_shr( p_x[1][k][i], shr_k ); -#endif move32(); } } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 1899c8bea..71839557a 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -684,10 +684,8 @@ void ivas_mdct_core_invQ_fx( { spectralData_tmp[k] = malloc( N_MAX * sizeof( Word32 ) ); } -#ifdef MSAN_FIX set32_fx( spectralData_tmp[0], 0, L_FRAME_MAX ); set32_fx( spectralData_tmp[1], 0, L_FRAME_MAX ); -#endif // MSAN_FIX push_wmops( "mdct_core_invQ" ); sts = hCPE->hCoreCoder; @@ -728,18 +726,8 @@ void ivas_mdct_core_invQ_fx( common_exp = s_max( sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ); -#ifdef MSAN_FIX -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_frameTCX[0], sub( 15, sub( common_exp, sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp1 Copy_Scale_sig_16_32_no_sat( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_frameTCX[1], sub( 15, sub( common_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp2 -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_frameTCX[0], sub( 15, sub( common_exp, sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp1 - Copy_Scale_sig_16_32_DEPREC( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_frameTCX[1], sub( 15, sub( common_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp2 -#endif -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_FRAME_MAX, 15 - ( common_exp - sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp1 - Copy_Scale_sig_16_32_DEPREC( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_FRAME_MAX, 15 - ( common_exp - sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp2 -#endif // MSAN_FIX sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = common_exp; move16(); @@ -751,13 +739,8 @@ void ivas_mdct_core_invQ_fx( /* both input in same Q */ 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 ); -#ifdef MSAN_FIX 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 -#else - Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); - Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); -#endif sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_l ); sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_r ); move16(); @@ -1193,13 +1176,8 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win -#ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win -#else - Scale_sig( synth_buf_fx, 3136, sub( q_win, q_syn ) ); - Scale_sig( synth_bufFB_fx, 3136, sub( q_win, q_syn ) ); -#endif Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win FOR( k = 0; k < nSubframes[ch]; k++ ) { @@ -1263,13 +1241,8 @@ void ivas_mdct_core_reconstruct_fx( move16(); Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( sub( -1, st->Q_syn ), st->hTcxDec->Q_old_syn_Overl ) ); // q_win -> Q(-1 - st->Q_syn) st->hTcxDec->Q_old_syn_Overl = sub( -1, st->Q_syn ); -#ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn -#else - Scale_sig( synth_buf_fx, 3136, sub( q_syn, q_win ) ); - Scale_sig( synth_bufFB_fx, 3136, sub( q_syn, q_win ) ); -#endif Scale_sig( st->syn, M + 1, add( st->Q_syn, 2 ) ); Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn @@ -1400,11 +1373,7 @@ void ivas_mdct_core_reconstruct_fx( move16(); st->last_coder_type = st->coder_type; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( x_fx_16, x_fx[ch][0], st->L_frame, sub( q_x, q_syn ) ); // q_syn -> Q_x -#else - Copy_Scale_sig_16_32_DEPREC( x_fx_16, x_fx[ch][0], st->L_frame, sub( q_x, q_syn ) ); // q_syn -> Q_x -#endif } IF( GT_16( e_sig[0], e_sig[1] ) ) @@ -1508,9 +1477,7 @@ void ivas_mdct_core_tns_ns_fx( move16(); set32_fx( xn_buf_fx, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); -#ifdef MSAN_FIX set32_fx( sns_int_scf_fx, 0, FDNS_NPTS ); -#endif /* TNS, ITF, IMDCT and updates */ diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index adee0fc91..8f7da758d 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -713,22 +713,14 @@ void ivas_omasa_dirac_rend_jbm_fx( ivas_dirac_dec_render_fx( st_ivas, nchan_transport, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_f ); -#ifdef MSAN_FIX FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) -#else - FOR( Word16 ind1 = 0; ind1 < MAX_CICP_CHANNELS - 1; ind1++ ) -#endif // MSAN_FIX { scale_sig32( st_ivas->hIsmRendererData->prev_gains_fx[ind1], MAX_OUTPUT_CHANNELS, -1 ); // Q30 -> Q29 } ivas_omasa_separate_object_render_jbm_fx( st_ivas, *nSamplesRendered, data_separated_objects, output_f, subframes_rendered, slots_rendered ); -#ifdef MSAN_FIX FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) -#else - FOR( Word16 ind1 = 0; ind1 < MAX_CICP_CHANNELS - 1; ind1++ ) -#endif // MSAN_FIX { scale_sig32( st_ivas->hIsmRendererData->prev_gains_fx[ind1], MAX_OUTPUT_CHANNELS, 1 ); // Q29 -> Q30 } diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 493301743..80413b21a 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -130,10 +130,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 n; @@ -150,11 +146,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( channel_offset = st_ivas->nchan_ism; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset] ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset], out_len ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -240,11 +232,7 @@ ivas_error ivas_osba_render_sf_fx( v_shr( p_output[n], Q11 - Q11, output_ism[n], nSamplesAsked ); // Q11 } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 756eed60e..fc69d3919 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -479,12 +479,10 @@ ivas_error ivas_ls_setup_conversion_open_fx( set32_fx( hLsSetUpConversion->targetEnergyPrev_fx[0], 0, MAX_SFB + 2 ); set32_fx( hLsSetUpConversion->dmxEnergyPrev_fx[0], 0, MAX_SFB + 2 ); -#ifdef MSAN_FIX hLsSetUpConversion->te_prev_exp[0] = 0; hLsSetUpConversion->dmx_prev_exp[0] = 0; move16(); move16(); -#endif } /* Initialize the DMX conversion matrix */ diff --git a/lib_dec/ivas_post_proc_fx.c b/lib_dec/ivas_post_proc_fx.c index 03fe4063a..c0e69b916 100644 --- a/lib_dec/ivas_post_proc_fx.c +++ b/lib_dec/ivas_post_proc_fx.c @@ -243,12 +243,6 @@ void stereo_dft_dec_core_switching_fx( move16(); } -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, sub( *q, Q11 ) ); - } -#endif test(); test(); @@ -273,9 +267,7 @@ void stereo_dft_dec_core_switching_fx( test(); IF( st->p_bpf_noise_buf_32 && NE_16( st->core, HQ_CORE ) ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 2, 0, q, q_DFT ); } /* st->p_bpf_noise_buf not updated FOR HQ core -> skip analysis and set input memory to zero */ @@ -294,11 +286,7 @@ void stereo_dft_dec_core_switching_fx( { Word16 mem_len = NS2SA_FX2( L_mult0( L_frameTCX, FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ); /*Q0*/ move16(); -#ifdef MSAN_FIX Word32 mem_len_inv = mem_len_inv_tbl[( mem_len / 25 ) - 1]; -#else - Word32 mem_len_inv = mem_len_inv_tbl[( mem_len / 25 )]; -#endif move32(); Word16 qmem_len = norm_l( mem_len ); Word32 mem_len_fx = L_shl( mem_len, qmem_len ); @@ -441,9 +429,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } } @@ -472,9 +458,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -549,9 +533,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -723,12 +705,6 @@ void stereo_dft_dec_core_switching_fx( } } -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, negate( sub( *q, Q11 ) ) ); - } -#endif return; } diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index c78c51c52..6e36c7765 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -1113,7 +1113,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( } } -#ifdef MSAN_FIX FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) @@ -1122,19 +1121,8 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } -#else - FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) - { - FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) - { - hQMetaData->q_direction[0].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[0][b][m] ); - move32(); - } - } -#endif // MSAN_FIX IF( EQ_32( hQMetaData->no_directions, 2 ) ) { -#ifdef MSAN_FIX FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) @@ -1143,16 +1131,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } -#else - FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) - { - FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) - { - hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] ); - move32(); - } - } -#endif // MSAN_FIX } /* Store status information for renderer use */ hQMetaData->ec_flag = 0; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index f89e9601f..c8c3d80a5 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -349,12 +349,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( test(); test(); test(); -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH test(); IF( hSpar->hPCA == NULL && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( st_ivas->sba_order, 1 ) && ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) -#else - IF( hSpar->hPCA == NULL && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( st_ivas->sba_order, 1 ) && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) -#endif { IF( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { @@ -874,10 +870,6 @@ ivas_error ivas_sba_dec_render_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered Q0*/ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render Q0*/ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 slots_to_render, first_sf, last_sf, subframe_idx; @@ -886,15 +878,8 @@ ivas_error ivas_sba_dec_render_fx( SPAR_DEC_HANDLE hSpar; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; Word32 *output_f_local_fx[MAX_OUTPUT_CHANNELS]; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Word16 output_f_local_len; -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ivas_error error; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - output_f_local_len = out_len; - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ hSpar = st_ivas->hSpar; hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -926,18 +911,11 @@ ivas_error ivas_sba_dec_render_fx( { Word16 n_samples_sf = imult1616( slot_size, hSpar->subframe_nbslots[subframe_idx] ); /*Q0*/ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal, output_f_local_len ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ch = 0; ch < nchan_out; ch++ ) { output_f_local_fx[ch] = output_f_local_fx[ch] + n_samples_sf; /*Q11*/ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - output_f_local_len = sub( output_f_local_len, n_samples_sf ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 0c7544682..50db27aa5 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -725,12 +725,10 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( ELSE { set32_fx( hStereoDft->hb_stefi_sig_fx + hStereoDft->hb_stefi_delay, 0, output_frame ); -#ifdef MSAN_FIX hStereoDft->hb_nrg_subr_fx[0] = 0; move32(); hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); -#endif // MSAN_FIX } hStereoDft->hb_nrg_subr_fx[0] = hStereoDft->hb_nrg_subr_fx[0]; // imult3216(hStereoDft->hb_nrg_subr_fx[0] , shr(hStereoDft->NFFT, 1)); /*hStereoDft->q_hb_nrg_subr*/ move32(); @@ -1240,12 +1238,10 @@ void ivas_sba_dirac_stereo_dec_fx( CPE_DEC_HANDLE hCPE; STEREO_DFT_DEC_DATA_HANDLE hStereoDft; -#ifdef MSAN_FIX FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) { set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX ); } -#endif hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; @@ -1257,18 +1253,10 @@ void ivas_sba_dirac_stereo_dec_fx( q_dft[1] = hCPE->hStereoDft->q_dft; move16(); -#ifdef MSAN_FIX Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ -#else - Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif IF( hSCE != NULL ) { -#ifdef MSAN_FIX Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ -#else - Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft; move16(); } @@ -1398,18 +1386,10 @@ void ivas_sba_dirac_stereo_dec_fx( set32_fx( output[ch], 0, output_frame ); } -#ifdef MSAN_FIX Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/ -#else - Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif IF( hSCE != NULL ) { -#ifdef MSAN_FIX Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/ -#else - Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = Q11; move16(); } diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 461b18fbc..c3e2ad096 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -787,11 +787,7 @@ void ivas_spar_get_cldfb_gains_fx( cldfbAnalysis_ts_fx_fixed_q( ts_inout_fx, ts_re_fx, ts_im_fx, num_cldfb_bands, cldfbAnaDec0, &q_cldfb ); cldfb_reset_memory_fx( cldfbSynDec0 ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, 0, cldfbSynDec0 ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, cldfbSynDec0 ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( sample = 0; sample < stride; sample++ ) { T_fx[( ( slot * stride ) + sample )][slot] = ts_inout_fx[sample]; /*Q21*/ @@ -1161,10 +1157,8 @@ void ivas_spar_get_parameters_fx( split_band = SPAR_DIRAC_SPLIT_START_BAND; move16(); -#ifdef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS Word16 add_weight_fx = sub( MAX_WORD16, weight_fx ); Word16 add_weight_20ms_fx = sub( MAX_WORD16, weight_20ms_fx ); -#endif FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { FOR( out_ch = 0; out_ch < num_ch_out; out_ch++ ) @@ -1179,13 +1173,8 @@ void ivas_spar_get_parameters_fx( { IF( GT_16( hSpar->i_subframe, 3 ) ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[ts0][out_ch][in_ch][spar_band], sub( MAX_WORD16, weight_fx ) ), - Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[ts1][out_ch][in_ch][spar_band], weight_fx ) ); /*hSpar->hMdDec->Q_mixer_mat*/ -#else 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 ); -#endif move32(); } ELSE @@ -1202,12 +1191,8 @@ void ivas_spar_get_parameters_fx( /* 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(); -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[prev_idx][out_ch][in_ch][spar_band], sub( MAX_WORD16, weight_20ms_fx ) ), Mpy_32_16_1( hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band], weight_20ms_fx ) ); /*hSpar->hMdDec->Q_mixer_mat*/ -#else 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*/ -#endif move32(); } } @@ -1367,17 +1352,10 @@ static void ivas_spar_calc_smooth_facs_fx( smooth_long_avg_fx[b] = L_add( smooth_long_avg_fx[b], smooth_buf_fx[b][i] ); // Q0 move32(); } -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS - smooth_short_avg_fx[b] = Mpy_32_16_1( smooth_short_avg_fx[b], 5461 /*(1/6 in Q15)*/ ); // Q0 - move32(); - smooth_long_avg_fx[b] = Mpy_32_16_1( smooth_long_avg_fx[b], 1639 /*(1/20 in Q15)*/ ); // Q0 - move32(); -#else smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 move32(); smooth_long_avg_fx[b] = Mpy_32_32( smooth_long_avg_fx[b], 107374182 /*(1/20 in Q31)*/ ); // Q0 move32(); -#endif /* calculate smoothing factor based on energy averages */ /* reduce factor for higher short-term energy */ @@ -1689,10 +1667,6 @@ void ivas_spar_dec_upmixer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Word32 *output_fx[], /* o : output audio channels Q11*/ const Word16 nchan_internal /* i : number of internal channels Q0*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 cldfb_band, num_cldfb_bands, numch_in, numch_out; @@ -1793,9 +1767,7 @@ void ivas_spar_dec_upmixer_sf_fx( * Prepare CLDFB buffers *---------------------------------------------------------------------*/ -#ifdef MSAN_FIX set_zero_fx( &Pcm_tmp_fx[0][0], ( MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ) * L_FRAME48k ); -#endif // MSAN_FIX /* set-up pointers */ IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) { @@ -1871,9 +1843,7 @@ void ivas_spar_dec_upmixer_sf_fx( ivas_spar_calc_smooth_facs_fx( cldfb_in_ts_re_fx[0], cldfb_in_ts_im_fx[0], q_cldfb, num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_buf_fx ); } -#ifdef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL Word16 sh_l = sub( 31, q1 ); -#endif FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { md_idx = hSpar->render_to_md_map[( ts + slot_idx_start )]; /*Q0*/ @@ -1889,18 +1859,12 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 diff = sub( 32767, hSpar->hMdDec->smooth_fac_fx[spar_band] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { FOR( in_ch = 0; in_ch < numch_in; in_ch++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE mixer_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( mixer_mat_fx[out_ch][in_ch][spar_band], diff ), hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band], hSpar->hMdDec->smooth_fac_fx[spar_band] ); /*q1*/ -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - mixer_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( mixer_mat_fx[out_ch][in_ch][spar_band], sub( 32767, hSpar->hMdDec->smooth_fac_fx[spar_band] ) ), hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band], hSpar->hMdDec->smooth_fac_fx[spar_band] ); /*q1*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move32(); hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band] = mixer_mat_fx[out_ch][in_ch][spar_band]; /*q1*/ move32(); @@ -1908,68 +1872,6 @@ void ivas_spar_dec_upmixer_sf_fx( } } } -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS - FOR( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) - { - Word32 out_re_fx[IVAS_SPAR_MAX_CH]; - Word32 out_im_fx[IVAS_SPAR_MAX_CH]; - Word32 cldfb_par_fx; /*q1*/ - ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; - - FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - out_re_fx[out_ch] = 0; - move32(); - out_im_fx[out_ch] = 0; - move32(); - FOR( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - IF( b_skip_mat[out_ch][in_ch] == 0 ) - { - IF( LT_16( cldfb_band, CLDFB_PAR_WEIGHT_START_BAND ) ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ - { - spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; /*Q0*/ - move16(); - cldfb_par_fx = mixer_mat_fx[out_ch][in_ch][spar_band]; /*q1*/ - move32(); - } - ELSE - { - Word64 acc = 0; - move64(); - FOR( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) - { - /* accumulate contributions from all SPAR bands */ - acc = W_mac_32_32( acc, mixer_mat_fx[out_ch][in_ch][spar_band], bin2band->pp_cldfb_weights_per_spar_band_fx[cldfb_band][spar_band] ); // q1+ Q23 - } - cldfb_par_fx = W_shl_sat_l( acc, -23 ); // q1 - } - - out_re_fx[out_ch] = Madd_32_32( out_re_fx[out_ch], cldfb_in_ts_re_fx[in_ch][ts][cldfb_band], cldfb_par_fx ); /*q1-25*/ - move32(); - out_im_fx[out_ch] = Madd_32_32( out_im_fx[out_ch], cldfb_in_ts_im_fx[in_ch][ts][cldfb_band], cldfb_par_fx ); /*q1-25*/ - move32(); - } - } - } - - /*update CLDFB data with the parameter-modified data*/ - FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) - { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ - move32(); -#endif - } - } -#else /* FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS */ /* Note: This version splits the cldfb band loop into 2 loops, removing some inner-loop IF_statements */ Word16 min_cldf_band = s_min( CLDFB_PAR_WEIGHT_START_BAND, num_cldfb_bands ); Word32 out_re_fx[IVAS_SPAR_MAX_CH]; @@ -2004,17 +1906,10 @@ void ivas_spar_dec_upmixer_sf_fx( /*update CLDFB data with the parameter-modified data*/ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ move32(); cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ move32(); -#endif } } @@ -2052,20 +1947,12 @@ void ivas_spar_dec_upmixer_sf_fx( /*update CLDFB data with the parameter-modified data*/ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ move32(); cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ move32(); -#endif } } -#endif /* FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS */ test(); IF( ( EQ_16( ( add( add( slot_idx_start, ts ), 1 ) ), hSpar->num_slots ) ) || ( NE_16( ( shr( md_idx, 2 ) /* md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME */ ), ( hSpar->render_to_md_map[( ( slot_idx_start + ts ) + 1 )] / JBM_CLDFB_SLOTS_IN_SUBFRAME /*It's value is 4*/ ) ) ) ) { @@ -2080,12 +1967,6 @@ void ivas_spar_dec_upmixer_sf_fx( } IF( LT_16( split_band, IVAS_MAX_NUM_BANDS ) ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[1][0][0], hSpar->hMdDec->mixer_mat_prev_fx[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[2][0][0], hSpar->hMdDec->mixer_mat_prev_fx[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[3][0][0], hSpar->hMdDec->mixer_mat_prev_fx[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[4][0][0], hSpar->hMdDec->mixer_mat_prev_fx[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { @@ -2093,7 +1974,6 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( b = 0; b < num_spar_bands; b++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE hSpar->hMdDec->mixer_mat_prev_fx[0][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[1][out_ch][in_ch][b]; hSpar->hMdDec->mixer_mat_prev_fx[1][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[2][out_ch][in_ch][b]; hSpar->hMdDec->mixer_mat_prev_fx[2][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[3][out_ch][in_ch][b]; @@ -2102,7 +1982,6 @@ void ivas_spar_dec_upmixer_sf_fx( move32(); move32(); move32(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ hSpar->hMdDec->mixer_mat_prev_fx[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][( b + ( md_sf * IVAS_MAX_NUM_BANDS ) )]; /*hSpar->hMdDec->Q_mixer_mat*/ move32(); @@ -2156,26 +2035,10 @@ void ivas_spar_dec_upmixer_sf_fx( IF( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) || !( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) && !( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, -6 ); /*st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state-6*/ - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = sub( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, 6 ); - move16(); - Scale_sig32( output_fx[ch], out_len, -6 ); /*Q5*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( output_fx[ch], out_len, 6 ); /*Q11*/ - Scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, 6 ); /*st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state+6*/ - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = add( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, 6 ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } idx_in = add( idx_in, 1 ); @@ -2187,26 +2050,10 @@ void ivas_spar_dec_upmixer_sf_fx( /* CLDFB to time synthesis (overwrite mixer output) */ FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx, st_ivas->cldfbSynDec[out_ch]->p_filter_length, -6 ); /*st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state-6*/ - st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state = sub( st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state, 6 ); - move16(); - Scale_sig32( output_fx[out_ch], out_len, -6 ); /*Q5*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[out_ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( output_fx[out_ch], out_len, 6 ); /*Q11*/ - Scale_sig32( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx, st_ivas->cldfbSynDec[out_ch]->p_filter_length, 6 ); /*st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state+6*/ - st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state = add( st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state, 6 ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5704f4f60..429a99ca4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -961,9 +961,7 @@ typedef struct decoder_tc_buffer_structure Word32 *tc_buffer_fx; /* the buffer itself */ Word16 tc_buff_len; /*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV -#ifdef MSAN_FIX Word16 no_channels; /*Stores no of channels in tc_fx with values*/ -#endif Word16 q_tc_fx; TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ Word16 nchan_transport_jbm; /* number of TCs after TC decoding */ diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 223860db0..478f96dc1 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -683,12 +683,8 @@ static void stereo_dft_generate_comfort_noise_fx( factor = L_min( L_add( L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ), W_extract_l( W_mult0_32_32( Mpy_32_16_1( L_sub( factor, L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ) ), ONE_BY_MAX_K ), hStereoCng->xfade_frame_counter ) ) ), factor ); /* q_div */ FOR( ; j <= hFdCngCom->part[k]; j++ ) { -#ifdef FIX_ISSUE_1218 /* NOTE: saturation is added here as part of issue 1218 fix. After rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ hFdCngCom->cngNoiseLevel[j] = L_shl_sat( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp) */ -#else - hFdCngCom->cngNoiseLevel[j] = L_shl( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp) */ -#endif move32(); } } diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 9c1b488cb..324f2b7f3 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -96,9 +96,7 @@ void stereo_dft_dec_reset_fx( { Word16 i; Word16 j, b; -#ifdef MSAN_FIX set_zero_fx( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); -#endif /*Configuration*/ set16_fx( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); @@ -122,25 +120,13 @@ void stereo_dft_dec_reset_fx( set16_fx( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); -#ifdef MSAN_FIX FOR( i = 0; i < STEREO_DFT_BAND_MAX * 2; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } -#else - FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ - move32(); - } -#endif -#ifdef MSAN_FIX set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX * 2 ); -#else - set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); -#endif /*residual coding*/ set16_fx( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); @@ -260,7 +246,6 @@ void stereo_dft_dec_reset_fx( move32(); hStereoDft->frame_sid_nodata = 0; move16(); -#ifdef MSAN_FIX FOR( b = 0; b < 2 * IVAS_MAX_NUM_BANDS; b++ ) { FOR( i = 0; i < 2; i++ ) @@ -272,19 +257,6 @@ void stereo_dft_dec_reset_fx( } } } -#else - FOR( b = 0; b < hStereoDft->nbands; b++ ) - { - FOR( i = 0; i < 2; i++ ) - { - FOR( j = 0; j < 4; j++ ) - { - hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; - move32(); - } - } - } -#endif hStereoDft->first_frame = 1; move16(); hStereoDft->g_L_prev_fx = 0; @@ -429,9 +401,7 @@ ivas_error stereo_dft_dec_create_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hStereoDft_loc->hb_nrg_subr_fx, STEREO_DFT_NBDIV ); /*Setting hb_nrg_subr_fx to zero*/ -#endif // MSAN_FIX hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); @@ -1436,11 +1406,7 @@ void stereo_dft_dec_res_fx( move32(); } } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif IF( res_bpf_flag ) { v_sub_32( output, bpf_error_signal_8k, output, L_FRAME8k ); @@ -1451,20 +1417,12 @@ void stereo_dft_dec_res_fx( set16_fx( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif } ELSE { /* This step is needed to ensure output is properly populated with scaled values in all cases*/ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif } return; diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index 694aad0b4..73cf9ccd0 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -59,13 +59,8 @@ void stereo_tca_dec_fx( ) { /* Buffers, input Left and right channels @ input_Fs*/ -#ifdef MSAN_FIX Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; -#else - Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; - Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; -#endif Word32 *ptrChanL_fx, *ptrChanR_fx; Word32 *target_fx; Word16 target_idx, prevNCShift, currentNCShift, l_shift_adapt; diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 04aeccbb5..1c2ecffaf 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -234,12 +234,10 @@ void stereo_icBWE_dec_fx( ELSE { set32_fx( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, 0, output_frame ); -#ifdef MSAN_FIX hCPE->hStereoDft->hb_nrg_subr_fx[0] = 0; move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); -#endif // MSAN_FIX } hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[0], shl( shr( hCPE->hStereoDft->NFFT, 1 ), 6 ) ) ); // 2 * (Qsynth + SynthRef_shift) - 40 // 2 * (Qx + SynthRef_shift) - 31 - 15 move32(); @@ -719,11 +717,7 @@ void stereo_icBWE_dec_fx( { IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { -#ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) @@ -819,11 +813,7 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prev_Q_fsout = tmp; move16(); } -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); -#else Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ -#endif *Q_syn = sub( *Q_syn, 1 ); @@ -886,11 +876,7 @@ void stereo_icBWE_dec_fx( { IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { -#ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index a6b350d33..cd7e92f71 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -540,13 +540,8 @@ void stereo_mdct_core_dec_fx( move16(); } } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */ Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */ -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, ( 28 - norm_s( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0] - 1 ) ) ); /* Q28 */ - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, ( 28 - norm_s( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0] - 1 ) ) ); /* Q28 */ -#endif ivas_mdct_core_reconstruct_fx( hCPE, x_fx, signal_outFB_tmp_fx, fUseTns, 0, Q11, e_sigFB ); Copy32( signal_out_tmp_fx[0], signal_out_fx[0], L_FRAME48k ); /* Q11 */ diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 5b1378a89..5248839f5 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -904,13 +904,8 @@ void updateBuffersForDmxMdctStereo_fx( move16(); sts[0]->hTcxLtpDec->exp_tcxltp_mem_out = add( sts[0]->hTcxLtpDec->exp_tcxltp_mem_out, 1 ); move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &sts[0]->hTcxLtpDec->tcxltp_mem_in[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in ) ) ); // Q11 Copy_Scale_sig_16_32_no_sat( &sts[0]->hTcxLtpDec->tcxltp_mem_out[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out ) ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( &sts[0]->hTcxLtpDec->tcxltp_mem_in[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in ) ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( &sts[0]->hTcxLtpDec->tcxltp_mem_out[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out ) ) ); // Q11 -#endif } return; diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 6c2ad055c..1a6ea257b 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -197,9 +197,7 @@ static ivas_error allocate_CoreCoder_fx( } hf_synth_init_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->cldfbAna == NULL ) @@ -2153,21 +2151,13 @@ void stereo_td2dft_update_fx( /* update buffers used for fading when switching to DFT Stereo */ v_add_fx( sts[0]->hHQ_core->old_out_LB_fx32 + nsLB, sts[1]->hHQ_core->old_out_LB_fx32 + nsLB, hCPE->old_outLB_mdct_fx, old_outLB_len ); L_lerp_fx_q11( hCPE->old_outLB_mdct_fx, hCPE->old_outLB_mdct_fx, STEREO_MDCT2DFT_FADE_LEN_48k, old_outLB_len ); -#ifndef MSAN_FIX - for ( i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) -#else FOR( i = 0; i < old_outLB_len; i++ ) -#endif { hCPE->old_outLB_mdct_fx[i] = L_shr( hCPE->old_outLB_mdct_fx[i], 1 ); /* Q11 */ move32(); } v_add_fx( sts[0]->hHQ_core->old_out_fx32 + ns, sts[1]->hHQ_core->old_out_fx32 + ns, hCPE->old_out_mdct_fx, old_out_len ); /* exp(exp_old_out) */ -#ifndef MSAN_FIX - for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) -#else FOR( i = 0; i < old_out_len; i++ ) -#endif { hCPE->old_out_mdct_fx[i] = L_shr( hCPE->old_out_mdct_fx[i], 1 ); /* q_old_out_mdct */ move32(); diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 1467687d8..dd9859504 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -70,11 +70,7 @@ static void biDiagonalReductionLeft_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ @@ -88,11 +84,7 @@ static void biDiagonalReductionLeft_fx( static void biDiagonalReductionRight_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ @@ -105,11 +97,7 @@ static void biDiagonalReductionRight_fx( static void singularVectorsAccumulationLeft_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) as Input, Q31 as output */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC /* Q0 */ @@ -119,16 +107,8 @@ static void singularVectorsAccumulationRight_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* singularVectors_e */ Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* singularVectors_e */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_e, -#else Word16 *secDiag_e, -#endif const Word16 nChannelsC /* Q0 */ ); @@ -168,7 +148,6 @@ static void ApplyRotation_fx( const Word16 nChannels /* Q0 */ ); -#ifdef FIX_1010_OPT_GIVENS_INV static void GivensRotation2_fx( const Word32 x, /* exp(x_e) */ const Word16 x_e, @@ -178,7 +157,6 @@ static void GivensRotation2_fx( Word32 *resultInv, Word16 *out_e, Word16 *outInv_e ); -#endif static Word32 GivensRotation_fx( const Word32 x, /* exp(x_e) */ @@ -306,11 +284,7 @@ Word16 svd_fx( Word16 lengthSingularValues; Word16 errorMessage, condition; Word32 secDiag_fx[MAX_OUTPUT_CHANNELS]; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_fx_e = 0; -#else Word16 secDiag_fx_e[MAX_OUTPUT_CHANNELS]; -#endif move16(); Word32 eps_x_fx = 0, temp_fx; move16(); @@ -320,10 +294,6 @@ Word16 svd_fx( push_wmops( "svd_fx" ); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - set32_fx( secDiag_fx, 0, MAX_OUTPUT_CHANNELS ); - set16_fx( singularValues_fx_e, 0, MAX_OUTPUT_CHANNELS ); -#endif /* Collecting Values */ FOR( iCh = 0; iCh < nChannelsL; iCh++ ) @@ -336,22 +306,14 @@ Word16 svd_fx( } /* Householder reduction */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - HouseholderReduction_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, InputMatrix_e, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, &eps_x_fx, &eps_x_fx_e ); -#else HouseholderReduction_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, InputMatrix_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, &eps_x_fx, &eps_x_fx_e ); -#endif /* Set extremely small values to zero if needed */ // flushToZeroArray(singularValues, max_length); // flushToZeroMat(singularVectors_Left, nChannelsL, nChannelsL); // flushToZeroMat(singularVectors_Right, nChannelsC, nChannelsC); /* BidagonalDiagonalisation */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - errorMessage = BidagonalDiagonalisation_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, eps_x_fx, eps_x_fx_e ); /* Q0 */ -#else errorMessage = BidagonalDiagonalisation_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, eps_x_fx, eps_x_fx_e ); /* Q0 */ -#endif /* Sort the singular values descending order */ lengthSingularValues = s_min( nChannelsL, nChannelsC ); /* Q0 */ @@ -423,11 +385,7 @@ static Word16 BidagonalDiagonalisation_fx( Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) singularValues_fx_e*/ Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: secDiag_fx_e*/ Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 *secDiag_fx_e, /* i/o: */ -#else Word16 *secDiag_new_e, /* i/o: */ -#endif const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ const Word32 eps_x, /* i : eps_x_e*/ @@ -441,9 +399,7 @@ static Word16 BidagonalDiagonalisation_fx( move16(); move16(); Word16 temp_exp; -#ifdef FIX_1010_OPT_NORM_NOSAT Word16 temp_exp2; -#endif Word32 g = 0; move16(); Word16 g_e = 0; @@ -451,14 +407,8 @@ static Word16 BidagonalDiagonalisation_fx( Word16 convergence, iteration, found_split; Word16 error = 0; move16(); -#ifdef FIX_1010_OPT_GIVENS_INV Word32 temp; -#endif Word16 singularValues_new_e[MAX_OUTPUT_CHANNELS]; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_new_e[MAX_OUTPUT_CHANNELS]; - set16_fx( secDiag_new_e, *secDiag_fx_e, MAX_OUTPUT_CHANNELS ); -#endif Copy( singularValues_fx_e, singularValues_new_e, MAX_OUTPUT_CHANNELS ); FOR( iCh = nChannelsC - 1; iCh >= 0; iCh-- ) /* nChannelsC */ @@ -527,46 +477,17 @@ static Word16 BidagonalDiagonalisation_fx( c = singularValues_fx[kCh]; /* exp(singularValues_new_e) */ c_e = singularValues_new_e[kCh]; -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_fx[kCh], &temp, &singularValues_new_e[kCh], &temp_exp ); /* exp(singularValues_new_e) */ c = Mpy_32_32( c, temp ); c_e = add( c_e, temp_exp ); -#else - singularValues_fx[kCh] = GivensRotation_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_new_e[kCh] ); /* exp(singularValues_new_e) */ - c = BASOP_Util_Divide3232_Scale_cadence( c, maxWithSign_fx( singularValues_fx[kCh] ), &temp_exp ); /* exp(temp_exp + (c_e - singularValues_new_e)) */ - c_e = add( temp_exp, sub( c_e, singularValues_new_e[kCh] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_exp2 = norm_l( c ); c = L_shl( c, temp_exp2 ); c_e = sub( c_e, temp_exp2 ); -#endif -#ifdef FIX_1010_OPT_GIVENS_INV s = Mpy_32_32( -g, temp ); s_e = add( g_e, temp_exp ); -#else - s = BASOP_Util_Divide3232_Scale_cadence( -g, maxWithSign_fx( singularValues_fx[kCh] ), &temp_exp ); /* exp(temp_exp + (g_e - singularValues_new_e))*/ - s_e = add( temp_exp, sub( g_e, singularValues_new_e[kCh] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_exp2 = norm_l( s ); s = L_shl( s, temp_exp2 ); s_e = sub( s_e, temp_exp2 ); -#endif ApplyRotation_fx( singularVectors_Left_fx, c, c_e, s, s_e, 0, x11_e, 0, x12_e, &f1, &f1_e, &f2, &f2_e, kCh, split, nChannelsL ); /* nChannelsL */ } } @@ -617,24 +538,6 @@ static Word16 BidagonalDiagonalisation_fx( // rescaling block Copy( singularValues_new_e, singularValues_fx_e, MAX_OUTPUT_CHANNELS ); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 max_exp = -31; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - if ( secDiag_fx[iCh] ) - { - max_exp = s_max( max_exp, secDiag_new_e[iCh] ); - } - } - *secDiag_fx_e = max_exp; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - secDiag_fx[iCh] = L_shr_r( secDiag_fx[iCh], sub( *secDiag_fx_e, secDiag_new_e[iCh] ) ); /* exp(secDiag_fx_e) */ - move32(); - } -#endif return ( error ); } @@ -658,13 +561,9 @@ static void ApplyQRTransform_fx( const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ ) { -#ifdef FIX_1010_OPT_GIVENS_INV Word32 temp; Word16 temp_e; -#endif -#ifdef FIX_1010_OPT_NORM_NOSAT Word16 temp_norm_e; -#endif Word16 ch, split; Word32 d = 0, g = 0, r = 0, x_ii = 0, x_split = 0, x_kk = 0, mu = 0, aux = 0; move32(); @@ -767,47 +666,17 @@ static void ApplyQRTransform_fx( g = Mpy_32_32( c, secDiag[ch + 1] ); /* exp(c_e + secDiag_e) */ g_e = add( c_e, secDiag_e[ch + 1] ); -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( d, d_e, r, r_e, &secDiag[ch], &temp, &secDiag_e[ch], &temp_e ); /* exp(secDiag_e) */ c = Mpy_32_32( d, temp ); c_e = add( temp_e, d_e ); -#else - secDiag[ch] = GivensRotation_fx( d, d_e, r, r_e, &secDiag_e[ch] ); /* exp(secDiag_e) */ - move32(); - c = BASOP_Util_Divide3232_Scale_cadence( d, maxWithSign_fx( secDiag[ch] ), &c_e ); /* exp(c_e + (d_e + secDiag_e)) */ - c_e = add( c_e, sub( d_e, secDiag_e[ch] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_norm_e = norm_l( c ); c = L_shl( c, temp_norm_e ); c_e = sub( c_e, temp_norm_e ); -#endif -#ifdef FIX_1010_OPT_GIVENS_INV s = Mpy_32_32( r, temp ); s_e = add( r_e, temp_e ); -#else - s = BASOP_Util_Divide3232_Scale_cadence( r, maxWithSign_fx( secDiag[ch] ), &s_e ); /* exp(s_e + (r_e - sec_Diag_e))*/ - s_e = add( s_e, sub( r_e, secDiag_e[ch] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_norm_e = norm_l( s ); s = L_shl( s, temp_norm_e ); s_e = sub( s_e, temp_norm_e ); -#endif r = Mpy_32_32( s, singularValues[ch + 1] ); /* exp(r_e + secDiag_e) */ r_e = add( s_e, singularValues_e[ch + 1] ); x_split = Mpy_32_32( c, singularValues[ch + 1] ); /* exp(c_e + secDiag_e) */ @@ -821,48 +690,21 @@ static void ApplyQRTransform_fx( // ApplyRotation(singularVectors_Right, c, s, x_ii, aux, &d, &g, ch + 1, ch, nChannelsC); ApplyRotation_fx( singularVectors_Right, c, c_e, s, s_e, x_ii, x_ii_e, aux, aux_e, &d, &d_e, &g, &g_e, ch + 1, ch, nChannelsC ); -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( d, d_e, r, r_e, &singularValues[ch], &aux, &singularValues_e[ch], &aux_e ); /* exp(singularValues_e) */ -#else - singularValues[ch] = GivensRotation_fx( d, d_e, r, r_e, &singularValues_e[ch] ); /* exp(singularValues_e) */ - move32(); -#endif IF( singularValues[ch] != 0 ) { -#ifndef FIX_1010_OPT_GIVENS_INV - aux = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, singularValues[ch], &aux_e ); /* exp(aux_e + (1 - singularValues_e)) */ - aux_e = add( aux_e, sub( 1, singularValues_e[ch] ) ); -#endif c = Mpy_32_32( d, aux ); /* exp(d_e + aux_e) */ c_e = add( d_e, aux_e ); -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_norm_e = norm_l( c ); c = L_shl( c, temp_norm_e ); c_e = sub( c_e, temp_norm_e ); -#endif s = Mpy_32_32( r, aux ); /* exp(r_e + aux_e) */ s_e = add( r_e, aux_e ); -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_norm_e = norm_l( s ); s = L_shl( s, temp_norm_e ); s_e = sub( s_e, temp_norm_e ); -#endif } // ApplyRotation(singularVectors_Left, c, s, g, x_split, &d, &x_ii, ch + 1, ch, nChannelsL); @@ -915,7 +757,6 @@ static void ApplyRotation_fx( *g = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), add( c_e, x12_e ), Mpy_32_32( L_negate( s ), x11 ), add( s_e, x11_e ), g_e ); /* exp(g_e) */ move32(); -#ifdef SVD_WMOPS_OPT Word16 c_q = sub( 31, c_e ); Word16 s_q = sub( 31, s_e ); Word32 op1, op2; @@ -957,42 +798,6 @@ static void ApplyRotation_fx( singularVector[ch][currentIndex1] = W_sat_l( temp ); // Q(singularVector) move32(); } -#else -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - FOR( ch = 0; ch < nChannels; ch++ ) - { - x11 = singularVector[ch][currentIndex2]; - move32(); - x12 = singularVector[ch][currentIndex1]; - move32(); - singularVector[ch][currentIndex2] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), c_e, Mpy_32_32( s, x12 ), s_e, &temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex2] = L_shl_sat( singularVector[ch][currentIndex2], temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), c_e, Mpy_32_32( L_negate( s ), x11 ), s_e, &temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex1] = L_shl_sat( singularVector[ch][currentIndex1], temp_exp ); /* exp(temp_exp) */ - move32(); - } -#else - Word32 s_neg = L_negate( s ); - Word32 temp; - FOR( ch = 0; ch < nChannels; ch++ ) - { - x11 = singularVector[ch][currentIndex2]; - move32(); - x12 = singularVector[ch][currentIndex1]; - move32(); - temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), c_e, Mpy_32_32( s, x12 ), s_e, &temp_exp ); /* exp(temp_exp) */ - singularVector[ch][currentIndex2] = L_shl_sat( temp, temp_exp ); /* exp(temp_exp) */ - move32(); - temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), c_e, Mpy_32_32( s_neg, x11 ), s_e, &temp_exp ); /* exp(temp_exp) */ - singularVector[ch][currentIndex1] = L_shl_sat( temp, temp_exp ); /* exp(temp_exp) */ - move32(); - } - -#endif -#endif return; } @@ -1024,7 +829,6 @@ static void HouseholderReduction_fx( Word16 sig_x_fx_e = 0; move16(); -#ifdef FIX_1010_OPT_SINGLE_RESCALE Word16 iCh, jCh; Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; FOR( jCh = 0; jCh < nChannelsL; jCh++ ) @@ -1035,25 +839,15 @@ static void HouseholderReduction_fx( move16(); } } -#endif /* Bidiagonal Reduction for every channel */ FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, &singularVectors_Left_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); - biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, &singularVectors_Left_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); -#else biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); -#endif Word16 L_temp_e; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), *secDiag_fx_e, &L_temp_e ); /* exp(L_temp_e) */ -#else Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), secDiag_fx_e[nCh], &L_temp_e ); /* exp(L_temp_e) */ -#endif IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_temp, L_temp_e, *eps_x_fx, *eps_x_fx_e ), 1 ) ) { *eps_x_fx = L_temp; /* exp(L_temp_e) */ @@ -1064,19 +858,10 @@ static void HouseholderReduction_fx( } /* SingularVecotr Accumulation */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_e, *secDiag_fx_e, nChannelsC ); - singularVectorsAccumulationLeft_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Left_e, singularValues_fx_e, nChannelsL, nChannelsC ); -#else -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, *secDiag_fx_e, nChannelsC ); -#else singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsC ); -#endif singularVectorsAccumulationLeft_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Left_fx_e, singularValues_fx_e, nChannelsL, nChannelsC ); -#endif return; } @@ -1091,11 +876,7 @@ static void biDiagonalReductionLeft_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ @@ -1111,39 +892,11 @@ static void biDiagonalReductionLeft_fx( Word16 norm_x_e, f_e, r_e; Word32 L_temp; Word16 L_temp_e; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp[MAX_OUTPUT_CHANNELS]; - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ ) - { - set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); /* exp(sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - // rescaling block - IF( GT_16( *sig_x_e, *secDiag_e ) ) - { - FOR( Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++ ){ - IF( NE_16( i, currChannel ) ){ - secDiag[i] = L_shl( secDiag[i], sub( *secDiag_e, *sig_x_e ) ); /* sig_x_e */ - move32(); - } -} -*secDiag_e = *sig_x_e; -move16(); -} -ELSE IF( LT_16( *sig_x_e, *secDiag_e ) ) -{ - secDiag[currChannel] = L_shr_r( secDiag[currChannel], sub( *secDiag_e, *sig_x_e ) ); /* exp(secDiag_e) */ - move32(); -} -#else secDiag_e[currChannel] = *sig_x_e; move16(); -#endif /* Setting values to 0 */ ( *sig_x ) = 0; @@ -1158,54 +911,26 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */ -#else ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ -#endif } IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ { -#ifdef FIX_1010_OPT_DIV Word16 invVal_e; Word32 invVal; invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); -#endif norm_x = 0; move32(); norm_x_e = 0; move16(); FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else - singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &L_temp_e ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - singularVectors2_e[jCh][currChannel] = add( L_temp_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ); - move16(); - 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 -#else Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp[jCh] = sub( add( invVal_e, sub( *singularVectors_e, *sig_x_e ) ), temp_e ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); move16(); 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 -#endif } IF( GT_16( norm_x_e, 0 ) ) { @@ -1219,38 +944,18 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ L_temp = Sqrt32( norm_x, &L_temp_e ); L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - IF( singularVectors[currChannel][idx] >= 0 ) - { - ( *g ) = L_negate( L_temp ); - move32(); - } - ELSE - { - ( *g ) = L_negate( L_negate( L_temp ) ); - move32(); - } -#else if ( singularVectors[currChannel][idx] >= 0 ) { L_temp = L_negate( L_temp ); } ( *g ) = L_temp; move32(); -#endif -#ifndef FIX_1010_OPT_SINGLE_RESCALE - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[currChannel], -( *g ), 0, &sing_exp[currChannel] ); /* sing_exp */ -#else r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ -#endif move32(); -#ifdef FIX_1010_OPT_DIV invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); -#endif FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { @@ -1260,28 +965,15 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ move16(); FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( sing_exp[jCh], *singularVectors_e ), &norm_x_e ); /* exp(norm_x_e) */ -#else 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 } -#ifndef FIX_1010_OPT_DIV - f = BASOP_Util_Divide3232_Scale_cadence( norm_x, maxWithSign_fx( r ), &f_e ); /* f_e + (norm_x_e - r_e) */ - f_e = add( f_e, sub( norm_x_e, r_e ) ); -#else 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 ) ); -#endif FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], *singularVectors_e, Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, sing_exp[jCh] ), &sing_exp2[jCh][iCh] ); /* exp( sing_exp2) */ -#else singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] ); -#endif move32(); } } @@ -1291,37 +983,10 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ { singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[jCh][currChannel] = add( sing_exp[jCh], *sig_x_e ); -#else singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e ); -#endif move16(); } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - // rescaling block - Word16 exp_max = *singularVectors_e; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsL; jCh++ ) - { - exp_max = s_max( exp_max, sing_exp2[jCh][iCh] ); - } - } - - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsL; jCh++ ) - { - singularVectors[jCh][iCh] = L_shr_r( singularVectors[jCh][iCh], sub( exp_max, sing_exp2[jCh][iCh] ) ); /* exp(exp_max) */ - move32(); - } - } - *singularVectors_e = exp_max; - move16(); -#endif } // rescaling block @@ -1343,16 +1008,8 @@ return; static void biDiagonalReductionRight_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_exp[]) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 *secDiag_e, -#else Word16 *secDiag_exp, -#endif const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ @@ -1364,22 +1021,8 @@ static void biDiagonalReductionRight_fx( Word16 iCh, jCh, idx; Word32 norm_x, r; Word16 norm_x_e, r_e; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_exp[MAX_OUTPUT_CHANNELS]; -#endif Word32 L_temp; Word16 L_temp_e; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp[MAX_OUTPUT_CHANNELS]; - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ ) - { - set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - set16_fx( secDiag_exp, *secDiag_e, MAX_OUTPUT_CHANNELS ); -#endif /* Setting values to 0 */ ( *sig_x ) = 0; @@ -1393,11 +1036,7 @@ static void biDiagonalReductionRight_fx( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */ -#else ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), singularVectors2_e[currChannel][jCh], sig_x_e ); /* exp(sig_x_e) */ -#endif } IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ @@ -1407,41 +1046,17 @@ static void biDiagonalReductionRight_fx( norm_x_e = 0; move16(); -#ifdef FIX_1010_OPT_DIV Word16 invVal_e, temp_e; Word32 invVal; invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); -#endif FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e)) */ - move32(); - sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else - singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( *sig_x ), &L_temp_e ); /* exp(sing_exp + (singularVectors_e - sig_x_e)) */ - move32(); - singularVectors2_e[currChannel][jCh] = add( L_temp_e, sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#endif -#else temp_e = norm_l( singularVectors[currChannel][jCh] ); singularVectors[currChannel][jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp[jCh] = add( sub( invVal_e, temp_e ), sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else singularVectors2_e[currChannel][jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) ); move16(); norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#endif -#endif } IF( GT_16( norm_x_e, 0 ) ) { @@ -1465,44 +1080,19 @@ static void biDiagonalReductionRight_fx( move32(); } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[idx] ); /* exp(sing_exp) */ -#else r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */ -#endif move32(); -#ifdef FIX_1010_OPT_DIV invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); -#endif FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( r ), &secDiag_exp[jCh] ); /* exp(secDiag_exp + (sing_exp - r_e) */ - move32(); - secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( sing_exp[jCh], r_e ) ); - move32(); -#else - secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( r ), &secDiag_exp[jCh] ); /* exp(secDiag_exp + (sing_exp - r_e) */ - move32(); - secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( singularVectors2_e[currChannel][jCh], r_e ) ); - move32(); -#endif -#else temp_e = norm_l( singularVectors[currChannel][jCh] ); secDiag[jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( sing_exp[jCh], r_e ) ); -#else secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], r_e ) ); -#endif move16(); -#endif } FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */ @@ -1513,20 +1103,12 @@ static void biDiagonalReductionRight_fx( move16(); FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( *singularVectors_e, sing_exp[jCh] ), &norm_x_e ); /* exp(norm_x_e) */ -#else norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */ -#endif } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], *singularVectors_e, Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &sing_exp2[iCh][jCh] ); /* exp(sing_exp2) */ -#else singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ -#endif move32(); } } @@ -1535,54 +1117,12 @@ static void biDiagonalReductionRight_fx( { singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[currChannel][jCh] = add( sing_exp[jCh], *sig_x_e ); -#else singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); -#endif move16(); } -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - /*rescaling block*/ - Word16 exp_max = *secDiag_e; - move16(); - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - exp_max = s_max( exp_max, secDiag_exp[jCh] ); - } - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - secDiag[jCh] = L_shr_r( secDiag[jCh], sub( exp_max, secDiag_exp[jCh] ) ); /* exp(exp_max) */ - move32(); - } - *secDiag_e = exp_max; - move16(); -#endif - -#ifndef FIX_1010_OPT_SINGLE_RESCALE - exp_max = *singularVectors_e; - move16(); - FOR( iCh = 0; iCh < nChannelsL; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - exp_max = s_max( exp_max, sing_exp2[iCh][jCh] ); - } - } - FOR( iCh = 0; iCh < nChannelsL; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - singularVectors[iCh][jCh] = L_shr_r( singularVectors[iCh][jCh], sub( exp_max, sing_exp2[iCh][jCh] ) ); /* exp(exp_max) */ - move32(); - } - } - *singularVectors_e = exp_max; - move16(); -#endif } } @@ -1598,11 +1138,7 @@ static void biDiagonalReductionRight_fx( static void singularVectorsAccumulationLeft_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* input exp(singularVectors_Left_e), output Q31 */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC /* Q0 */ @@ -1612,13 +1148,6 @@ static void singularVectorsAccumulationLeft_fx( Word16 nChannels; Word32 norm_y, t_jj, t_ii; Word16 norm_y_e, t_jj_e, t_ii_e, temp_exp; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( nCh = 0; nCh < MAX_OUTPUT_CHANNELS; nCh++ ) - { - set16_fx( sing_exp2[nCh], singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif /* Processing */ nChannels = s_min( nChannelsL, nChannelsC ); /* min(nChannelsL,ChannelsC) Q0*/ @@ -1638,13 +1167,8 @@ static void singularVectorsAccumulationLeft_fx( IF( t_ii ) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/ { -#ifdef FIX_1010_OPT_DIV t_ii = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( t_ii ), &temp_exp ); t_ii_e = sub( temp_exp, t_ii_e ); -#else - t_ii = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxWithSign_fx( t_ii ), &temp_exp ); /* exp(1 + (temp_exp + tii_e)) */ - t_ii_e = add( 1, sub( temp_exp, t_ii_e ) ); -#endif Word16 tempe; Word32 temp = BASOP_Util_Divide3232_Scale_cadence( t_ii, maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &tempe ); tempe = add( tempe, sub( t_ii_e, singularVectors_Left_e[nCh][nCh] ) ); @@ -1659,13 +1183,9 @@ static void singularVectorsAccumulationLeft_fx( move16(); FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ), add( sing_exp2[k][nCh], sing_exp2[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */ -#else prod[k] = W_mult0_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ); prod_e[k] = add( singularVectors_Left_e[k][nCh], singularVectors_Left_e[k][iCh] ); max_e = s_max( max_e, prod_e[k] ); -#endif } FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */ @@ -1678,18 +1198,10 @@ static void singularVectorsAccumulationLeft_fx( norm_y = W_extract_h( acc ); norm_y_e = add( sub( max_e, acc_e ), 1 ); t_jj = Mpy_32_32( temp, norm_y ); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - t_jj_e = add( temp_exp, sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) ); -#else t_jj_e = add( tempe, norm_y_e ); -#endif FOR( k = nCh; k < nChannelsL; k++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[k][iCh], sing_exp2[k][iCh], Mpy_32_32( t_jj, singularVectors_Left[k][nCh] ), add( t_jj_e, sing_exp2[k][nCh] ), &sing_exp2[k][iCh] ); /* exp(sing_exp2) */ -#else singularVectors_Left[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[k][iCh], singularVectors_Left_e[k][iCh], Mpy_32_32( t_jj, singularVectors_Left[k][nCh] ), add( t_jj_e, singularVectors_Left_e[k][nCh] ), &singularVectors_Left_e[k][iCh] ); /* exp(sing_exp2) */ -#endif move32(); } } @@ -1698,11 +1210,7 @@ static void singularVectorsAccumulationLeft_fx( { singularVectors_Left[iCh][nCh] = Mpy_32_32( singularVectors_Left[iCh][nCh], t_ii ); /* exp(sing_exp2 + t_ii_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[iCh][nCh] = add( sing_exp2[iCh][nCh], t_ii_e ); -#else singularVectors_Left_e[iCh][nCh] = add( singularVectors_Left_e[iCh][nCh], t_ii_e ); -#endif move16(); } } @@ -1714,11 +1222,7 @@ static void singularVectorsAccumulationLeft_fx( move32(); } } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[nCh][nCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[nCh][nCh], sing_exp2[nCh][nCh], ONE_IN_Q30, 1, &sing_exp2[nCh][nCh] ); /* exp(sing_exp2) */ -#else 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) */ -#endif move32(); } // fclose(fp); @@ -1726,11 +1230,7 @@ static void singularVectorsAccumulationLeft_fx( { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], sing_exp2[nCh][iCh] ); /* Q31 */ -#else singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ -#endif move32(); } } @@ -1748,16 +1248,8 @@ static void singularVectorsAccumulationRight_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_Left_e) */ Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* input exp(singularVectors_Left_e), output Q31 */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_e, -#else Word16 *secDiag_e, -#endif const Word16 nChannelsC /* Q0 */ ) { @@ -1783,22 +1275,11 @@ static void singularVectorsAccumulationRight_fx( FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC*/ { -#ifdef FIX_1010_OPT_DIV ratio_float = L_deposit_h( BASOP_Util_Divide3232_Scale( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1] ), &temp_exp1 ) ); /* exp(temp_exp1) */ singularVectors_Right[iCh][nCh] = L_deposit_h( BASOP_Util_Divide3232_Scale( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh] ) ); /* exp(sing_right_exp + (temp_exp1 - secDiag_e) */ -#else - ratio_float = BASOP_Util_Divide3232_Scale_cadence( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1] ), &temp_exp1 ); /* exp(temp_exp1) */ - singularVectors_Right[iCh][nCh] = BASOP_Util_Divide3232_Scale_cadence( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh] ); /* exp(sing_right_exp + (temp_exp1 - secDiag_e) */ -#endif -#ifdef FIX_1010_OPT_SINGLE_RESCALE temp_exp1 = add( temp_exp1, sub( singularVectors_Left_e[nCh][iCh], singularVectors_Left_e[nCh][nCh + 1] ) ); -#endif move32(); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - sing_right_exp[iCh][nCh] = add( sing_right_exp[iCh][nCh], sub( temp_exp1, secDiag_e ) ); -#else sing_right_exp[iCh][nCh] = add( sing_right_exp[iCh][nCh], sub( temp_exp1, secDiag_e[nCh + 1] ) ); -#endif move16(); // singularVectors_Right[iCh][nCh] = L_shl_sat( singularVectors_Right[iCh][nCh], temp_exp2 ); } @@ -1812,11 +1293,7 @@ static void singularVectorsAccumulationRight_fx( FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[nCh][k], singularVectors_Right[k][iCh] ), add( singularVectors_e, sing_right_exp[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */ -#else 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 } FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ @@ -1853,7 +1330,6 @@ static void singularVectorsAccumulationRight_fx( *-------------------------------------------------------------------------*/ -#ifdef FIX_1010_OPT_GIVENS_INV static void GivensRotation2_fx( const Word32 x, /* exp(x_e) */ const Word16 x_e, @@ -1875,7 +1351,6 @@ static void GivensRotation2_fx( *resultInv = ISqrt32( r, outInv_e ); move32(); } -#endif static Word32 GivensRotation_fx( const Word32 x, /* exp(x_e) */ @@ -1884,62 +1359,10 @@ static Word32 GivensRotation_fx( const Word16 z_e, Word16 *out_e ) { -#ifdef FIX_1010_OPT_GIVENS Word32 r; -#else - Word32 x_abs, z_abs; - Word32 cotan, tan, r; - Word16 temp_exp; - Word32 L_temp; -#endif -#ifdef FIX_1010_OPT_GIVENS r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( z, z ), shl( z_e, 1 ), Mpy_32_32( x, x ), shl( x_e, 1 ), out_e ); r = Sqrt32( r, out_e ); -#else - x_abs = L_abs( x ); - z_abs = L_abs( z ); - test(); - IF( LE_32( x_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, x_abs ) ) && LE_32( z_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, z_abs ) ) ) - { - r = 0; - move32(); - } - ELSE IF( BASOP_Util_Cmp_Mant32Exp( x_abs, x_e, z_abs, z_e ) >= 0 ) - { - IF( LE_32( x_abs, SVD_MINIMUM_VALUE_FX ) ) - { - r = 0; - move32(); - } - ELSE - { - cotan = BASOP_Util_Divide3232_Scale_cadence( z_abs, x_abs, &temp_exp ); /* exp(temp_exp + (z_e - x_e) */ - temp_exp = add( temp_exp, sub( z_e, x_e ) ); - L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( cotan, cotan ), 2 * temp_exp, &temp_exp ); /* exp(temp_exp) */ - L_temp = Sqrt32( L_temp, &temp_exp ); - r = Mpy_32_32( x_abs, L_temp ); /* exp(x_e + temp_exp) */ - *out_e = add( x_e, temp_exp ); - } - } - ELSE - { - IF( LE_32( z_abs, SVD_MINIMUM_VALUE_FX ) ) - { - r = 0; - move32(); - } - ELSE - { - tan = BASOP_Util_Divide3232_Scale_cadence( x_abs, z_abs, &temp_exp ); /* exp(temp_exp + (x_e - z_e) */ - temp_exp = add( temp_exp, sub( x_e, z_e ) ); - L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( tan, tan ), shl( temp_exp, 1 ), &temp_exp ); /* exp(temp_exp) */ - L_temp = Sqrt32( L_temp, &temp_exp ); - r = Mpy_32_32( z_abs, L_temp ); /* exp(z_e + temp_exp) */ - *out_e = add( z_e, temp_exp ); - } - } -#endif return ( r ); } @@ -1953,20 +1376,6 @@ static Word32 maxWithSign_fx( const Word32 a /* Qx */ ) { -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - IF( GT_32( L_abs( a ), SVD_MINIMUM_VALUE_FX ) ) - { - return a; - } - ELSE IF( a < 0 ) - { - return -SVD_MINIMUM_VALUE_FX; - } - ELSE - { - return SVD_MINIMUM_VALUE_FX; - } -#else Word32 result; IF( a >= 0 ) { @@ -1977,7 +1386,6 @@ static Word32 maxWithSign_fx( result = L_min( a, -SVD_MINIMUM_VALUE_FX ); } return result; -#endif } /*------------------------------------------------------------------------- diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c187c351c..aa5a379e8 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -644,21 +644,13 @@ void stereo_tcx_core_dec_fx( test(); test(); test(); -#ifdef NONBE_FIX_1402_WAVEADJUST IF( ( bfi || st->prev_bfi ) && st->hPlcInfo->Pitch_fx && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) ) -#else - IF( ( bfi || st->prev_bfi ) && st->hPlcInfo->Pitch && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) ) -#endif { lerp( synthFB_fx, synth_fx, st->L_frame, hTcxDec->L_frameTCX ); if ( !bfi && st->prev_bfi ) { -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->Pitch_fx = 0; -#else - st->hPlcInfo->Pitch = 0; -#endif move16(); } } @@ -816,21 +808,11 @@ void stereo_tcx_core_dec_fx( move16(); /* Postfiltering */ -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, negate( Q11 ) ); - } -#endif post_decoder( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); test(); -#ifdef MSAN_FIX IF( st->p_bpf_noise_buf_32 && st->tcxonly == 0 ) -#else - IF( st->p_bpf_noise_buf_32 ) -#endif // MSAN_FIX { Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); /* q_p_bpf + Q11 */ } diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index 98c1a6a79..3191a8b4a 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -137,7 +137,6 @@ void tdm_low_rate_dec_fx( edct_16fx( exc_wo_nf_fx, exc_wo_nf_fx, L_FRAME, find_guarded_bits_fx( L_FRAME ), IVAS_CPE_TD ); -#ifdef FIX_USAN_ISSUES IF( bwe_exc != NULL ) { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, @@ -148,10 +147,6 @@ void tdm_low_rate_dec_fx( Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], NULL, st->hGSCDec->last_exc_dct_in_fx, L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); } -#else - Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, - L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); -#endif /*----------------------------------------------------------------------* * Remove potential pre-echo in case an onset has been detected *----------------------------------------------------------------------*/ diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index fc793dff0..e2528e619 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -270,9 +270,7 @@ UWord8 apa_reconfigure( free( ps->buf_out_fx ); ps->buf_out_fx = (Word16 *) malloc( sizeof( Word16 ) * ps->buf_out_capacity ); -#ifdef MSAN_FIX memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) ); -#endif ps->Q_buf_out = Q15; move16(); IF( !ps->buf_out_fx ) diff --git a/lib_dec/lead_deindexing_fx.c b/lib_dec/lead_deindexing_fx.c index 786e0c276..ecc5f6fe0 100644 --- a/lib_dec/lead_deindexing_fx.c +++ b/lib_dec/lead_deindexing_fx.c @@ -192,7 +192,6 @@ void re8_decode_base_index_fx( m1 = sub( k1, 1 ); m2 = 8; move16(); -#ifdef CR_2109_to_2112_cd0_ce0 l = 1; move16(); FOR( i = 0; i < 8; i++ ) @@ -206,9 +205,6 @@ void re8_decode_base_index_fx( test(); /* if the signs are constrained and all components are non-zero */ IF( EQ_16( k1, 7 ) && ( l > 0 ) ) -#else - IF( k1 == 7 ) -#endif { m2 = 7; move16(); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 413585447..77deb9e7d 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -44,9 +44,6 @@ #include "jbm_pcmdsp_fifo.h" #include #include -#ifndef FIX_DISCLAIMER -#include -#endif #include "wmc_auto.h" #define INV_1000_Q31 2147484 /*1/1000 IN Q31*/ @@ -3061,85 +3058,6 @@ const char *IVAS_DEC_GetErrorMessage( return ivas_error_to_string( error ); } -#ifndef FIX_DISCLAIMER -/*---------------------------------------------------------------------* - * get_channel_config() - * - * Gets a str related to input config - *---------------------------------------------------------------------*/ - -static ivas_error get_channel_config( - AUDIO_CONFIG config, - Word8 *str ) -{ - IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MONO ) ) - { - strcpy( (char *) str, "Mono" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - strcpy( (char *) str, "Stereo" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1 ) ) - { - strcpy( (char *) str, "Multichannel 5.1 (CICP6)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1 ) ) - { - strcpy( (char *) str, "Multichannel 7.1 (CICP12)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_2 ) ) - { - strcpy( (char *) str, "Multichannel 5.1+2 (CICP14)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_4 ) ) - { - strcpy( (char *) str, "Multichannel 5.1+4 (CICP16)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1_4 ) ) - { - strcpy( (char *) str, "Multichannel 7.1+4 (CICP19)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - strcpy( (char *) str, "Multichannel (custom loudspeaker layout)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_FOA ) ) - { - strcpy( (char *) str, "Ambisonics: First Order (FOA)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA2 ) ) - { - strcpy( (char *) str, "Ambisonics: Second Order (HOA2)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA3 ) ) - { - strcpy( (char *) str, "Ambisonics: Third Order (HOA3)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL ) ) - { - strcpy( (char *) str, "Binaural: no room" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) - { - strcpy( (char *) str, "Binaural: room with impulse responses" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - strcpy( (char *) str, "Binaural: room with reverb" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { - strcpy( (char *) str, "External renderer" ); - } - ELSE - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" ); - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * printConfigInfo_dec( ) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 712ead8f4..fcd5142a4 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -161,13 +161,7 @@ typedef struct { Word16 L_frameTCX; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 Pitch; -#endif Word16 Pitch_fx; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 T_bfi; -#endif Word8 T_bfi_fx; Word16 Transient[MAX_POST_LEN]; @@ -187,9 +181,6 @@ typedef struct Word16 step_concealgain_fx; Word16 concealment_method; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 subframe; -#endif Word16 subframe_fx; Word16 nbLostCmpt; Word16 seed; diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 492c927b6..1b51a29fb 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -6070,12 +6070,6 @@ void ivas_swb_tbe_dec_fx( tmp = i_mult( j, ( LPC_SHB_ORDER + 1 ) ); /* convert LSPs to LP coefficients */ E_LPC_f_lsp_a_conversion( lsp_temp_fx, lpc_shb_sf_fx + tmp, LPC_SHB_ORDER ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING - /* Bring the LPCs to Q12 */ - Copy_Scale_sig( lpc_shb_sf_fx + tmp, lpc_shb_sf_fx + tmp, LPC_SHB_ORDER + 1, sub( norm_s( lpc_shb_sf_fx[tmp] ), 2 ) ); - lpc_shb_sf_fx[i_mult( j, ( LPC_SHB_ORDER + 1 ) )] = ONE_IN_Q12; // recheck this - move16(); -#endif } } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 650e8572b..e74df3a96 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -146,28 +146,20 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->tcx_cfg = hTcxCfg; hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); -#endif move16(); hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); -#endif move16(); hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; move16(); hTonalMDCTConc->secondLastPowerSpectrum_exp = hTonalMDCTConc->secondLastBlockData.spectralData_exp; move16(); hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS ); -#endif move16(); hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS ); -#endif move16(); hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; move16(); @@ -234,9 +226,7 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( move16(); /* just the second half of the second last pcm output is needed */ -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->timeDataBuffer, 0, ( 3 * L_FRAME_MAX ) / 2 ); -#endif hTonalMDCTConc->secondLastPcmOut = &hTonalMDCTConc->timeDataBuffer[( 3 * L_FRAME_MAX ) / 2 - ( 3 * min( L_FRAME_MAX, nSamples ) / 2 )]; hTonalMDCTConc->lastPcmOut = &hTonalMDCTConc->timeDataBuffer[( 3 * L_FRAME_MAX ) / 2 - min( L_FRAME_MAX, nSamples )]; /* If the second last frame was lost, we reuse saved TonalComponentsInfo and don't update pcm buffers */ @@ -1226,9 +1216,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word16 element_mode ) { Word32 secondLastMDST[L_FRAME_MAX]; -#ifdef MSAN_FIX set32_fx( secondLastMDST, 0, L_FRAME_MAX ); -#endif Word32 secondLastMDCT[L_FRAME_MAX]; Word16 secondLastMDCT_exp; Word32 *powerSpectrum = secondLastMDST; @@ -1236,9 +1224,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word16 nSamples; // Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; -#ifdef MSAN_FIX set32_fx( sns_int_scf_fx, 0, FDNS_NPTS ); -#endif nSamples = hTonalMDCTConc->nSamples; move16(); @@ -1302,11 +1288,7 @@ void TonalMDCTConceal_Detect_ivas_fx( { /* If the second last frame was also lost, it is expected that pastTimeSignal could hold a bit different signal (e.g. including fade-out) from the one stored in TonalMDCTConceal_SaveTimeSignal. */ /* That is why we reuse the already stored information about the concealed spectrum in the second last frame */ -#ifdef MSAN_FIX Word16 temp_power_spectrum_q = 0; -#else - Word16 power_spectrum_q; -#endif nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 ); @@ -3511,9 +3493,7 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx( psychParams = st->hTonalMDCTConc->psychParams; hFdCngCom = st->hFdCngDec->hFdCngCom; -#ifdef MSAN_FIX set32_fx( whitenend_noise_shape, 0, L_FRAME16k ); -#endif IF( EQ_32( whitening_mode, ON_FIRST_LOST_FRAME ) ) { diff --git a/lib_dec/transition_dec_fx.c b/lib_dec/transition_dec_fx.c index b82378198..b9ad17fcf 100644 --- a/lib_dec/transition_dec_fx.c +++ b/lib_dec/transition_dec_fx.c @@ -56,9 +56,7 @@ void transition_dec_fx( Word16 i, offset, temp, tmp; Word16 limit_flag; Word16 i_subfridx; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( Opt_AMR_WB ); -#endif i_subfridx = i_subfr / L_SUBFR; /*i_subfr / L_SUBFR*/ /* Set limit_flag to 0 for restrained limits, and 1 for extended limits */ @@ -830,9 +828,7 @@ Word16 tc_classif_fx( /*o: Q0*/ ) { Word16 tc_subfr, indice; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( L_frame ); -#endif IF( EQ_16( st_fx->L_frame, L_FRAME ) ) { IF( get_next_indice_fx( st_fx, 1 ) ) diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c index f993caa8d..75a514cc2 100644 --- a/lib_dec/waveadjust_fec_dec_fx.c +++ b/lib_dec/waveadjust_fec_dec_fx.c @@ -848,16 +848,8 @@ void concealment_init_ivas_fx( hPlcInfo->L_frameTCX = L_frameTCX; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->Pitch = 0; - move16(); -#endif hPlcInfo->Pitch_fx = 0; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->T_bfi = 0; - move16(); -#endif hPlcInfo->T_bfi_fx = 0; move16(); hPlcInfo->outx_new_n1_fx = 0; @@ -876,10 +868,6 @@ void concealment_init_ivas_fx( move16(); hPlcInfo->concealment_method = TCX_NONTONAL; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->subframe = 0; - move16(); -#endif hPlcInfo->subframe_fx = 0; move16(); hPlcInfo->nbLostCmpt = (Word16) L_deposit_l( 0 ); @@ -1326,11 +1314,7 @@ static Word16 waveform_adj_fix( test(); test(); test(); -#ifdef NONBE_FIX_1402_WAVEADJUST IF( hPlcInfo->T_bfi_fx && ( LE_16( pitch, Framesizediv2 ) ) && ( GT_16( Framesize, 256 ) ) && ( EQ_16( core, 1 ) ) ) -#else - IF( hPlcInfo->T_bfi && ( LE_16( pitch, Framesizediv2 ) ) && ( GT_16( Framesize, 256 ) ) && ( EQ_16( core, 1 ) ) ) -#endif { Word16 i1 = 0, i2 = 0; Word16 pos1, pos2, pos3; diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index d2d5ac4e6..a93690738 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -395,11 +395,7 @@ ivas_error acelp_core_enc_fx( IF( !nelp_mode && !ppp_mode ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, -#else - st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, -#endif tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); } @@ -465,11 +461,7 @@ ivas_error acelp_core_enc_fx( tc_classif_enc_fx( Q_new, st_fx->L_frame, &tc_subfr_fx, &position, attack_flag, st_fx->pitch[0], res_fx ); config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -#ifdef NONBE_FIX_GSC_BSTR -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, -#else - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, -#endif tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); } @@ -522,11 +514,7 @@ ivas_error acelp_core_enc_fx( /* Configure ACELP bit allocation */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -#ifdef NONBE_FIX_GSC_BSTR -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, -#else - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, -#endif st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); /* redo LSF quantization */ @@ -772,21 +760,17 @@ ivas_error acelp_core_enc_ivas_fx( Word32 Bin_E_fx[L_FFT], Bin_E_old_fx[L_FFT / 2]; Word16 clip_var_fx, mem_w0_bck_fx, streaklimit_fx; -#ifdef MSAN_FIX set16_fx( old_bwe_exc_fx, 0, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ); set16_fx( old_exc_fx, 0, L_EXC ); set16_fx( Aq, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( syn_fx, 0, L_FRAME16k ); -#endif Word16 tilt_code_bck_fx; Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; Word32 q_env_fx[NUM_ENV_CNG]; -#ifdef MSAN_FIX set32_fx( q_env_fx, 0, NUM_ENV_CNG ); set16_fx( exc2_fx, 0, L_FRAME16k ); -#endif Word16 exc3_fx[L_FRAME16k]; Word16 syn1_fx[L_FRAME16k]; Word16 *tdm_Pri_pitch_buf_fx; @@ -1189,11 +1173,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); IF( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* @@ -1330,11 +1310,7 @@ ivas_error acelp_core_enc_ivas_fx( { tc_classif_enc_fx( Q_new, st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res_fx ); -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -1393,11 +1369,7 @@ ivas_error acelp_core_enc_ivas_fx( lsf_syn_mem_restore_ivas_fx( st, tilt_code_bck_fx, gc_threshold_bck_fx, clip_var_bck_fx, next_force_sf_bck, lsp_new, lsp_mid, clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen ); /* Configure ACELP bit allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new ); @@ -1459,11 +1431,7 @@ ivas_error acelp_core_enc_ivas_fx( IF( st->element_mode > EVS_MONO && st->hTcxEnc != NULL ) { Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn -#ifdef MSAN_FIX Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 1 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); // st->Q_syn -#else - Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 2 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); -#endif st->hTcxEnc->q_Txnq = st->Q_syn; move16(); } @@ -1488,11 +1456,7 @@ ivas_error acelp_core_enc_ivas_fx( *-----------------------------------------------------------------*/ Scale_sig( syn_fx, L_FRAME, sub( s_min( st->Q_syn, Q_new ), st->Q_syn ) ); // min( st->Q_syn, Q_new ) -#ifdef MSAN_FIX Scale_sig( res_fx, st->L_frame, sub( s_min( st->Q_syn, Q_new ), Q_new ) ); // min( st->Q_syn, Q_new ) -#else - Scale_sig( res_fx, L_FRAME16k, sub( s_min( st->Q_syn, Q_new ), Q_new ) ); -#endif FEC_encode_ivas_fx( hBstr, st->acelp_cfg, syn_fx, st->coder_type, st->clas, pitch_buf, res_fx, &st->Last_pulse_pos, st->L_frame, st->total_brate, s_min( st->Q_syn, Q_new ) ); IF( st->hBWE_TD != NULL ) { @@ -1557,11 +1521,7 @@ ivas_error acelp_core_enc_ivas_fx( IF( !st->Opt_SC_VBR && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { /* Apply a non linearity to the SHB excitation */ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#else - Copy_Scale_sig_16_32_DEPREC( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#endif non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, Q_new, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index d88e1523e..f9058b9b9 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -149,11 +149,7 @@ void acelp_core_switch_enc_fx( *----------------------------------------------------------------*/ config_acelp1( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, -#ifdef NONBE_FIX_GSC_BSTR GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - GENERIC, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); @@ -264,11 +260,7 @@ void acelp_core_switch_enc_ivas_fx( *----------------------------------------------------------------*/ config_acelp1_IVAS( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, -#ifdef NONBE_FIX_GSC_BSTR GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - GENERIC, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index a1d672fe0..a241101ba 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -269,11 +269,7 @@ Word16 bass_pf_enc_fx( st = sub( s2, s2_old ); FOR( i = 0; i < tmp16; i++ ) { -#ifdef FIX_ISSUE_1187 noise_buf[i] = shl_sat( mem_bpf->noise_buf[i], st ); -#else - noise_buf[i] = shl( mem_bpf->noise_buf[i], st ); -#endif move16(); } Copy( noise_buf + l_subfr, mem_bpf->noise_buf, tmp16 ); diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 6c99a4306..e2b29ba59 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2011,14 +2011,12 @@ void CNG_enc_ivas_fx( /* convert log2 of residual signal energy */ /*enr = (float)log10( enr + 0.1f ) / (float)log10( 2.0f ); */ -#ifdef FIX_ISSUE_1245 IF( L_ener == 0 ) { enr = -850; /*log(0.1) base 2 in Q8*/ move16(); } ELSE -#endif { hi = norm_l( L_ener ); lo = Log2_norm_lc( L_shl( L_ener, hi ) ); diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index e701b8e46..d3725dcba 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -37,14 +37,8 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * Word16 *bwe_exc /* o : excitation for SWB TBE Qx */ ) { -#ifndef SIMPLIFY_CODE_BE - Word16 i, j, i_subfr, j_subfr; - Word16 tmp, tmp2, Es_pred; - Word32 gain_code_vect[2]; -#else Word16 i, i_subfr, j_subfr; Word16 tmp, Es_pred; -#endif Word16 T0, T0_min, T0_min_frac, T0_max, T0_max_frac, T0_res; Word16 T0_frac; Word16 gain_pit, voice_fac; @@ -103,11 +97,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * /* Configure ACELP */ -#ifndef MSAN_FIX - hLPDmem->nbits = BITS_ALLOC_config_acelp( target_bits, st->coder_type, acelp_cfg, st->narrowBand, st->nb_subfr ); -#else BITS_ALLOC_config_acelp( target_bits, st->coder_type, acelp_cfg, st->narrowBand, st->nb_subfr ); -#endif /* Init Framing parameters */ move16(); @@ -324,12 +314,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); -#ifndef SIMPLIFY_CODE_BE - gain_code_vect[0] = gain_code; - move32(); - gain_code_vect[1] = gain_code; - move32(); -#endif /*----------------------------------------------------------* * - voice factor (for pitch enhancement) * *----------------------------------------------------------*/ @@ -361,32 +345,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * /*-------------------------------------------------------* * - Find the total excitation. * *-------------------------------------------------------*/ -#ifndef SIMPLIFY_CODE_BE - tmp2 = shr( L_SUBFR, 1 ); - FOR( j = 0; j < 2; j++ ) - { - FOR( i = sub( tmp2, shr( L_SUBFR, 1 ) ); i < tmp2; i++ ) - { - /* code in Q9, gain_pit in Q14; exc Q_new */ - Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); - Ltmp = L_shl( Ltmp, Q_new_p5 ); - Ltmp = L_mac( Ltmp, gain_pit, exc[i + i_subfr] ); - BASOP_SATURATE_WARNING_OFF_EVS - exc2[i] = round_fx( L_shl( Ltmp, 1 ) ); - BASOP_SATURATE_WARNING_ON_EVS - - Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code[i] ); - Ltmp2 = L_shl( Ltmp2, Q_new_p5 ); - Ltmp = L_add( Ltmp, Ltmp2 ); - BASOP_SATURATE_WARNING_OFF_EVS - Ltmp = L_shl( Ltmp, 1 ); /* saturation can occur here */ - BASOP_SATURATE_WARNING_ON_EVS - exc[i + i_subfr] = round_fx( Ltmp ); - } - tmp2 = L_SUBFR; - move16(); - } -#else FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14; exc Q_new */ @@ -402,7 +360,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); move16(); } -#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index e6fc25e36..54f57b287 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -14,11 +14,9 @@ #include "stl.h" // #include "basop_mpy.h" #include "prot_fx_enc.h" -#ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -1717,9 +1715,7 @@ void EstimateStereoTCXNoiseLevel_fx( Word16 *fac_ns_q; Word32 total_brate; -#ifdef MSAN_FIX set32_fx( combined_q_spectrum, 0, N_MAX ); -#endif FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -4365,9 +4361,6 @@ void coder_tcx_fx( Word16 winMDST[N_MAX + L_MDCT_OVLP_MAX]; Word16 *pWinMDST; Word16 left_overlap_mode, right_overlap_mode; -#ifndef MSAN_FIX - LPD_state_HANDLE hLPDmem = st->hLPDmem; -#endif TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; left_overlap = right_overlap = -1; @@ -4533,10 +4526,6 @@ void coder_tcx_fx( st, hm_cfg ); -#ifndef MSAN_FIX - hLPDmem->nbits = add( hLPDmem->nbits, add( tnsBits, ltpBits ) ); - move16(); -#endif } diff --git a/lib_enc/cod_uv_fx.c b/lib_enc/cod_uv_fx.c index 8eccddc0b..8b1e8a144 100644 --- a/lib_enc/cod_uv_fx.c +++ b/lib_enc/cod_uv_fx.c @@ -135,7 +135,6 @@ void gauss_L2_ivas_fx( *gain = L_deposit_l( 0 ); move32(); /*Update correlations for gains coding */ -#ifdef FIX_ISSUE_1167 tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 ); /* Q16 */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 ); /* Q16 */ FOR( i = 0; i < L_SUBFR; i++ ) @@ -144,34 +143,17 @@ void gauss_L2_ivas_fx( tmp32 = L_mac0( tmp32, tmp16, tmp16 ); /* Q16 */ tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */ } -#else - tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ - tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ - FOR( i = 0; i < L_SUBFR; i++ ) - { - tmp32 = L_mac0( tmp32, y11[i], y11[i] ); /* Q18 */ - tmp32_2 = L_mac0( tmp32_2, y11[i], y2[i] ); /* Q18 */ - } -#endif tmp16 = norm_l( tmp32 ); // To be checked g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) ); -#ifdef FIX_ISSUE_1167 g_corr->y1y1_e = sub( 31 - 16, tmp16 ); -#else - g_corr->y1y1_e = sub( 31 - 18, tmp16 ); -#endif move16(); move16(); tmp16 = norm_l( tmp32_2 ); g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) ); -#ifdef FIX_ISSUE_1167 g_corr->y1y2_e = sub( 31 - 16, tmp16 ); -#else - g_corr->y1y2_e = sub( 31 - 18, tmp16 ); -#endif move16(); move16(); } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index bfe17fcd2..405b3ac2b 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -299,11 +299,9 @@ static void init_tcx_fx( Word16 i; Word16 fscaleFB; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) MCT_flag; (void) total_brate; (void) last_total_brate; -#endif // PMT("init_tcx_fx needs an entire review to adapt to IVAS") fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 ); @@ -945,9 +943,7 @@ static void init_modes_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR const Word32 igf_brate, /* i : IGF configuration bitrate */ -#endif const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { @@ -1080,11 +1076,7 @@ void init_coder_ace_plus_ivas_fx( test(); IF( st->igf && st->hIGFEnc != NULL ) { -#ifdef FIX_920_IGF_INIT_ERROR IGFEncSetMode_ivas_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); -#else - IGFEncSetMode_ivas_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); -#endif } ELSE IF( st->hIGFEnc != NULL ) { diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 04857c334..18f48e904 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -80,10 +80,8 @@ void core_encode_openloop_fx( Word16 w_rf[M + 1], lsf_uq_rf[M + 1]; Word16 lsf_q_1st_rf[M + 1], lsf_q_d_rf[M + 1], lsf_q_rf[M + 1]; Word16 lsp_old_q_rf[M + 1], lsf_old_q_rf[M + 1]; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) vad_hover_flag; (void) vad_flag_dtx; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); diff --git a/lib_enc/core_enc_reconf_fx.c b/lib_enc/core_enc_reconf_fx.c index 1ba496b0e..9e7380aaa 100644 --- a/lib_enc/core_enc_reconf_fx.c +++ b/lib_enc/core_enc_reconf_fx.c @@ -24,9 +24,7 @@ void core_coder_reconfig_fx( { Word16 i, bwidth, index; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) last_total_brate; -#endif /*Configuration of ACELP*/ BITS_ALLOC_init_config_acelp( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) ); diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index f3b4aea6b..2f21f1015 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -408,11 +408,7 @@ void core_coder_mode_switch_ivas_fx( Scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift ); st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); -#else - init_coder_ace_plus_ivas_fx( st, last_total_brate, MCT_flag ); -#endif if ( st->hLPDmem != NULL ) { st->hLPDmem->q_lpd_old_exc = st->prev_Q_new; diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index dc3062298..5290509cd 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -997,10 +997,8 @@ void core_switching_pre_enc_ivas_fx( tmp = sub( L_LOOK_16k + L_SUBFR16k, Sample_Delay_HP ); Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); -#ifdef FIX_ISSUE_1230 hBWE_FD->Q_new_input_hp = 0; move16(); -#endif IF( NE_16( st_fx->last_extl, WB_BWE ) ) { diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index 3624cf374..c95bc9d5b 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -386,7 +386,6 @@ void decision_matrix_enc_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ @@ -400,7 +399,6 @@ void decision_matrix_enc_fx( move16(); } -#endif return; } diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 154b43c12..44be8dcc6 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -29,9 +29,6 @@ #define CNG_TYPE_HO 20 /* hangover for switching between CNG types */ -#ifndef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD -#define DTX_THR 5 /* LP_NOISE level */ -#endif #define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ #define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ @@ -64,9 +61,7 @@ static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, /*==================================================================================*/ void dtx_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ const Word16 vad, /* i : vad flag for DTX Q0*/ const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ @@ -83,21 +78,15 @@ void dtx_ivas_fx( Flag Overflow = 0; move32(); #endif -#ifdef NONBE_1211_DTX_BR_SWITCHING Word32 total_brate_ref; total_brate_ref = st_fx->total_brate; move32(); -#endif IF( st_fx->dtx_sce_sba != 0 ) { last_br_cng_flag = 1; last_br_flag = 1; -#ifndef NONBE_1211_DTX_BR_SWITCHING - br_dtx_flag = 1; - move16(); -#endif move16(); move16(); } @@ -112,15 +101,9 @@ void dtx_ivas_fx( test(); test(); -#ifdef NONBE_1211_DTX_BR_SWITCHING last_br_flag = ( st_fx->element_mode == EVS_MONO && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) ) || ( st_fx->element_mode != EVS_MONO && LE_32( last_ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ); -#else - last_br_flag = LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_IVAS ) ); - br_dtx_flag = 0; - move16(); -#endif } /* Initialization */ @@ -217,10 +200,8 @@ void dtx_ivas_fx( * Select SID or FRAME_NO_DATA frame if DTX is enabled *------------------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING br_dtx_flag = 1; move16(); -#endif IF( st_fx->dtx_sce_sba == 0 ) { @@ -230,11 +211,7 @@ void dtx_ivas_fx( test(); br_dtx_flag = ( ( st_fx->element_mode == EVS_MONO ) && LE_32( st_fx->total_brate, MAX_BRATE_DTX_EVS ) ) || ( ( st_fx->element_mode != EVS_MONO ) && LE_32( ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ); -#else - LT_16( st_fx->lp_noise_fx, 3840 /*15 in Q8*/ ); -#endif } test(); test(); @@ -352,13 +329,11 @@ void dtx_ivas_fx( reset_indices_enc_fx( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); } } -#ifdef NONBE_1211_DTX_BR_SWITCHING ELSE IF( st_fx->element_mode != EVS_MONO ) { st_fx->total_brate = total_brate_ref; move32(); } -#endif /*------------------------------------------------------------------------* * Reset counters when in active frame (not in SID or FRAME_NO_DATA frame) diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index a509a7cd7..4317bdbb3 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -1387,7 +1387,6 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const return; } -#ifdef FIX_ISSUE_1165 void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ) { Word16 sign[L_SUBFR], vec[L_SUBFR]; @@ -1712,7 +1711,6 @@ void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, } return; } -#endif /* * E_ACELP_4t_fx @@ -1869,11 +1867,7 @@ void E_ACELP_4t_ivas_fx( } ELSE { -#ifdef FIX_ISSUE_1165 E_ACELP_4tsearch_ivas_fx( dn, cn, H, code, &config, ind, y ); -#else - E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y ); -#endif } E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index ); return; diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index f18da2ef2..9612696ed 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -781,11 +781,7 @@ void E_ACELP_4tsearchx_ivas_fx( alp = shr( alp, 1 ); Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/ Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ -#ifndef MSAN_FIX - Scale_sig( dn, 2 * L_SUBFR, -1 ); -#else Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ -#endif } diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 06c49a8d3..62f740fb2 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -656,11 +656,7 @@ void encod_gen_voic_ivas_fx( *-----------------------------------------------------------------*/ test(); -#ifdef NONBE_FIX_GSC_BSTR IF( !st_fx->inactive_coder_type_flag && EQ_16( st_fx->coder_type, INACTIVE ) ) -#else - IF( GE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) -#endif { transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 7e5734e70..7af329a1c 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -578,9 +578,6 @@ void enc_pit_exc_ivas_fx( Word16 use_fcb; Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes*/ -#ifndef FIX_ISSUE_1376 - Word16 h1_q15[PIT_EXC_L_SUBFR + ( M + 1 )]; -#endif Word16 q_h1; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; @@ -602,9 +599,7 @@ void enc_pit_exc_ivas_fx( move16(); Pitch_CT = GENERIC; move16(); -#ifdef MSAN_FIX set16_fx( cn1, 0, PIT_EXC_L_SUBFR ); -#endif test(); test(); IF( st_fx->GSC_IVAS_mode > 0 && ( st_fx->GSC_noisy_speech || GT_32( st_fx->core_brate, GSC_H_RATE_STG ) ) ) @@ -773,15 +768,8 @@ void enc_pit_exc_ivas_fx( * Codebook target computation * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ -#ifndef FIX_ISSUE_1376 - Copy_Scale_sig( h1, h1_q15, L_subfr, 1 ); // Q14 -> Q15 - - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1_q15, - xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#else lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 5b9f67503..4cda393d5 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -478,9 +478,7 @@ Word16 encod_tran_ivas_fx( L_frame_fx = st_fx->L_frame; move16(); -#ifdef MSAN_FIX set16_fx( h1, 0, L_SUBFR + ( M + 1 ) ); -#endif /*------------------------------------------------------------------* * Initializations diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index b0c67abf5..8a77b9e2b 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -453,14 +453,10 @@ void encod_unvoiced_ivas_fx( voice_factors_fx[i_subfr / L_SUBFR] = 0; move16(); -#ifdef FIX_ISSUE_1148 if ( st_fx->hBWE_TD != NULL ) { interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); } -#else - interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. diff --git a/lib_enc/energy_fx.c b/lib_enc/energy_fx.c index 7dc96a4e3..0168e52b1 100644 --- a/lib_enc/energy_fx.c +++ b/lib_enc/energy_fx.c @@ -451,11 +451,7 @@ void background_update_fx( tmp = L_shr( 2147 /* 0.000001 Q31 */, sub( 31, scale_sb_energy ) ); /* scale_sb_energy */ FOR( i = 0; i < SNR_sb_num; i++ ) { -#ifdef FIX_ISSUE_1209 sb_bg_energy[i] = L_add_sat( MUL_F( sb_bg_energy[i], 32112 /* 0.98 Q15 */ ), tmp ); /* scale_sb_energy */ -#else - sb_bg_energy[i] = L_add( MUL_F( sb_bg_energy[i], 32112 /* 0.98 Q15 */ ), tmp ); /* scale_sb_energy */ -#endif move32(); } } diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index f546c3ef8..087d892e3 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -967,10 +967,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( Q_win_temp[frameno] = *q_win; move16(); -#ifdef MSAN_FIX Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len[frameno], *q_win ); // q_win -#endif IF( EQ_16( frameno, 1 ) ) { Scale_sig32( windowed_samples + 2, win_len[0], sub( *q_win, Q_win_temp[0] ) ); // q_win @@ -1384,27 +1382,11 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( st->igf ) { Word16 q_spectrum = sub( Q31, hTcxEnc->spectrum_e[frameno] ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); -#else ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); -#endif } } } -#ifndef MSAN_FIX - IF( windowed_samples != NULL ) - { - FOR( frameno = 0; frameno < nSubframes; frameno++ ) - { - IF( !( ( EQ_16( transform_type[frameno], TCX_20 ) ) && ( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) ) ) - { - Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len, *q_win ); - } - } - } -#endif IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index ea71b09bc..ed8ff425e 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -93,11 +93,7 @@ void find_tilt_fx( } tmp = BASOP_Util_Divide3232_Scale( lp_bckr, hp_bckr, &e_tmp ); -#ifdef FIX_ISSUE_1152 Ltmp = L_shr_r_sat( L_deposit_h( tmp ), sub( 15, e_tmp ) ); -#else - Ltmp = L_shr_r( L_deposit_h( tmp ), sub( 15, e_tmp ) ); -#endif *bckr_tilt_lt = L_add( Mpy_32_16_r( *bckr_tilt_lt, 29491 ), Mpy_32_16_r( Ltmp, 3277 ) ); /* Q16 */ diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index f943b104d..edddc6a88 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -979,13 +979,8 @@ void gauss2v_ivas_fx( /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */ /* Use ScalingShift to stay aligned with ener[] */ eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */ -#ifndef FIX_1298 - eneri = L_add( ener[i], eneri ); - eneri = L_add( ener[j], eneri ); /* Q31 */ -#else eneri = L_add_sat( ener[i], eneri ); eneri = L_add_sat( ener[j], eneri ); /* Q31 */ -#endif lo1 = L_Extract_lc( cor32, &hi1 ); cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 944cb2649..2b53082f7 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -83,7 +83,6 @@ static Word16 hf_spectrum_sparseness_fx( crest_mod_fx = 0; move32(); maximum_l( A_fx, L_SPEC_HB, &Amax_fx ); -#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO IF( Amax_fx == 0 ) { /* For all-zero input the crest is 1.0 */ @@ -94,7 +93,6 @@ static Word16 hf_spectrum_sparseness_fx( } ELSE { -#endif thr_fx = Mpy_32_32( Amax_fx, PEAK_THRESHOLD_FX ); /* Q12 */ movmean_fx = 0; /* avoid uninitialized warning */ move32(); @@ -160,9 +158,7 @@ static Word16 hf_spectrum_sparseness_fx( move32(); st->hHQ_core->crest_mod_lp_q = sub( Q12, inv_rms32_e ); move16(); -#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO } -#endif *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); /* Q(st->hHQ_core->crest_lp_q) */ move32(); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index f22218d13..6bc466e3d 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -374,7 +374,6 @@ void HQ_core_enc_init_fx( hHQ_core->last_max_pos_pulse = 0; move16(); -#ifdef MSAN_FIX hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; /* Q28 */ move32(); hHQ_core->crest_lp_q = Q28; @@ -383,7 +382,6 @@ void HQ_core_enc_init_fx( move32(); hHQ_core->crest_mod_lp_q = Q29; move16(); -#endif return; } @@ -482,11 +480,7 @@ void hq_core_enc_ivas_fx( Q_audio = sub( Q16, q ); TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ -#else - Copy_Scale_sig_16_32_DEPREC( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ -#endif inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index fc7c32fdb..d5f071784 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -716,13 +716,8 @@ static void IGF_CalculateEnvelope_ivas_fx( Word32 mean_y_fx_tmp = 0; move32(); mean_xy_fx = mean_x2_fx = 0; -#ifdef FIX_ISSUE_1214 mean_x_e = 15; mean_xy_e = mean_y_e = mean_x2_e = 31; -#else - mean_x_e = mean_y_e = 15; - mean_xy_e = mean_x2_e = 31; -#endif move16(); move16(); move16(); @@ -738,21 +733,12 @@ static void IGF_CalculateEnvelope_ivas_fx( mean_x_fx = add( mean_x_fx, x ); /*Q0*/ mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/ -#ifdef FIX_ISSUE_1214 /*y = 20.f * log10f( max( 1.f, powerSpectrum[i] ) );*/ IF( LE_64( W_deposit32_l( pPowerSpectrum_fx[sb] ), W_shl( 1, ( sub( 31, e_ps[sb] ) ) ) ) ) { y = 0; move16(); } -#else - - /*y = 20 * (int16_t) log10f( max( 1e-018f, pPowerSpectrum[sb] ) );*/ - IF( LT_32( pPowerSpectrum_fx[sb], 1 ) ) - { - y = imult1616( 20, ( -18 /* log10f(1e-018f) */ ) ); - } -#endif ELSE { y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( e_ps[sb], Q25 ) ) ), INV_Log2_10_Q15 ), Q25 ) ) ); /*Q0*/ @@ -1258,21 +1244,12 @@ static void IGF_CalculateStereoEnvelope_fx( move16(); } } -#ifdef FIX_ISSUE_1214 tmp_tb_fx = shr_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ tmp_sb_fx = shr_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_TB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_TB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/ hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_SB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_SB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/ -#else - tmp_tb_fx = shl_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - tmp_sb_fx = shl_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, tmp_tb_e ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, tmp_tb_e ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/ - hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, tmp_sb_e ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, tmp_sb_e ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/ -#endif move16(); move16(); move16(); @@ -2541,9 +2518,7 @@ void IGFEncResetTCX10BitCounter_ivas_fx( void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ -#endif const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ @@ -2563,9 +2538,7 @@ void IGFEncApplyMono_ivas_fx( Word32 common_pPowerSpectrum_fx[N_MAX + L_MDCT_OVLP_MAX]; -#ifdef MSAN_FIX set32_fx( common_pPowerSpectrum_fx, 0, N_MAX + L_MDCT_OVLP_MAX ); -#endif Word16 common_pPowerSpectrum_exp = MIN16B; move16(); @@ -2624,20 +2597,12 @@ void IGFEncApplyMono_ivas_fx( IF( pPowerSpectrumParameter_fx ) { -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < N_MAX + L_MDCT_OVLP_MAX; i++ ) -#else FOR( Word16 i = 0; i < powerSpectrum_len; i++ ) -#endif { common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, pPowerSpectrumParameter_exp[i] ); } -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < N_MAX + L_MDCT_OVLP_MAX; i++ ) -#else FOR( Word16 i = 0; i < powerSpectrum_len; i++ ) -#endif { common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[i], sub( pPowerSpectrumParameter_exp[i], common_pPowerSpectrum_exp ) ); move16(); diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index ebfd9c4a2..1d695659c 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1398,11 +1398,7 @@ ivas_error init_encoder_ivas_fx( st->exp_buf_wspeech_enc = 0; move16(); /* initializations */ -#ifndef MSAN_FIX - set32_fx( st->Bin_E_old_fx, 0, shr( L_FFT, 2 ) ); -#else set32_fx( st->Bin_E_old_fx, 0, L_FFT / 2 ); -#endif st->q_Bin_E_old = Q31; move16(); set16_fx( st->mem_decim_fx, 0, shl( L_FILT_MAX, 1 ) ); @@ -1821,10 +1817,8 @@ ivas_error init_encoder_ivas_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } ELSE { @@ -2069,7 +2063,6 @@ ivas_error init_encoder_ivas_fx( set16_fx( st->totalNoise_increase_hist_fx, 0, TOTALNOISE_HIST_SIZE ); st->totalNoise_increase_len = 0; move16(); -#ifdef IVAS_FLOAT_FIXED_CONVERSIONS TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; IF( hTcxEnc != NULL ) { @@ -2080,10 +2073,8 @@ ivas_error init_encoder_ivas_fx( move32(); st->currEnergyHF_e_fx = 0; move16(); -#ifdef MSAN_FIX st->prevEnergyHF_fx = 0; move32(); -#endif /* Initialize TCX */ @@ -2097,12 +2088,7 @@ ivas_error init_encoder_ivas_fx( st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); /* Initialize ACELP */ -#endif -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); -#else - init_coder_ace_plus_ivas_fx( st, st->last_total_brate, 0 ); -#endif IF( st->hLPDmem != NULL ) { diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 46bec5f4d..e47b14559 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -89,9 +89,7 @@ Word16 inov_encode_fx( Word16 Rw[L_SUBFR]; Word16 acelpautoc; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) last_L_frame; -#endif stack_pulses = 0; move16(); diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index cacbcabd3..1e7a13d45 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -118,14 +118,12 @@ ivas_error ivas_core_enc_fx( set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) { set_zero_fx( bwe_exc_extended_fx[i], L_FRAME32k + NL_BUFF_OFFSET ); set16_fx( old_syn_12k8_16k_fx[i], 0, L_FRAME16k ); } set16_fx( shb_speech_fx, 0, L_FRAME16k ); -#endif push_wmops( "ivas_core_enc" ); @@ -215,7 +213,6 @@ ivas_error ivas_core_enc_fx( /*---------------------------------------------------------------------* * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ -#ifdef MSAN_FIX IF( st->cldfbAnaEnc ) { Word16 tmp_shift = L_norm_arr( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels ); @@ -227,16 +224,6 @@ ivas_error ivas_core_enc_fx( move16(); } } -#else - Word16 tmp_shift = getScaleFactor32( enerBuffer_fx[n], CLDFB_NO_CHANNELS_MAX ); - tmp_shift = sub( tmp_shift, 5 ); - IF( tmp_shift < 0 ) - { - scale_sig32( enerBuffer_fx[n], CLDFB_NO_CHANNELS_MAX, tmp_shift ); - enerBuffer_fx_exp[n] = sub( enerBuffer_fx_exp[n], tmp_shift ); - move16(); - } -#endif Scale_sig( fft_buff_fx[n], ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum // fft_buff_fx_exp = add(fft_buff_fx_exp,1); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 45098926e..bf7c36eef 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -131,9 +131,7 @@ ivas_error pre_proc_front_ivas_fx( const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO @@ -212,10 +210,6 @@ ivas_error pre_proc_front_ivas_fx( Word16 new_inp_out_size; Word16 Q_new_inp; Word16 mem_decim_size; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - Word16 Q_new; - Word16 corr_shift_fx; -#endif Word16 dummy_fx; Word16 ncharX_fx; @@ -259,13 +253,8 @@ ivas_error pre_proc_front_ivas_fx( IF( hSCE != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx, hSCE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx - input_frame, hSCE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( hSCE->hCoreCoder[n]->input_fx, hSCE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( hSCE->hCoreCoder[n]->input_fx - input_frame, hSCE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#endif hSCE->hCoreCoder[n]->q_inp32 = Q11; move16(); Scale_sig( hSCE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ @@ -282,13 +271,8 @@ ivas_error pre_proc_front_ivas_fx( } ELSE { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx, hCPE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx - input_frame, hCPE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->input_fx, hCPE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->input_fx - input_frame, hCPE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#endif hCPE->hCoreCoder[n]->q_inp32 = Q11; move16(); Scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ @@ -316,13 +300,11 @@ ivas_error pre_proc_front_ivas_fx( } #endif -#ifdef MSAN_FIX FOR( Word16 k = 0; k < CLDFB_NO_COL_MAX; k++ ) { set32_fx( realBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( imagBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); } -#endif Word16 sf_energySum[CLDFB_NO_CHANNELS_MAX]; Word16 Q_to_be_looked_into = -1; @@ -365,9 +347,6 @@ ivas_error pre_proc_front_ivas_fx( IF( hSCE != NULL ) { st = hSCE->hCoreCoder[n]; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - signal_in = hSCE->hCoreCoder[n]->input; -#endif signal_in_fx = hSCE->hCoreCoder[n]->input_fx; /* hSCE->hCoreCoder[n]->q_inp */ signal32_in_fx = hSCE->hCoreCoder[n]->input32_fx; /* hSCE->hCoreCoder[n]->q_inp32 */ element_mode = IVAS_SCE; @@ -381,9 +360,6 @@ ivas_error pre_proc_front_ivas_fx( ELSE /* CPE */ { st = hCPE->hCoreCoder[n]; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - signal_in = hCPE->hCoreCoder[n]->input; -#endif signal_in_fx = hCPE->hCoreCoder[n]->input_fx; /* hSCE->hCoreCoder[n]->q_inp */ signal32_in_fx = hCPE->hCoreCoder[n]->input32_fx; /* hSCE->hCoreCoder[n]->q_inp32 */ element_mode = hCPE->element_mode; @@ -1092,11 +1068,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx_ivas_fx( st, last_ivas_total_brate, ivas_total_brate, *vad_flag_dtx, inp_12k8_fx, *Q_new ); -#else - dtx_ivas_fx( st, ivas_total_brate, *vad_flag_dtx, inp_12k8_fx, *Q_new ); -#endif test(); test(); @@ -1464,11 +1436,7 @@ ivas_error pre_proc_front_ivas_fx( st->coder_type = find_uv_ivas_fx( st, pitch_fr_fx, voicing_fr_fx, inp_12k8_fx, ee_fx, &dE1X_fx, corr_shift_fx, *relE_fx, Etot_fx, hp_E_fx, &flag_spitch, last_core_orig, hStereoClassif, *Q_new /*q_inp_12k8*/, fr_bands_fx_q ); // Q0 -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->lgBin_E_fx, st->Bin_E_fx, L_FFT / 2, sub( st->q_Bin_E, Q7 ) ); -#else - Copy_Scale_sig_16_32_DEPREC( st->lgBin_E_fx, st->Bin_E_fx, L_FFT / 2, sub( st->q_Bin_E, Q7 ) ); -#endif #ifdef DEBUG_FORCE_DIR if ( st->force_dir[0] != '\0' ) diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 8d00e608c..ca53a227a 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -282,11 +282,7 @@ ivas_error pre_proc_ivas_fx( } ELSE IF( GT_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) && ( ( st->vad_flag == 0 && GE_16( st->bwidth, SWB ) && GE_16( st->max_bwidth, SWB ) ) || ( st->localVAD == 0 && ( LE_16( st->bwidth, WB ) || LE_16( st->max_bwidth, WB ) ) ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR /* inactive frames will be coded by AVQ technology (exceptionally it can be later rewritten to GSC technology in ivas_combined_format_brate_sanity()) */ -#else - /* inactive frames will be coded by AVQ technology */ -#endif st->coder_type = INACTIVE; move16(); } @@ -734,9 +730,7 @@ ivas_error ivas_compute_core_buffers_fx( Word16 *preemp_start_idx = NULL; Word32 sig_out[960], max_32; /*Word16 Q_exp, Q_wsp_exp*/; -#ifdef MSAN_FIX set16_fx( new_inp_resamp16k_fx, 0, L_FRAME16k ); -#endif set16_fx( epsP_h, 0, M + 1 ); set16_fx( epsP_l, 0, M + 1 ); signal_in_fx = st->input_fx; /* st->q_inp */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index ea70a33d3..6108b138c 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -78,9 +78,7 @@ ivas_error ivas_cpe_enc_fx( Word16 Q_new[CPE_CHANNELS] = { 0 }; Word16 fft_buff_fx[CPE_CHANNELS][2 * L_FFT]; /* FFT buffer */ Word16 fft_buff_fx_q[CPE_CHANNELS]; /* FFT buffer */ -#ifdef MSAN_FIX set16_fx( fft_buff_fx_q, 0, CPE_CHANNELS ); -#endif Word16 fft_buff_fx_final_q = MAX_16; move16(); Word32 ener_fx[CPE_CHANNELS]; /* residual energy from Levinson-Durbin Q6 */ @@ -176,7 +174,6 @@ ivas_error ivas_cpe_enc_fx( set16_fx( voicing_fr_fx[0], 0, NB_SUBFR ); set16_fx( voicing_fr_fx[1], 0, NB_SUBFR ); -#ifdef MSAN_FIX FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) { set16_zero_fx( fft_buff_fx[i], 2 * L_FFT ); @@ -185,7 +182,6 @@ ivas_error ivas_cpe_enc_fx( set16_zero_fx( old_inp_12k8_16fx[i], L_INP_12k8 ); set_zero_fx( old_inp_12k8_fx[i], L_INP_12k8 ); } -#endif /*------------------------------------------------------------------* * CPE initialization - core coder *-----------------------------------------------------------------*/ @@ -288,9 +284,7 @@ ivas_error ivas_cpe_enc_fx( move16(); Word16 front_create_flag = 0; move16(); -#ifdef MSAN_FIX set32_fx( band_energies_LR_fx, 0, 2 * NB_BANDS ); -#endif IF( hCPE->hFrontVad[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) { @@ -375,13 +369,8 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Set TD stereo parameters *----------------------------------------------------------------*/ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ -#endif Word16 shift = getScaleFactor32( sts[1]->input32_fx, input_frame ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* Q11 + shift */ sts[1]->q_inp32 = add( Q11, shift ); @@ -408,7 +397,6 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ -#ifdef FIX_ISSUE_1247 shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); @@ -426,25 +414,6 @@ ivas_error ivas_cpe_enc_fx( Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); move16(); -#else - shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); - Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[1]->input_fx, input_frame ); - Scale_sig( sts[1]->input_fx, input_frame, shift ); /* sts[1]->q_inp + shift */ - sts[1]->q_inp = add( sts[1]->q_inp, shift ); - move16(); - - shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); - Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[0]->input_fx, input_frame ); - Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ - sts[0]->q_inp = add( sts[0]->q_inp, shift ); - move16(); -#endif Word16 q_inp = s_min( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), s_min( sts[1]->q_inp, sts[1]->q_old_inp ) ); @@ -682,9 +651,6 @@ ivas_error ivas_cpe_enc_fx( // printf("\n%f %f ", hCPE->hStereoClassif->is_speech, hCPE->hCoreCoder[0]->hSpMusClas->past_dlp[0]); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { -#ifndef MSAN_FIX - hCPE->hStereoClassif->xtalk_score_fx = floatToFixed( hCPE->hStereoClassif->xtalk_score, 31 ); -#endif // !MSAN_FIX /*flt2fix: dft_synthesize*/ test(); if ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] ) @@ -866,7 +832,6 @@ ivas_error ivas_cpe_enc_fx( move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); -#ifdef FIX_ISSUE_1135 // Normalise the input buffer from Q15 Word16 input_norm, q_inp32, common_q, fir_delay_len; input_norm = L_norm_arr( sts[0]->input32_fx + out_start_ind, sub( out_end_ind, out_start_ind ) ); @@ -887,9 +852,6 @@ ivas_error ivas_cpe_enc_fx( move16(); sts[0]->q_old_inp = common_q; move16(); -#else - Copy_Scale_sig32_16( sts[0]->input32_fx + out_start_ind, sts[0]->input_fx + out_start_ind, sub( out_end_ind, out_start_ind ), sub( add( Q16, sts[0]->q_inp ), Q15 ) ); // Q15 -#endif /* iDFT & resampling to 12.8kHz internal sampling rate */ stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[0] + L_INP_MEM, &out_12k8_start_ind[0], &out_12k8_end_ind[0], 0, input_Fs, INT_FS_12k8, 0, NULL ); @@ -956,11 +918,7 @@ ivas_error ivas_cpe_enc_fx( &ener_fx[n], &relE_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], &vad_hover_flag[n], &attack_flag[n], realBuffer_fx[n], imagBuffer_fx[n], &q_re_im_buf[n], old_wsp_fx[n], &q_old_wsp, pitch_fr_fx[n], voicing_fr_fx[n], &loc_harm[n], &cor_map_sum_fx[n], &vad_flag_dtx[n], enerBuffer_fx[n], &enerBuffer_fx_exp[n], fft_buff_fx[n], &fft_buff_fx_q[n], A_fx[0], lsp_new_fx[0], currFlatness_fx[n], tdm_ratio_idx, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, q_lf_E[n], localVAD_HE_SAD, -#ifdef NONBE_1211_DTX_BR_SWITCHING band_energies_LR_fx, q_band_energies_LR, 0, front_vad_flag, 0, 0, ivas_format, st_ivas->hMCT != NULL, st_ivas->hEncoderConfig->last_ivas_total_brate, ivas_total_brate, &Q_new[n] -#else - band_energies_LR_fx, q_band_energies_LR, 0, front_vad_flag, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate, &Q_new[n] -#endif #ifdef DEBUG_MODE_INFO , ( st_ivas->nSCE + ( cpe_id * CPE_CHANNELS ) + n ) @@ -1418,9 +1376,7 @@ ivas_error create_cpe_enc_fx( hCPE->input_mem_fx[n] = NULL; } } -#ifdef MSAN_FIX set16_fx( hCPE->q_input_mem, Q15, CPE_CHANNELS ); -#endif /*-----------------------------------------------------------------* * stereo classifier: allocate and initialize diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index db5ee872b..59447c022 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -52,11 +52,9 @@ static void computeIntensityVector_enc_fx( const Word16 enc_param_start_band, /* i : first band to process */ const Word16 num_frequency_bands, Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 q_cldfb, Word16 q_intensity_real[DIRAC_MAX_NBANDS] -#endif ); /*------------------------------------------------------------------------- @@ -761,7 +759,6 @@ void computeReferencePower_enc_fx_dirac( *dirac_mono_flag = ivas_dirac_get_mono_flag_fx( band_grouping, Cldfb_RealBuffer, Cldfb_ImagBuffer, e_Cldfb, nchan_ana, mono_frame_count ); /* Q0 */ move16(); } -#ifdef FIX_1127_IMPROVE_SBA_MLD Word16 gb = 0; move16(); FOR( i = 0; i < num_freq_bands; i++ ) @@ -774,7 +771,6 @@ void computeReferencePower_enc_fx_dirac( } e_reference_W = sub( 31, sub( add( shl( sub( 31, e_Cldfb ), 1 ), 1 ), gb ) ); e_reference_temp = e_reference_W; -#endif move16(); FOR( i = 0; i < num_freq_bands; i++ ) { @@ -791,14 +787,8 @@ void computeReferencePower_enc_fx_dirac( FOR( j = brange[0]; j < brange[1]; j++ ) { -#ifdef FIX_1127_IMPROVE_SBA_MLD reference_power_W[i] = W_add( reference_power_W[i], W_shr( W_mult_32_32( Cldfb_RealBuffer[0][j], Cldfb_RealBuffer[0][j] ), gb ) ); /* exp(2 * e_Cldfb) */ reference_power_W[i] = W_add( reference_power_W[i], W_shr( W_mult_32_32( Cldfb_ImagBuffer[0][j], Cldfb_ImagBuffer[0][j] ), gb ) ); /* exp(2 * e_Cldfb) */ -#else - reference_power_W[i] = W_mac_32_32( reference_power_W[i], Cldfb_RealBuffer[0][j], Cldfb_RealBuffer[0][j] ); - reference_power_W[i] = W_mac_32_32( reference_power_W[i], Cldfb_ImagBuffer[0][j], Cldfb_ImagBuffer[0][j] ); - e_reference_W = imult1616( (Word16) 2, e_Cldfb ); -#endif move64(); move64(); } @@ -810,14 +800,8 @@ void computeReferencePower_enc_fx_dirac( /* abs()^2 */ FOR( j = brange[0]; j < brange[1]; j++ ) { -#ifdef FIX_1127_IMPROVE_SBA_MLD reference_power_temp[i] = W_add( reference_power_temp[i], W_shr( W_mult_32_32( Cldfb_RealBuffer[ch_idx][j], Cldfb_RealBuffer[ch_idx][j] ), gb ) ); /* exp(2 * e_Cldfb) */ reference_power_temp[i] = W_add( reference_power_temp[i], W_shr( W_mult_32_32( Cldfb_ImagBuffer[ch_idx][j], Cldfb_ImagBuffer[ch_idx][j] ), gb ) ); /* exp(2 * e_Cldfb) */ -#else - reference_power_temp[i] = W_mac_32_32( reference_power_temp[i], Cldfb_RealBuffer[ch_idx][j], Cldfb_RealBuffer[ch_idx][j] ); - reference_power_temp[i] = W_mac_32_32( reference_power_temp[i], Cldfb_ImagBuffer[ch_idx][j], Cldfb_ImagBuffer[ch_idx][j] ); - e_reference_temp = imult1616( (Word16) 2, e_Cldfb ); -#endif move64(); move64(); } @@ -974,11 +958,7 @@ void ivas_dirac_param_est_enc_fx( Word32 *p_Cldfb_ImagBuffer_fx[DIRAC_MAX_ANA_CHANS]; Word16 cldfb_q; Word32 intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS]; -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 intensity_real_q[DIRAC_MAX_NBANDS]; -#else - Word16 intensity_real_q; -#endif Word32 direction_vector_fx[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS]; Word16 direction_vector_q; Word32 diffuseness_vector_fx[DIRAC_MAX_NBANDS]; @@ -1008,10 +988,6 @@ void ivas_dirac_param_est_enc_fx( cldfb_q = 0; move16(); -#ifndef NONBE_IMPROVE_DIRAC_INTENSITY_PREC - intensity_real_q = 0; - move16(); -#endif direction_vector_q = 0; move16(); @@ -1148,15 +1124,10 @@ void ivas_dirac_param_est_enc_fx( hDirAC->hConfig->enc_param_start_band, num_freq_bands, intensity_real_fx -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , cldfb_q, intensity_real_q -#endif ); -#ifndef NONBE_IMPROVE_DIRAC_INTENSITY_PREC - intensity_real_q = sub( shl( cldfb_q, 1 ), 31 ); // 2 * Q_Cldfb + 1 - 32; -#endif IF( !hodirac_flag ) { computeDirectionVectors_fixed( @@ -1168,13 +1139,8 @@ void ivas_dirac_param_est_enc_fx( direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2] -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , 31, intensity_real_q -#else - , - sub( 31, intensity_real_q ) -#endif ); direction_vector_q = Q30; @@ -1190,11 +1156,7 @@ void ivas_dirac_param_est_enc_fx( { /* only real part needed */ Copy32( intensity_real_fx[i], &( hDirAC->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); /* intensity_real_q */ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Copy( intensity_real_q, &hDirAC->buffer_intensity_real_q[i][index - 1][0], num_freq_bands ); -#else - set16_fx( &hDirAC->buffer_intensity_real_q[i][index - 1][0], intensity_real_q, num_freq_bands ); -#endif } Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); /* exp(reference_power_exp) */ FOR( i = 0; i < num_freq_bands; i++ ) @@ -1406,12 +1368,7 @@ void ivas_dirac_param_est_enc_fx( Scale_sig32( dir_v_fx, 3, -1 ); ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( dir_v_fx, -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Q29, -#else - - Q30, -#endif &q_direction->band_data[band_m_idx].azimuth_fx[block_m_idx], &q_direction->band_data[band_m_idx].elevation_fx[block_m_idx] ); } @@ -1506,11 +1463,9 @@ static void computeIntensityVector_enc_fx( const Word16 enc_param_start_band, /* i : first band to process Q0*/ const Word16 num_frequency_bands, /* Q0 */ Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] /* q_intensity_real */ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 q_cldfb, Word16 q_intensity_real[DIRAC_MAX_NBANDS] -#endif ) { /* Reminder @@ -1520,20 +1475,16 @@ static void computeIntensityVector_enc_fx( Word16 i, j; Word32 real, img; Word16 brange[2]; -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 shift_value = sub( shl( q_cldfb, 1 ), 31 ); -#endif FOR( i = 0; i < num_frequency_bands; i++ ) { brange[0] = hDirAC->band_grouping[i + enc_param_start_band]; /* Q0 */ move16(); brange[1] = hDirAC->band_grouping[i + enc_param_start_band + 1]; /* Q0 */ move16(); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 num_bins = sub( brange[1], brange[0] ); Word16 gb = find_guarded_bits_fx( num_bins ); Word16 norm; -#endif intensity_real[0][i] = 0; move32(); intensity_real[1][i] = 0; @@ -1552,7 +1503,6 @@ static void computeIntensityVector_enc_fx( move32(); img = Cldfb_ImagBuffer[0][j]; move32(); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word64 t1, t2, t3; t1 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), Cldfb_ImagBuffer[3][j], img ); /* 2 * q_cldfb + 1 */ t2 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), Cldfb_ImagBuffer[1][j], img ); /* 2 * q_cldfb + 1 */ @@ -1564,14 +1514,7 @@ static void computeIntensityVector_enc_fx( tmp_1 = W_add( tmp_1, t1 ); /* 2 * q_cldfb + 1 */ tmp_2 = W_add( tmp_2, t2 ); /* 2 * q_cldfb + 1 */ tmp_3 = W_add( tmp_3, t3 ); /* 2 * q_cldfb + 1 */ -#else - /* Intensity is XYZ order, audio is WYZX order. */ - tmp_1 = W_add( tmp_1, W_add( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), W_mult_32_32( Cldfb_ImagBuffer[3][j], img ) ) ); - tmp_2 = W_add( tmp_2, W_add( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), W_mult_32_32( Cldfb_ImagBuffer[1][j], img ) ) ); - tmp_3 = W_add( tmp_3, W_add( W_mult_32_32( Cldfb_RealBuffer[2][j], real ), W_mult_32_32( Cldfb_ImagBuffer[2][j], img ) ) ); -#endif } -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC norm = 63; move16(); IF( tmp_1 != 0 ) @@ -1593,15 +1536,6 @@ static void computeIntensityVector_enc_fx( intensity_real[2][i] = W_extract_h( W_shl( tmp_3, norm ) ); // shift_value - (gb - norm) q_intensity_real[i] = sub( shift_value, sub( gb, norm ) ); move16(); -#else - - intensity_real[0][i] = W_extract_h( tmp_1 ); // output Q= 2* input_q + 1 - 32 - move32(); - intensity_real[1][i] = W_extract_h( tmp_2 ); // output Q= 2* input_q + 1 - 32 - move32(); - intensity_real[2][i] = W_extract_h( tmp_3 ); // output Q= 2* input_q + 1 - 32 - move32(); -#endif } return; diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index b37e61829..a53e40ee6 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -621,11 +621,7 @@ ivas_error front_vad_spar_fx( corr_shift_fx = correlation_shift_fx( hFrontVad->hNoiseEst->totalNoise_fx ); /* Q15 */ -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx_ivas_fx( st, hEncoderConfig->last_ivas_total_brate, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8_fx, Q_inp_12k8 ); -#else - dtx_ivas_fx( st, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8_fx, Q_inp_12k8 ); -#endif /* linear prediction analysis */ alw_pitch_lag_12k8[0] = st->old_pitch_la; /* Q0 */ diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 6aba283be..b06acfbac 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -174,11 +174,7 @@ Word16 ivas_ism_dtx_enc_fx( ( EQ_16( nchan_ism, 2 ) && LE_32( ivas_total_brate, IVAS_48k ) ) || ( EQ_16( nchan_ism, 3 ) && LE_32( ivas_total_brate, IVAS_80k ) ) || ( EQ_16( nchan_ism, 4 ) && LE_32( ivas_total_brate, IVAS_96k ) ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD LT_16( lp_noise_max_fx, ( DTX_THR << 8 ) ) ) ) -#else - LT_16( lp_noise_max_fx, ( 15 << 8 ) ) ) ) -#endif { dtx_flag = 0; move16(); diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index c2f77c159..7f9962098 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -116,12 +116,10 @@ ivas_error ivas_ism_enc_fx( error = IVAS_ERR_OK; move32(); -#ifdef MSAN_FIX FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set16_zero_fx( old_inp_12k8_fx[i][0], L_INP_12k8 ); } -#endif set16_fx( q_re_im_buf, 0, MAX_NUM_OBJECTS ); @@ -247,11 +245,7 @@ ivas_error ivas_ism_enc_fx( error = pre_proc_front_ivas_fx( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8_fx[sce_id][0], old_inp_16k_fx[sce_id][0], &ener_fx[sce_id][0], &relE_fx[sce_id][0], A_fx[sce_id][0], Aw_fx[sce_id][0], epsP_fx[sce_id][0], &epsP_fx_q[sce_id][0], lsp_new_fx[sce_id][0], lsp_mid_fx[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer_fx[sce_id][0], imagBuffer_fx[sce_id][0], &q_re_im_buf[sce_id], old_wsp_fx[sce_id][0], &q_old_wsp, pitch_fr_fx[sce_id][0], voicing_fr_fx[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum_fx[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer_fx[sce_id][0], &enerBuffer_fx_exp[sce_id][0], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff_fx[sce_id][0], &fft_buff_fx_q[sce_id][0], A_fx[sce_id][0], lsp_new_fx[sce_id][0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[sce_id][0] -#else - fft_buff_fx[sce_id][0], &fft_buff_fx_q[sce_id][0], A_fx[sce_id][0], lsp_new_fx[sce_id][0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[sce_id][0] -#endif #ifdef DEBUG_MODE_INFO , st->id_element @@ -286,11 +280,7 @@ ivas_error ivas_ism_enc_fx( test(); IF( st_ivas->hSCE[j] && st_ivas->hSCE[j]->hCoreCoder[0] ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st_ivas->hSCE[j]->hCoreCoder[0]->input_fx, st_ivas->hSCE[j]->hCoreCoder[0]->input32_fx, input_frame, sub( Q11, st_ivas->hSCE[j]->hCoreCoder[0]->q_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( st_ivas->hSCE[j]->hCoreCoder[0]->input_fx, st_ivas->hSCE[j]->hCoreCoder[0]->input32_fx, input_frame, sub( Q11, st_ivas->hSCE[j]->hCoreCoder[0]->q_inp ) ); /* Q11 */ -#endif st_ivas->hSCE[j]->hCoreCoder[0]->q_inp32 = Q11; move16(); } diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index 8e6e0c93f..1efbb2123 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -314,10 +314,8 @@ ivas_error ivas_ism_metadata_enc_fx( } ELSE IF( EQ_16( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ) ) { -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; move16(); -#endif lowrate_metadata_flag[ch] = 1; move16(); hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; @@ -650,10 +648,8 @@ ivas_error ivas_ism_metadata_enc_fx( { hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); move16(); -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = s_min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); move16(); -#endif } ELSE { @@ -821,10 +817,8 @@ ivas_error ivas_ism_metadata_enc_fx( { hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); move16(); -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = s_min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); move16(); -#endif } ELSE { diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index da1f836df..080a62a9d 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -987,11 +987,7 @@ ivas_error ivas_masa_enc_config_fx( /* Setup importance weights for two-direction band selection. */ IF( EQ_16( hMasa->config.numberOfDirections, 2 ) ) { -#ifdef MSAN_FIX set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, MASA_FREQUENCY_BANDS ); -#else - set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, hMasa->config.numCodingBands ); -#endif IF( EQ_16( hMasa->config.numCodingBands, 5 ) ) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 17fefec7e..039bbdf98 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -1010,11 +1010,7 @@ static void ivas_param_mc_param_est_enc_fx( Cx_sum_e[cur_param_band][ref_channel_idx][ref_channel_idx], &ref_ener_e ); } L_tmp = Mpy_32_16_1( ref_ener_fx, hParamMC->hMetadataPMC.ild_factors_fx[k] ); -#ifdef FIX_ISSUE_1154 L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_add( L_tmp, EPSILLON_FX ), &tmp_e ) ); -#else - L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_tmp, &tmp_e ) ); -#endif tmp_e = add( sub( Nrg_e[h_ild_mapping->ild_index[k]], ref_ener_e ), tmp_e ); @@ -1392,11 +1388,7 @@ static void ivas_param_mc_quantize_ilds_fx( ref_ener_fx = BASOP_Util_Add_Mant32Exp( ref_ener_fx, ref_ener_e, Cx_fx[ref_channel_idx][ref_channel_idx], Cx_e[ref_channel_idx][ref_channel_idx], &ref_ener_e ); } ref_ener_fx = Mpy_32_16_1( ref_ener_fx, hParamMC->hMetadataPMC.ild_factors_fx[k] ); -#ifdef FIX_ISSUE_1154 L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_add( ref_ener_fx, EPSILLON_FX ), &tmp_e ) ); -#else - L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], ref_ener_fx, &tmp_e ) ); -#endif tmp_e = add( sub( Nrg_e[h_ild_mapping->ild_index[k]], ref_ener_e ), tmp_e ); /*10 in Q21 = 1342177280*/ ILD_fx[k] = Mpy_32_32( 1342177280, BASOP_Util_Log10( L_tmp, tmp_e ) ); // Q21 diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index fd5cb6217..cad29b146 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -1040,12 +1040,6 @@ static ivas_error ivas_mc_paramupmix_param_est_enc_fx( IF( LT_16( maxbands, IVAS_MAX_NUM_BANDS ) ) { -#ifndef FIX_1133_IMPROVE_MC_MLD - *exp_alphas = 0; - move16(); - *exp_betas = 0; - move16(); -#endif FOR( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) { FOR( bnd = maxbands; bnd < IVAS_MAX_NUM_BANDS; bnd++ ) diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 22f21dceb..0071b67ea 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -940,13 +940,11 @@ void ivas_mcmasa_param_est_enc_fx( Word16 surroundingCoherence_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 numAnalysisChannels; -#ifdef MSAN_FIX FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) { set_zero_fx( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); set_zero_fx( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); } -#endif num_freq_bins = idiv1616( input_frame, MDFT_NO_COL_MAX ); num_freq_bands = hMcMasa->nbands; @@ -1181,10 +1179,8 @@ void ivas_mcmasa_param_est_enc_fx( direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], c_e -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Power and intensity estimation for diffuseness */ diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 71515571d..548a56717 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -270,7 +270,6 @@ void ivas_mct_core_enc_fx( nCPE = add( nCPE, 1 ); } -#ifdef MSAN_FIX FOR( ch = 0; ch < MCT_MAX_CHANNELS; ch++ ) { set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k ); @@ -278,7 +277,6 @@ void ivas_mct_core_enc_fx( move16(); set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX ); } -#endif // MSAN_FIX FOR( ch = 0; ch < nChannels; ch++ ) { set32_fx( inv_spectrum_long_fx[ch], 0, L_FRAME48k ); @@ -334,7 +332,6 @@ void ivas_mct_core_enc_fx( IF( switch_bw ) { -#ifdef FIX_USAN_ISSUES IF( sts[ch_core]->hIGFEnc == NULL ) { initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, @@ -345,10 +342,6 @@ void ivas_mct_core_enc_fx( initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); } -#else - initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, - sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); -#endif } IF( sts[ch_core]->igf ) @@ -653,11 +646,7 @@ void ivas_mct_core_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[ch], sub( Q31, q_powSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hIGFEnc->spec_be_igf_e = sub( 31, q_origSpec ); st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index a8ba9a320..78bf976d1 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -1116,11 +1116,7 @@ void mctStereoIGF_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[p_ch[ch]], sub( Q31, q_powerSpec[p_ch[ch]] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[p_ch[ch]][n], &q_spectrum, &powerSpec_fx[p_ch[ch]][n * L_subframeTCX], &exp_powerSpec[p_ch[ch]][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[p_ch[ch]][n], &q_spectrum, &powerSpec_fx[p_ch[ch]][n * L_subframeTCX], &exp_powerSpec[p_ch[ch]][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); move16(); @@ -1161,11 +1157,7 @@ void mctStereoIGF_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[ch], sub( Q31, q_powerSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); move16(); diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 9f674473e..4b5b3fcbe 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -429,17 +429,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); -#ifdef MSAN_FIX Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 -#else - Scale_sig( &tcxTimeSignal[n - s], shl( s, 1 ), -Q1 ); // Q0 -> Q-1 -#endif wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 -#ifdef MSAN_FIX Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 -#else - Scale_sig( &tcxTimeSignal[n - s], shl( s, 1 ), Q1 ); // Q-1 -> Q0 -#endif Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); @@ -545,11 +537,7 @@ static void kernel_switch_update_transforms_fx( Copy_Scale_sig_32_16( windowedTimeSignal + 2, windowedTimeSignal_16 + 2, add( s, shr( add( leftOverlap, rightOverlap ), 1 ) ), -Q16 ); // *q_windowedTimeSignal - Q16 WindowSignal( hTcxCfg, shr( leftOverlap, 1 ), RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal_16 + 2, &s, tcx5Win, 0, 1 ); // *q_windowedTimeSignal - Q16 Copy_Scale_sig_16_32_no_sat( tcx5Win, tcx5Win_32, add( s, shr( add( leftOverlap, rightOverlap ), 1 ) ), Q16 ); // *q_windowedTimeSignal -#ifdef FIX_ISSUE_1157 q_shift = -Q8; -#else - q_shift = -Q7; -#endif move16(); scale_sig32( tcx5Win_32, add( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), q_shift ); // *q_windowedTimeSignal + q_shift kernel_switch_trafo_fx( tcx5Win_32, sigR, leftOverlap, sub( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), rightOverlap, kernelType ); // *q_windowedTimeSignal + q_shift @@ -579,11 +567,7 @@ static void kernel_switch_update_transforms_fx( ELSE /* tcxTransType != TCX_5 */ { Word16 q_shift, q_com, q_temp; -#ifdef FIX_ISSUE_1157 q_shift = -Q8; -#else - q_shift = -Q7; -#endif move16(); scale_sig32( windowedTimeSignal + 2, add( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), q_shift ); // *q_windowedTimeSignal + q_shift kernel_switch_trafo_fx( windowedTimeSignal + 2, sigR, leftOverlap, sub( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), rightOverlap, kernelType ); // *q_windowedTimeSignal + q_shift @@ -912,13 +896,8 @@ static UWord16 enc_ste_pre_mdct( absMagnR_fx = Sqrt32( L_add( Mpy_32_32( sigR1_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI1_fx[s], sigI1_fx[s] ) ), &absMagnR_e ); corr_fx = L_add( corr_fx, L_add( Mpy_32_32( sigR0_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI0_fx[s], sigI1_fx[s] ) ) ); // q_com*2 - 31 -#ifdef FIX_ISSUE_1092 sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 -#else - sumL_fx = L_add( sumL_fx, L_add( sigR0_fx[s], sigI0_fx[s] ) ); // q_com - sumR_fx = L_add( sumR_fx, L_add( sigR1_fx[s], sigI1_fx[s] ) ); // q_com -#endif sumMagnL_fx = BASOP_Util_Add_Mant32Exp( sumMagnL_fx, sumMagnL_e, absMagnL_fx, absMagnL_e, &sumMagnL_e ); sumMagnR_fx = BASOP_Util_Add_Mant32Exp( sumMagnR_fx, sumMagnR_e, absMagnR_fx, absMagnR_e, &sumMagnR_e ); sumPrdLR_fx = BASOP_Util_Add_Mant32Exp( sumPrdLR_fx, sumPrdLR_e, Mpy_32_32( absMagnL_fx, absMagnR_fx ), add( absMagnL_e, absMagnR_e ), &sumPrdLR_e ); @@ -930,11 +909,7 @@ static UWord16 enc_ste_pre_mdct( temp1 = L_shl( preproLen, x1 ); corr_fx = Mpy_32_32( corr_fx, temp1 ); x1 = sub( 62, add( shl( *q_com, 1 ), x1 ) ); -#ifdef FIX_ISSUE_1092 corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, shl( sub( *q_com, 1 ), 1 ) ), &x1 ); -#else - corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, shl( *q_com, 1 ) ), &x1 ); -#endif IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( corr_fx, x1, -maxSqrValue_fx, 52 ), -1 ) ) { @@ -1181,7 +1156,6 @@ void ivas_mdct_core_whitening_enc_fx( push_wmops( "mdct_core_whitening" ); -#ifdef MSAN_FIX FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { FOR( i = 0; i < NB_DIV; i++ ) @@ -1195,7 +1169,6 @@ void ivas_mdct_core_whitening_enc_fx( set16_fx( orig_spectrum_e[ch], 0, NB_DIV ); } set16_fx( q_windowedSignal, Q31, CPE_CHANNELS ); -#endif q_com = Q31; q_min = 0; move16(); @@ -1235,9 +1208,7 @@ void ivas_mdct_core_whitening_enc_fx( orig_spectrum[ch][1] = orig_spectrum_long[ch] + N_TCX10_MAX; mdst_spectrum_fx[ch][0] = mdst_spectrum_long_fx[ch]; mdst_spectrum_fx[ch][1] = mdst_spectrum_long_fx[ch] + N_TCX10_MAX; -#ifdef MSAN_FIX set32_fx( temp_buffer, 0, 15 * L_FRAME48k / 8 ); -#endif } windowedSignal_fx[0] = orig_spectrum_long[0]; /* NOTE temporarily available */ diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index d31e6d53d..1433c988f 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1050,10 +1050,8 @@ static void ivas_omasa_param_est_enc_fx( move16(); /* Need to initialize renormalization_factors, and variables to be normalized */ -#ifdef MSAN_FIX set_zero_fx( &Foa_RealBuffer_fx[0][0], FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &Foa_ImagBuffer_fx[0][0], FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); -#endif set_zero_fx( renormalization_factor_diff_fx, hOMasa->nbands ); set_zero_fx( diffuseness_m_fx, hOMasa->nbands ); @@ -1202,10 +1200,8 @@ static void ivas_omasa_param_est_enc_fx( intensity_real_e = sub( add( 62, guard_bits ), shl( q, 1 ) ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Power estimation for diffuseness */ diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 0ca93e1a1..dbff29d68 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -77,11 +77,7 @@ static void ivas_merge_sba_transports_fx( { FOR( j = 0; j < input_frame; j++ ) { -#ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS data_out_f[i][j] = L_shr( L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ), Q1 ); -#else - data_out_f[i][j] = L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ); -#endif move32(); } } @@ -479,9 +475,6 @@ static void ivas_osba_render_ism_to_sba_fx( Word16 azimuth_fx, elevation_fx; Word32 gains_fx[MAX_INPUT_CHANNELS]; Word32 g1_fx, g2_fx; -#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS - Word32 output_gain_fx; -#endif Word16 nchan_sba; nchan_sba = imult1616( add( sba_analysis_order, 1 ), add( sba_analysis_order, 1 ) ); @@ -524,21 +517,6 @@ static void ivas_osba_render_ism_to_sba_fx( } *Q_data = sub( *Q_data, 2 ); -#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS - /* Gain with loudness-matching gains */ - // output_gain = 0.7499f; - output_gain_fx = 1610397988; // 0.7499f in Q31 - move32(); - FOR( j = 0; j < nchan_sba; j++ ) - { - FOR( k = 0; k < input_frame; k++ ) - { - // data_out_f[j][k] *= output_gain; - data_out_fx[j][k] = Mpy_32_32( data_out_fx[j][k], output_gain_fx ); - move32(); - } - } -#endif return; } diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 7de54c482..10380f422 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -2500,11 +2500,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( } ELSE { -#ifdef FIX_USAN_ISSUES avg_elevation_index = (UWord16) L_add( avg_elevation_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_elevation_offset ) ); -#else - avg_elevation_index = u_extract_l( UL_addNsD( avg_elevation_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_elevation_offset ) ) ); -#endif } // avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); avg_elevation_index = u_extract_l( UL_addNsD( avg_elevation_index, avg_elevation_alphabet ) % avg_elevation_alphabet ); @@ -2639,13 +2635,8 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( FOR( avg_azimuth_offset = 0; avg_azimuth_offset < q_direction->cfg.search_effort; avg_azimuth_offset++ ) { set_zero_fx( avg_direction_vector, 3 ); -#ifdef FIX_USAN_ISSUES avg_azimuth_index = (UWord16) L_add( avg_azimuth_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_azimuth_offset ) ); avg_azimuth_index = (UWord16) ( L_add( avg_azimuth_index, avg_azimuth_alphabet ) % avg_azimuth_alphabet ); -#else - avg_azimuth_index = (UWord16) add( avg_azimuth_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_azimuth_offset ) ); - avg_azimuth_index = (UWord16) ( add( avg_azimuth_index, avg_azimuth_alphabet ) % avg_azimuth_alphabet ); -#endif all_zero_dist_azimuth_indexes = 1; move16(); azimuth_bits_ec = ivas_qmetadata_encode_quasi_uniform_length_fx( ivas_qmetadata_reorder_generic_fx( sub( avg_azimuth_index, shr( avg_azimuth_alphabet, 1 ) ) ), avg_azimuth_alphabet ); @@ -5452,11 +5443,7 @@ static Word16 encode_surround_coherence_hr_fx( } ELSE { -#ifdef FIX_USAN_ISSUES no_idx16 = add( shr( nbits_fr, 4 ), 1 ); -#else - no_idx16 = shr_r( nbits_fr, 4 ); -#endif } /* write combined index */ @@ -5478,11 +5465,7 @@ static Word16 encode_surround_coherence_hr_fx( } ELSE { -#ifdef FIX_USAN_ISSUES no_idx16 = add( shr( nbits_fr1, 4 ), 1 ); -#else - no_idx16 = shr_r( nbits_fr1, 4 ); -#endif } assert( no_idx16 <= 4 ); diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 3a0f19c50..b2e0e9c69 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -120,9 +120,7 @@ ivas_error ivas_sce_enc_fx( * Initialization - general *-----------------------------------------------------------------*/ -#ifdef MSAN_FIX set16_zero_fx( old_inp_12k8_fx[0], L_INP_12k8 ); -#endif Copy32( data_fx, st->input32_fx, input_frame ); // Q(q_data_fx) q_input = sub( add( L_norm_arr( st->input32_fx, input_frame ), q_data_fx ), 16 ); @@ -253,11 +251,7 @@ ivas_error ivas_sce_enc_fx( &ener_fx[0], &relE_fx[0], A_fx[0], Aw_fx[0], epsP_fx[0], &epsP_fx_q[0], lsp_new_fx[0], lsp_mid_fx[0], &vad_hover_flag[0], &attack_flag[0], realBuffer_fx[0], imagBuffer_fx[0], &q_re_im_buf, old_wsp_fx[0], &q_old_wsp, pitch_fr_fx[0], voicing_fr_fx[0], &loc_harm[0], &cor_map_sum_fx[0], &vad_flag_dtx[0], enerBuffer_fx[0], &enerBuffer_fx_exp[0], fft_buff_fx[0], &fft_buff_fx_q[0], A_fx[0], lsp_new_fx[0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, flag_16k_smc, -#ifdef NONBE_1211_DTX_BR_SWITCHING st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[0] -#else - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[0] -#endif #ifdef DEBUG_MODE_INFO , st->id_element diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 22cd98cad..b7de878a1 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -817,15 +817,10 @@ Word16 quantize_sns_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifdef MSAN_FIX FOR( k = 0; k < nSubframes; k++ ) { scale_sig32( snsQ_out_fx[ch][k], M, sub( sns_e_tmp[ch][k], sns_e ) ); // Q(31-sns_e_tmp[ch][k]) } -#else - scale_sig32( snsQ_out_fx[ch][0], M, sub( sns_e_tmp[ch][0], *sns_e ) ); - scale_sig32( snsQ_out_fx[ch][1], M, sub( sns_e_tmp[ch][1], *sns_e ) ); -#endif } /* get back to L/F representation */ test(); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index ef278d188..4a6543026 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -88,12 +88,8 @@ typedef struct stereo_itd_data_struct Word16 prev_sum_nrg_L_lb_fx_e; Word32 prev_xcorr_lb_fx[STEREO_DFT_XCORR_LB_MAX]; Word16 prev_xcorr_lb_fx_e; -#ifdef FIX_ISSUE_1092 Word32 E_band_n_fx[STEREO_DFT_ITD_VAD_BAND_NUM]; /*E_band_n_exp*/ Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM]; -#else - Word32 E_band_n_fx[STEREO_DFT_ITD_VAD_BAND_NUM]; /*Q0*/ -#endif Word32 xcorr_smooth_fx[STEREO_DFT_N_32k_ENC]; Word16 xcorr_smooth_fx_e[STEREO_DFT_N_32k_ENC]; Word32 lp_phat_peak_fx; /* low-pass GCC PHAT peak value */ // Q31 @@ -1183,11 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 -#else - Word16 isd_rate_s_fx; // Q15 -#endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 @@ -1228,11 +1220,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 -#else - Word32 itd_fx; // Q16 -#endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 3e148a5ae..3e69a0ca6 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -1697,11 +1697,7 @@ static void edge_detect_fx( } } -#ifndef FIX_1297_OVERFLOW - *edge_str = extract_l( L_shr( edge_min, 10 ) ); // Q15 -#else *edge_str = extract_h( L_shl_sat( edge_min, 16 - 10 ) ); // Q15 -#endif move16(); *edge_type = et; // Q0 move16(); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 3eb6c0e82..cebbc2619 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -593,10 +593,8 @@ void stereo_dft_enc_reset_fx( move16(); hStereoDft->dmx_res_all_prev_fx = 1; move32(); -#ifdef MSAN_FIX hStereoDft->dmx_res_all_prev_fx_e = 31; move16(); -#endif hStereoDft->last_res_cod_mode_modify_flag = 0; move16(); hStereoDft->res_cod_sw_flag = 0; @@ -750,9 +748,7 @@ void stereo_enc_itd_init_fx( hItd->prev_xcorr_lb_fx_e = 0; move16(); set32_fx( hItd->E_band_n_fx, ITD_VAD_E_BAND_N_INIT, STEREO_DFT_ITD_VAD_BAND_NUM ); -#ifdef FIX_ISSUE_1092 set16_fx( hItd->E_band_n_exp, Q31, STEREO_DFT_ITD_VAD_BAND_NUM ); -#endif hItd->vad_frm_cnt = 0; move16(); hItd->pre_vad = 0; @@ -1102,11 +1098,7 @@ void stereo_dft_enc_analyze_fx( { FOR( n = 0; n < n_channels; n++ ) { -#ifdef MSAN_FIX Scale_sig( hStereoDft->input_mem_itd_fx[n], dft_ovl, sub( sts[n]->q_inp, hStereoDft->q_input_mem_itd[n] ) ); // Q(sts[n]->q_inp) -#else - Scale_sig( hStereoDft->input_mem_itd_fx[n], STEREO_DFT_OVL_MAX, sts[n]->q_inp - hStereoDft->q_input_mem_itd[n] ); -#endif // MSAN_FIX hStereoDft->q_input_mem_itd[n] = sts[n]->q_inp; move16(); Copy( hStereoDft->input_mem_itd_fx[n], input_mem[n], dft_ovl ); @@ -1657,11 +1649,7 @@ void stereo_dft_enc_process_fx( pDFT_L_fx = hStereoDft->DFT_fx[0]; pDFT_R_fx = hStereoDft->DFT_fx[1]; -#ifdef MSAN_FIX FOR( i = 0; i < hStereoDft->NFFT; i++ ) -#else - FOR( i = 0; i < STEREO_DFT_N_MAX_ENC; i++ ) -#endif // MSAN_FIX { tmp_e = norm_l( hStereoDft->DFT_fx[0][i] ); pDFT_L_fx[i] = L_shl( hStereoDft->DFT_fx[0][i], tmp_e ); diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index af10f7dea..b7429e2e7 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -203,12 +203,8 @@ static void stereo_dft_quantize_itd_fx( *-------------------------------------------------------------------------*/ static Word32 itd_vad_ms_snr_calc_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word32 *Spd, // Q(31-Spd_e) Word16 *Spd_e, Word32 *E_band, // Q(31-E_band_e) @@ -251,11 +247,7 @@ static Word32 itd_vad_ms_snr_calc_fx( // snr[i] = E_band[i] / E_band_n[i]; snr[i] = BASOP_Util_Divide3232_Scale_cadence( E_band[i], E_band_n[i], &snr_e[i] ); move32(); -#ifdef FIX_ISSUE_1092 snr_e[i] = add( snr_e[i], sub( E_band_e[i], E_band_n_exp[i] ) ); -#else - snr_e[i] = add( snr_e[i], sub( E_band_e[i], 31 ) ); -#endif move16(); // if ( snr[i] < 1 ) IF( BASOP_Util_Cmp_Mant32Exp( snr[i], snr_e[i], 1, 31 ) < 0 ) @@ -291,12 +283,8 @@ static Word32 itd_vad_ms_snr_calc_fx( * *-------------------------------------------------------------------------*/ static void itd_vad_background_update_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word16 *vad_frm_cnt, const Word32 ms_snr, // Q(31-ms_snr_e) const Word16 ms_snr_e, @@ -338,19 +326,10 @@ static void itd_vad_background_update_fx( Word16 q_temp = norm_l( *vad_frm_cnt ); L_temp = L_shl( *vad_frm_cnt, q_temp ); L_temp_e = sub( 31, q_temp ); -#ifdef FIX_ISSUE_1092 L_temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( E_band_n[i], L_temp ), add( E_band_n_exp[i], L_temp_e ), E_band[i], E_band_e[i], &L_temp_e ); -#else - L_temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( E_band_n[i], L_temp ), add( 31, L_temp_e ), E_band[i], E_band_e[i], &L_temp_e ); -#endif E_band_n[i] = BASOP_Util_Divide3232_Scale_cadence( L_temp, L_add( *vad_frm_cnt, 1 ), &E_band_n_e_tmp ); move32(); -#ifdef FIX_ISSUE_1092 E_band_n_exp[i] = add( E_band_n_e_tmp, sub( L_temp_e, 31 ) ); -#else - E_band_n_e_tmp = add( E_band_n_e_tmp, sub( L_temp_e, 31 ) ); - E_band_n[i] = L_shr_r( E_band_n[i], sub( 31, E_band_n_e_tmp ) ); // Q31 -#endif move16(); } } @@ -362,7 +341,6 @@ static void itd_vad_background_update_fx( FOR( i = 0; i < STEREO_DFT_ITD_VAD_BAND_NUM; i++ ) { // E_band_n[i] = 0.96f * E_band_n[i] + 0.04f * E_band[i]; -#ifdef FIX_ISSUE_1092 E_band_n[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( 2061584302 /*0.96 in Q31*/, E_band_n[i] ), E_band_n_exp[i], Mpy_32_32( 85899346 /*0.04 in Q31*/, E_band[i] ), E_band_e[i], &E_band_n_e_tmp ); move32(); E_band_n_exp[i] = E_band_n_e_tmp; @@ -375,20 +353,6 @@ static void itd_vad_background_update_fx( E_band_n_exp[i] = 0; move16(); } -#else - E_band_n[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( 2061584302, E_band_n[i] ), 31, Mpy_32_32( 85899346, E_band[i] ), E_band_e[i], &E_band_n_e_tmp ); - move32(); - // if ( E_band_n[i] < 1.0f ) - IF( BASOP_Util_Cmp_Mant32Exp( E_band_n[i], E_band_n_e_tmp, MAX_32, 0 ) < 0 ) - { - E_band_n[i] = MAX_32; - move32(); - E_band_n_e_tmp = 0; - move16(); - } - E_band_n[i] = L_shr_r( E_band_n[i], sub( 31, E_band_n_e_tmp ) ); // Q31 - move32(); -#endif } } } @@ -402,12 +366,8 @@ static void itd_vad_background_update_fx( *-------------------------------------------------------------------------*/ static Word16 stereo_dft_enc_itd_vad_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word16 *vad_frm_cnt, Word32 *Spd_L, // Q(31-Spd_L_e) Word16 *Spd_L_e, @@ -434,17 +394,10 @@ static Word16 stereo_dft_enc_itd_vad_fx( Spd_e[i] = sub( Spd_e[i], 1 ); move16(); } -#ifdef FIX_ISSUE_1092 *mssnr = itd_vad_ms_snr_calc_fx( E_band_n, E_band_n_exp, Spd, Spd_e, E_band, E_band_e, mssnr_e ); move32(); itd_vad_background_update_fx( E_band_n, E_band_n_exp, vad_frm_cnt, *mssnr, *mssnr_e, E_band, E_band_e ); -#else - *mssnr = itd_vad_ms_snr_calc_fx( E_band_n, Spd, Spd_e, E_band, E_band_e, mssnr_e ); - move32(); - - itd_vad_background_update_fx( E_band_n, vad_frm_cnt, *mssnr, *mssnr_e, E_band, E_band_e ); -#endif // if ( *mssnr < ITD_VAD_THRSHOLD ) IF( BASOP_Util_Cmp_Mant32Exp( *mssnr, *mssnr_e, ITD_VAD_THRSHOLD_Q31, 0 ) < 0 ) { @@ -1476,11 +1429,7 @@ void stereo_dft_enc_compute_itd_fx( } // L_temp = sum2_32_fx( &Spd_L[1], 11, &L_temp_e ); sum_nrg_L_lb = BASOP_Util_Add_Mant32Exp( sum_nrg_L_lb, sum_nrg_L_lb_e, L_temp, L_temp_e, &sum_nrg_L_lb_e ); -#ifdef FIX_ISSUE_1092 vad_flag_itd = stereo_dft_enc_itd_vad_fx( hItd->E_band_n_fx, hItd->E_band_n_exp, &( hItd->vad_frm_cnt ), Spd_L, Spd_L_e, Spd_R, Spd_R_e, &mssnr, &mssnr_e ); -#else - vad_flag_itd = stereo_dft_enc_itd_vad_fx( hItd->E_band_n_fx, &( hItd->vad_frm_cnt ), Spd_L, Spd_L_e, Spd_R, Spd_R_e, &mssnr, &mssnr_e ); -#endif vad_flag_itd = vad_flag_itd && vad_flag_dtx[0]; // if ( sum_nrg_L < EPSILON ) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 933270c33..2ed17e25a 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -68,17 +68,11 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 #define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 -#else -#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 -#define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 -#define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 -#endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 @@ -161,11 +155,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ -#else - Word32 itd[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( @@ -208,11 +198,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ -#else - Word32 itd_fx[], /* o : estimated itd */ -#endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio */ ); @@ -621,20 +607,12 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) -#else - IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) -#endif { isd_cnt_h = add( isd_cnt_h, 1 ); } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 -#else - IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) -#endif { isd_cnt_l = add( isd_cnt_l, 1 ); } @@ -643,19 +621,10 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); -#else - hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); - move16(); -#endif -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) -#else - IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) -#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { @@ -680,11 +649,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) -#else - ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) -#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { @@ -752,7 +717,6 @@ static void calc_poc_fx( /* Energy */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) @@ -773,12 +737,6 @@ static void calc_poc_fx( } tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); move32(); -#else - tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); - move32(); - tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); - move32(); -#endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e @@ -809,7 +767,6 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); @@ -831,13 +788,6 @@ static void calc_poc_fx( W_tmp = W_shl( W_tmp, L_tmp_e ); } eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); -#else - Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &Nr_e ); - Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), shl( spec_e, 1 ), &Ni_e ); - - eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); - eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); -#endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); @@ -857,19 +807,9 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); -#else - L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); - L_tmp_e = 1; - move16(); - L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp_e ); - Pn_e = L_tmp_e; - move16(); - Pn = ISqrt32( L_tmp, &Pn_e ); -#endif Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); @@ -1076,17 +1016,7 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA - hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 -#else - -#ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 -#else - hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 -#endif - -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } @@ -1094,39 +1024,16 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); -#ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA -#ifdef FIX_ISSUE_1153 - Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); - IF( shift ) - { - scale_sig32( hPHA->p_curr_taps_fx[n], hPHA->pha_len, 1 ); - shift = 1; - move16(); - } -#endif -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA - energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); -#else -#ifdef FIX_ISSUE_1153 - energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); -#else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); -#endif -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 -#else - hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 -#endif move32(); } } @@ -1229,11 +1136,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ -#else - Word32 itd_fx[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) @@ -1545,11 +1448,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ -#else - Word32 itd[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame /* i : input frame length per channel */ ) { @@ -2090,9 +1989,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 -#endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); move32(); } @@ -2117,9 +2014,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 -#endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); @@ -2149,11 +2044,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) -#else - IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) -#endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { @@ -2276,15 +2167,9 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; -#else - Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; - Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; - Word16 *win, tmp_r; -#endif const Word16 *p_ipd_w; Word16 tmp_e; @@ -2516,7 +2401,6 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); @@ -2532,21 +2416,6 @@ ivas_error stereo_dmx_evs_init_encoder_fx( hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ move16(); } -#else - trans_len = idiv1616( pha_len, 20 ); - set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); - hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; - move16(); - // tmp_r = 1.0f / ( ( trans_len * 2 ) + 1 ); - tmp_r = div_s( 1, add( shl( trans_len, 1 ), 1 ) ); - win = &( hStereoDmxEVS->hPHA->win_fx[pha_len - trans_len] ); - FOR( n = 0; n < trans_len; n++ ) - { - // win[n] = ( 0.5f * ( 1.0f + cosf( ( PI2 * ( n + 1 ) ) * tmp_r ) ) ) * 1.8f; - win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); - move16(); - } -#endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 057798706..8410f7546 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1094,11 +1094,7 @@ static void corrStatsEst_fx( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], 429496730 /* 0.2 in Q31*/ ), hStereoTCA->delay_0_mem_exp, L_mult0( 26214 /* 0.8 in Q15*/, corrLagStats[0] ), Q16, &temp ); /* Q31-temp */ move32(); -#ifdef FIX_USAN_ISSUES Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, L_negate( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ -#else - Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, -hStereoTCA->delay_0_mem_fx[0], hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ -#endif inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 { @@ -1968,22 +1964,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ -#ifndef FIX_1300_ICA_SHIFT_QUANT_IMPROV - IF( temp_exp < 0 ) - { - scalar_value = shl( scalar_value, sub( temp_exp, Q3 ) ); // Q12 - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, ONE_IN_Q11, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ - move16(); - } - ELSE - { - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, shl( 1, sub( 14, temp_exp ) ), ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ - move16(); - } -#else scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ -#endif tempF_fx = tempF_16fx; move32(); @@ -2263,7 +2245,6 @@ static void unclr_calc_corr_features_fx( side_i = BASOP_Util_Add_Mant32Exp( L_shr( buf1[i], 1 ), sub( 31, q_com ), L_negate( L_shr( buf2[i], 1 ) ), sub( 31, q_com ), &exp ); /* Q31-exp */ ener_side = BASOP_Util_Add_Mant32Exp( ener_side, ener_side_exp, Mpy_32_32( side_i, side_i ), shl( exp, 1 ), &ener_side_exp ); /* Q31-ener_side_exp */ -#ifdef FIX_ISSUE_1125 Word16 n1, n2, prod_i_exp; Word32 x, y, prod_i; n1 = norm_l( buf1[i] ); @@ -2273,9 +2254,6 @@ static void unclr_calc_corr_features_fx( prod_i = Mpy_32_32( x, y ); // q: q_com * 2 + n1 + n2 - 31 prod_i_exp = sub( 62, add( shl( q_com, 1 ), add( n1, n2 ) ) ); sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, prod_i, prod_i_exp, &sum_prod_exp ); /* Q31-sum_prod_exp */ -#else - sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, Mpy_32_32( buf1[i], buf2[i] ), sub( 62, shl( q_com, 1 ) ), &sum_prod_exp ); /* Q31-sum_prod_exp */ -#endif } /* average energy of L and R channels */ diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index ad038f0fa..25e2366dd 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -809,11 +809,7 @@ void stereo_icBWE_enc_ivas_fx( Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e set32_fx( shb_frame_ref_fx, 0, L_LOOK_16k + L_FRAME16k ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_ref_fx, shb_frame_ref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#else - Copy_Scale_sig_16_32_DEPREC( hStereoICBWE->mem_shb_speech_ref_fx, shb_frame_ref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#endif hStereoICBWE->mem_shb_speech_ref_e = max_e; shb_frame_ref_e = max_e; move16(); @@ -827,11 +823,7 @@ void stereo_icBWE_enc_ivas_fx( max_e = s_max( hStereoICBWE->mem_shb_speech_nonref_e, shb_speech_nonref_e ); Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#else - Copy_Scale_sig_16_32_DEPREC( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#endif hStereoICBWE->mem_shb_speech_nonref_e = max_e; shb_frame_nonref_e = max_e; move16(); @@ -1233,9 +1225,7 @@ void stereo_icBWE_preproc_fx( Word32 gD_fx; Word32 input_Fs; -#ifdef MSAN_FIX set16_fx( temp_inp_fx, 0, L_FRAME48k ); -#endif /* initialization */ hStereoTCA = hCPE->hStereoTCA; /* Stereo TCA encoder handle */ diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index b68578542..4255980ad 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -178,10 +178,8 @@ void stereo_mdct_core_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifdef MSAN_FIX set32_fx( mdst_spectrum_long_fx[ch], 0, N_MAX ); set32_fx( orig_spectrum_long_fx[ch], 0, N_MAX ); -#endif p_mdst_spectrum_long_fx[ch] = mdst_spectrum_long_fx[ch]; p_orig_spectrum_long_fx[ch] = orig_spectrum_long_fx[ch]; orig_spectrum_fx[ch][0] = orig_spectrum_long_fx[ch]; @@ -674,11 +672,7 @@ void stereo_mdct_core_enc_fx( q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] ); Scale_sig32( orig_spectrum_fx[ch][n], st->hIGFEnc->infoStopLine, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */ -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#else ProcessIGF_ivas_fx( st, N_MAX, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#endif } } } @@ -719,11 +713,7 @@ void stereo_mdct_core_enc_fx( Scale_sig32( orig_spectrum_fx[ch][n], st->hIGFEnc->infoStopLine, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */ -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#else ProcessIGF_ivas_fx( st, N_MAX, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#endif } } } diff --git a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c index 851df60d5..6c3588cab 100644 --- a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c @@ -166,12 +166,10 @@ static void IGF_MsStereoDecision_fx( Word16 pc_target_e, pc_src_e; Word16 tmp1, tmp1_e, tmp2, tmp2_e; -#ifdef MSAN_FIX pc_target_e = 0; pc_src_e = 0; move16(); move16(); -#endif // MSAN_FIX Word16 coh_src = calcCoh_fx( &specL_fx[strt_cpy], &specR_fx[strt_cpy], q_spec, width, &cc_src_fx, &cc_src_e, &pc_src_fx, &pc_src_e ); Word16 coh_target = calcCoh_fx( &specL_fx[hGrid->swb_offset[sfb]], &specR_fx[hGrid->swb_offset[sfb]], q_spec, width, &cc_target_fx, &cc_target_e, &pc_target_fx, &pc_target_e ); diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 0a526561a..5f1208ba7 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -239,16 +239,12 @@ ivas_error stereo_memory_enc_fx( test(); IF( hCPE->hStereoTCA != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { -#ifdef FIX_1132_STACK_CORRUPTION Word16 tmp = extract_h( L_abs( hCPE->hStereoDft->hItd->itd_fx[1] ) ); if ( hCPE->hStereoDft->hItd->itd_fx[1] < 0 ) { tmp = negate( tmp ); } set16_fx( hCPE->hStereoTCA->prevCorrLagStats, tmp, 3 ); -#else - set16_fx( hCPE->hStereoTCA->prevCorrLagStats, extract_h( hCPE->hStereoDft->hItd->itd_fx[1] ), 3 ); -#endif IF( hCPE->hStereoDft->hItd->itd_fx[1] >= 0 ) { hCPE->hStereoTCA->prevRefChanIndx = L_CH_INDX; @@ -448,10 +444,8 @@ ivas_error stereo_memory_enc_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } /* allocate stereo CNG structure */ @@ -679,10 +673,8 @@ void stereo_switching_enc_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { Copy( sts[n]->input_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl ); /* sts[n]->q_inp */ -#ifdef FIX_ISSUE_1327 hCPE->q_input_mem[n] = sts[n]->q_inp; move16(); -#endif } } diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 44c08efa8..f9b6b0bf3 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -72,13 +72,8 @@ #define RATIO_MAX 1.5f /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ -#ifdef FIX_1301_CORRECT_TD_CNST #define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#else -#define RATIO_MAX_FX_Q24 ( 2516582 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q23 ( 1258291 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#endif #define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ #define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ #define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ @@ -260,11 +255,7 @@ Word16 stereo_tdm_ener_analysis_fx( rms_thd_fx = L_shr( rms_thd_fx, 2 ); /*Q16*/ /*rms_thd_fx *= 0.25f*/ test(); test(); -#ifdef FIX_1301_CORRECT_TD_CNST IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 4915200 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) -#else - IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 75 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) -#endif { rms_thd_fx = L_shr( rms_thd_fx, 5 ); /* Q16*/ /*rms_thd_fx *= 0.03125f*/ } @@ -338,10 +329,8 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } -#ifdef FIX_1301_CORRECT_TD_CNST rms_L_fx = L_shl( rms_L_fx, sub( Q16, q_rms_L ) ); /* All the following energy comparison are done in Q16 */ rms_R_fx = L_shl( rms_R_fx, sub( Q16, q_rms_R ) ); -#endif test(); IF( EQ_16( hStereoTD->prev_fr_LRTD_TD_dec, 1 ) && side_can_change == 0 ) { @@ -440,11 +429,7 @@ Word16 stereo_tdm_ener_analysis_fx( ELSE { /*ratio_L = ( 1.0f - cosf( EVS_PI * ratio_L / 2.0f ) ) / 2.0f;*/ -#ifdef FIX_1301_CORRECT_TD_CNST ratio_L_fx = L_deposit_h( sub_sat( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) -#else - ratio_L_fx = L_deposit_h( sub( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) -#endif } test(); @@ -650,22 +635,14 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } -#ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 -#else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 -#endif move32(); test(); IF( EQ_16( hStereoTD->tdm_SM_modi_flag, 1 ) && hStereoTD->tdm_LRTD_flag == 0 ) { idx = shr( add( hStereoTD->tdm_last_ratio_idx, add( LRTD_STEREO_MID_IS_PRIM, 1 ) ), 1 ); -#ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 -#else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 -#endif move32(); } @@ -756,10 +733,8 @@ Word16 stereo_tdm_ener_analysis_fx( hCPE->hStereoClassif->ratio_L_fx = ratio_L_fx; /* 31 - ratio_L_e */ move32(); -#ifdef FIX_ISSUE_1125 hCPE->hStereoClassif->ratio_L_e = 1; move16(); -#endif return idx; } @@ -1073,11 +1048,7 @@ static void NOOP_decision_fx( } ELSE { -#ifdef FIX_1301_CORRECT_TD_CNST if ( LT_32( sts[0]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) ) -#else - if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) -#endif { tdm_NOOP_switch_flag = 1; move16(); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 378068827..8f1d2d9c9 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -336,10 +336,8 @@ ivas_error stereo_set_tdm_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } } diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index eabfe87b4..159012ac2 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -789,7 +789,6 @@ Word16 ivas_acelp_tcx20_switching_fx( L_frame = L_FRAME; move16(); } -#ifdef MSAN_FIX set16_fx( window_fx, 0, L_LOOK_16k ); set16_fx( xn_buf_fx, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); FOR( i = 0; i < L_LOOK_16k; i++ ) @@ -799,7 +798,6 @@ Word16 ivas_acelp_tcx20_switching_fx( window_p_fx[i].v.im = 0; move16(); } -#endif L_frame_tmp = L_frame; move16(); @@ -854,7 +852,6 @@ Word16 ivas_acelp_tcx20_switching_fx( overlap = st->hTcxCfg->tcx_mdct_window_delay; move16(); -#ifdef MSAN_FIX FOR( i = 0; i < st->hTcxCfg->tcx_mdct_window_length / 2; i++ ) { window_fx[st->hTcxCfg->tcx_mdct_window_length - 1 - i] = st->hTcxCfg->tcx_mdct_window[i].v.re; // Q15 @@ -862,15 +859,6 @@ Word16 ivas_acelp_tcx20_switching_fx( window_fx[i] = st->hTcxCfg->tcx_mdct_window[i].v.im; // Q15 move16(); } -#else - FOR( i = 0; i < L_LOOK_16k / 2; i++ ) - { - window_fx[L_LOOK_16k / 2 - 1 - i] = st->hTcxCfg->tcx_mdct_window[i].v.re; // Q15 - move16(); - window_fx[i] = st->hTcxCfg->tcx_mdct_window[i].v.im; // Q15 - move16(); - } -#endif } ELSE { @@ -1047,12 +1035,8 @@ Word16 ivas_acelp_tcx20_switching_fx( IF( LE_32( offset, 0xAA153 ) ) /* 0xAA153 -> 32.f * log2(10)/10 */ { -#ifdef FIX_USAN_ISSUES offset = (Word32) 0xFFD57AB5; /* 0xFFD57AB5 -> -128.f * log2(10)/10; */ move32(); -#else - offset = L_add( 0xFFD57AB5, 0 ); /* 0xFFD57AB5 -> -128.f * log2(10)/10; */ -#endif } offset_tcx = offset; move32(); @@ -1155,11 +1139,7 @@ Word16 ivas_acelp_tcx20_switching_fx( { *pt_ener_sfr = -668739840; /* 0xFFEC1185 -> log2(1e-6) in 6Q25 */ move32(); -#ifdef FIX_USAN_ISSUES tmp32 = (Word32) 0xFFEC1185; /* 0xFFEC1185 -> log2(1e-6) in 15Q16 */ -#else - tmp32 = 0xFFEC1185; /* 0xFFEC1185 -> log2(1e-6) in 15Q16 */ -#endif move32(); } ELSE diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index c959ef758..63cbb30e9 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -221,13 +221,9 @@ void encod_gen_2sbfr( LPD_state_HANDLE hLPDmem = st->hLPDmem; -#ifdef FIX_1320_LOWRATE_ACELP Word16 gcode16; Word32 Lgcode, Ltmp; -#endif -#ifdef MSAN_FIX set16_fx( cn, 0, 2 * L_SUBFR ); /* Target vector in residual domain */ -#endif /*------------------------------------------------------------------* * Initializations @@ -268,11 +264,7 @@ void encod_gen_2sbfr( Copy( &res[i_subfr], &exc[i_subfr], 2 * L_SUBFR ); // Q_new -#ifndef FIX_1320_LOWRATE_ACELP - find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); -#else find_targets_ivas_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); -#endif q_h1 = sub( 14, norm_s( h1[0] ) ); Copy_Scale_sig( h1, h2, 2 * L_SUBFR, sub( 11, q_h1 ) ); @@ -298,21 +290,13 @@ void encod_gen_2sbfr( * Gain clipping test to avoid unstable synthesis on frame erasure *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, Q_new ); // Q0 -#else clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0 -#endif /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ -#ifndef FIX_1320_LOWRATE_ACELP - lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#else lp_filt_exc_enc_ivas_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#endif /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 move16(); @@ -345,22 +329,15 @@ void encod_gen_2sbfr( gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); -#ifndef FIX_1320_LOWRATE_ACELP - hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); -#else Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); /*Q0*/ hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); /* Q15 */ -#endif move16(); /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - hLPDmem->mem_w0 = sub( sub( xn[2 * L_SUBFR - 1], mult_r( gain_pit, y1[2 * L_SUBFR - 1] ) ), mult_r( extract_h( gain_code ), y2[2 * L_SUBFR - 1] ) ); -#else Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ Ltmp = L_negate( Ltmp ); @@ -368,7 +345,6 @@ void encod_gen_2sbfr( Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ -#endif move16(); /*-----------------------------------------------------------------* @@ -376,15 +352,6 @@ void encod_gen_2sbfr( * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - FOR( i = 0; i < 2 * L_SUBFR; i++ ) - { - exc2[i + i_subfr] = mult( gain_pit, exc[i + i_subfr] ); - move16(); - exc[i + i_subfr] = add( exc2[i + i_subfr], mult( extract_h( gain_code ), code[i] ) ); - move16(); - } -#else FOR( i = 0; i < 2 * L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ @@ -397,7 +364,6 @@ void encod_gen_2sbfr( move16(); move16(); } -#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ @@ -411,11 +377,7 @@ void encod_gen_2sbfr( * Synthesize speech to update mem_syn_flt[]. * Update A(z) filters *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - E_UTIL_synthesis( 0, p_Aq, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1, M ); -#else Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1 ); -#endif p_Aw += 2 * ( M + 1 ); p_Aq += 2 * ( M + 1 ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 09e3efc84..877fc2045 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1166,11 +1166,7 @@ static ivas_error configureEncoder( test(); test(); test(); -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH IF( hEncoderConfig->Opt_PCA_ON && !( ( EQ_16( hEncoderConfig->ivas_format, SBA_FORMAT ) || EQ_16( hEncoderConfig->ivas_format, SBA_ISM_FORMAT ) ) && EQ_32( hEncoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( hEncoderConfig->sba_order, SBA_FOA_ORDER ) ) ) -#else - if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) -#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "PCA supported at SBA FOA 256 kbps only." ); } diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 0851e4c17..e59ef07d9 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -923,9 +923,7 @@ void noise_est_fx( NOISE_EST_HANDLE hNoiseEst; SP_MUS_CLAS_HANDLE hSpMusClas; hSpMusClas = st_fx->hSpMusClas; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( ncharX ); -#endif /* Check if LR-VAD */ { diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index bcf7d33bb..b19fb7e56 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -80,9 +80,7 @@ Word16 pit_encode_fx( /* o : Fractional pitc Word16 pit_flag, delta, mult_Top, nBits; Word16 L_sufr_sft; Word16 T_op[2]; /* values for two half-frames */ -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) tdm_Pitch_reuse_flag; -#endif L_sufr_sft = 6; move16(); diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 6844945c0..efecb33ed 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -1104,11 +1104,7 @@ void pre_proc_fx( test(); test(); test(); -#ifndef CR_2109_to_2112_cd0_ce0 - IF( ( ( ( st->tcxonly == 0 ) || !( st->core_brate != FRAME_NO_DATA || NE_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE2 ) ) || ( EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE1 ) ) ) -#else IF( ( ( ( st->tcxonly == 0 ) || !( st->core_brate != FRAME_NO_DATA && NE_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE2 ) ) || ( EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE1 ) ) ) -#endif { /* update signal buffers */ Copy( new_inp_resamp16k, st->buf_speech_enc + L_FRAME16k, L_FRAME16k ); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 042b5af90..f80373787 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -178,9 +178,7 @@ void dtx_fx( void dtx_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ const Word16 vad, /* i : vad flag for DTX Q0*/ const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ @@ -1235,9 +1233,7 @@ void AVQ_cod_lpc_fx( void ProcessIGF_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ -#endif Word32 *pMDCTSpectrum, /* i : MDCT spectrum */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -1553,9 +1549,7 @@ void Mode2_pit_encode_fx( Word16 pit_res_max ); void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -#ifdef FIX_ISSUE_1165 void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -#endif void E_ACELP_4t_fx( Word16 dn[], /* Qdn */ @@ -3074,9 +3068,7 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | ); void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ -#endif const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/spec_flatness_fx.c b/lib_enc/spec_flatness_fx.c index c2451886d..d7bd9a6e9 100644 --- a/lib_enc/spec_flatness_fx.c +++ b/lib_enc/spec_flatness_fx.c @@ -221,11 +221,7 @@ void spec_flatness_fx( SFM_Qtmp = sub( SFM_Qtmp, SPEC_AMP_Q ); SFM_Qtmp = sub( SFM_Qtmp, SFM_Q ); -#ifdef FIX_ISSUE_1209 sSFM[1] = add_sat( mult( sSFM[1], 0x6ccc ), shr( mult( SFM, 0x1333 ), SFM_Qtmp ) ); -#else - sSFM[1] = add( mult( sSFM[1], 0x6ccc ), shr( mult( SFM, 0x1333 ), SFM_Qtmp ) ); -#endif move16(); /*sSFM3*/ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index e04f5172b..ff9e2d936 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -890,20 +890,12 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis tmp = div_s( tmp2, tmp1 ); /*Q(15+exp3) */ L_tmp = L_shl( tmp, sub( 1, exp3 ) ); /*Q16 */ -#ifdef FIX_ISSUE_1151 ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ -#else - ps_sta = L_add( ps_sta, L_tmp ); /*Q16 */ -#endif } } /**pFV++ = (float)log(ps_sta + 1e-5f);*/ -#ifdef FIX_ISSUE_1151 ps_sta = L_add_sat( ps_sta, 336 ); -#else - ps_sta = L_add( ps_sta, 336 ); -#endif e_tmp = norm_l( ps_sta ); f_tmp = Log2_norm_lc( L_shl( ps_sta, e_tmp ) ); e_tmp = sub( 30 - 16, e_tmp ); @@ -1617,16 +1609,8 @@ Word16 ivas_smc_gmm_fx( Word16 flag_odv; Word32 lps_fx, lpm_fx, lpn_fx; Word32 ps_fx[N_SMC_MIXTURES], pm_fx[N_SMC_MIXTURES], pn_fx[N_SMC_MIXTURES]; -#ifndef DOT_PROD_CHOLESKY_64BIT - Word32 lprob_fx; - Word16 lprob_exp = 0; -#else Word64 wprob_fx; -#endif Word32 fvm_fx[N_PCA_COEF]; -#ifndef DOT_PROD_CHOLESKY_64BIT - Word16 fvm_exp = 0; -#endif Word32 sum_PS_fx, ps_diff_fx, ps_sta_fx; Word32 dlp_fx, wrelE_fx, wdrop_fx, wght_fx; Word32 wrise_fx; @@ -2213,38 +2197,16 @@ Word16 ivas_smc_gmm_fx( FOR( m = 0; m < N_SMC_MIXTURES; m++ ) { v_sub32_fx( FV_fx, &means_speech_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - fvm_exp = sub( 31, Qfact_FV ); - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); v_sub32_fx( FV_fx, &means_music_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); v_sub32_fx( FV_fx, &means_noise_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); } @@ -2258,21 +2220,12 @@ Word16 ivas_smc_gmm_fx( *high_lpn_flag = 1; move32(); } -#ifndef FIX_1297_OVERFLOW - hSpMusClas->lpm_fx = extract_l( L_shr( lpm_fx, 11 ) ); // Q7 - move16(); - hSpMusClas->lps_fx = extract_l( L_shr( lps_fx, 11 ) ); // Q7 - move16(); - hSpMusClas->lpn_fx = extract_l( L_shr( lpn_fx, 11 ) ); // Q7 - move16(); -#else hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lps_fx = extract_h( L_shl_sat( lps_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lpn_fx = extract_h( L_shl_sat( lpn_fx, 16 - 11 ) ); // Q7 move16(); -#endif /* determine HQ Generic speech class */ IF( st->hHQ_core != NULL ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 7ca996af5..64ab13ea2 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -701,9 +701,6 @@ typedef struct sp_mus_clas_structure typedef struct lpd_state_structure { -#ifndef MSAN_FIX - Word16 nbits; /* number of bits used by ACELP or TCX */ -#endif /* signal memory */ Word16 syn[1 + M]; /* Synthesis memory (non-pe) */ @@ -1012,9 +1009,7 @@ typedef struct td_bwe_enc_structure typedef struct fd_bwe_enc_structure { Word16 new_input_hp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS )]; // Q_new_input_hp -#ifdef FIX_ISSUE_1230 Word16 Q_new_input_hp; -#endif Word16 old_input_fx[NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS )]; // q0 Word16 old_input_wb_fx[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )]; /* Q(-1) */ Word16 old_input_lp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS )]; // st->hBWE_FD->prev_Q_input_lp diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index e0d846458..26c8382ca 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -307,9 +307,7 @@ void swb_bwe_enc_ivas_fx( move32(); #endif Word16 fb_band_begin; -#ifdef FIX_ISSUE_1230 Word16 q_new_input_hp; -#endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -385,7 +383,6 @@ void swb_bwe_enc_ivas_fx( Copy( old_input_16k_fx + L_INP_MEM + L_FRAME16k - Sample_Delay_LP, hBWE_FD->old_input_lp_fx, Sample_Delay_LP ); } -#ifdef FIX_ISSUE_1230 q_new_input_hp = s_min( Q_shb_speech, hBWE_FD->Q_new_input_hp ); IF( LT_16( Q_shb_speech, hBWE_FD->Q_new_input_hp ) ) { @@ -400,10 +397,6 @@ void swb_bwe_enc_ivas_fx( hBWE_FD->Q_new_input_hp = Q_shb_speech; move16(); -#else - Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP ); - Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP ); -#endif Copy( shb_speech_fx + L_FRAME16k - Sample_Delay_HP, hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); new_input_fx = old_input_fx + Sample_Delay_SWB_BWE; Copy( hBWE_FD->old_input_fx, old_input_fx, Sample_Delay_SWB_BWE ); @@ -513,11 +506,7 @@ void swb_bwe_enc_ivas_fx( { Q_shb = sub( Q_synth_hf, 4 ); } -#ifdef FIX_ISSUE_1230 Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, q_new_input_hp ) ); -#else - Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, Q_shb_speech ) ); -#endif /* FB BWE encoding */ IF( EQ_16( st_fx->extl, FB_BWE ) ) @@ -3229,11 +3218,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); -#ifdef FIX_ISSUE_1156 den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); -#else - den = round_fx( L_shl( WB_tenv_syn_fx, expd ) ); -#endif expd = sub( sub( 30, expd ), sub( shl( Q_insig_lp, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); @@ -4145,17 +4130,11 @@ void fd_bwe_enc_init_fx( ) { set16_fx( hBWE_FD->new_input_hp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ) ); -#ifdef FIX_ISSUE_1230 hBWE_FD->Q_new_input_hp = 0; move16(); -#endif set16_fx( hBWE_FD->old_input_fx, 0, NS2SA( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) ); set16_fx( hBWE_FD->old_input_wb_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ) ); -#ifndef MSAN_FIX - set16_fx( hBWE_FD->old_input_lp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_SWB_TBE_16k_NS ) ); -#else set16_fx( hBWE_FD->old_input_lp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ) ); -#endif set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); hBWE_FD->prev_mode = NORMAL; move16(); diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index b73b0f992..c49c32e03 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1263,11 +1263,7 @@ void swb_pre_proc_ivas_fx( thr = icbwe_thr_TDM_fx; regV = icbwe_regressionValuesTDM_fx; -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, 0, st->cldfbSynTd ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, st->cldfbSynTd ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); *Q_shb_spch = 0; move16(); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 9b4f15dc5..2b8f487bd 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -1391,11 +1391,7 @@ void wb_tbe_enc_ivas_fx( move32(); } -#ifdef FIX_ISSUE_1165 lpc2lsp_ivas_fx( &lpc_wb_32_fx[1], lsp_wb_temp_fx, st_fx->prev_lsp_wb_temp_fx, LPC_SHB_ORDER_WB ); -#else - lpc2lsp_fx( &lpc_wb_32_fx[1], lsp_wb_temp_fx, st_fx->prev_lsp_wb_temp_fx, LPC_SHB_ORDER_WB ); -#endif FOR( i = 0; i < LPC_SHB_ORDER_WB; i++ ) { diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 19afa8243..25a3bdee7 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -536,11 +536,7 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ -#ifdef FIX_ISSUE_1150 g = shr( sub_o( g, 0x1000, &Overflow ), 13 ); -#else - g = shr( sub( g, 0x1000 ), 13 ); -#endif g = s_max( g, -1 ); *gain_index = g; diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index ce7f0e6a6..c84843384 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3785,9 +3785,7 @@ void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) *---------------------------------------------------------------------*/ void ProcessIGF_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ -#endif Word32 *pMDCTSpectrum, /* i : MDCT spectrum (*q_spectrum) */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -3834,11 +3832,7 @@ void ProcessIGF_ivas_fx( IGFSaveSpectrumForITF_ivas_fx( hIGFEnc, igfGridIdx, pITFMDCTSpectrum, sub( Q31, *q_spectrum ) ); -#ifndef MSAN_FIX - IGFEncApplyMono_ivas_fx( st, igfGridIdx, pMDCTSpectrum, sub( Q31, *q_spectrum ), pPowerSpectrum, exp_powerSpec, isTCX20, st->hTcxEnc->fUseTns[frameno], sp_aud_decision0, vad_hover_flag ); -#else IGFEncApplyMono_ivas_fx( st, powerSpec_len, igfGridIdx, pMDCTSpectrum, sub( Q31, *q_spectrum ), pPowerSpectrum, exp_powerSpec, isTCX20, st->hTcxEnc->fUseTns[frameno], sp_aud_decision0, vad_hover_flag ); -#endif curr_order = 0; move16(); diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index cf6e5dd64..05b35813a 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -229,11 +229,7 @@ Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, assert( n < (Word16) ( sizeof( tmpbuf ) / sizeof( Word16 ) ) ); FOR( i = 0; i < n; i++ ) { -#ifdef FIX_ISSUE_1147 tmpbuf[i] = round_fx_sat( L_shl( pSpectrum[iStartLine + i], shift ) ); -#else - tmpbuf[i] = round_fx( L_shl( pSpectrum[iStartLine + i], shift ) ); -#endif move16(); } diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 44bd8cc3c..92f01b5dd 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -678,18 +678,13 @@ void RunTransientDetection_ivas_fx( IF( GT_16( sub( q_input, pSubblockEnergies->q_firState ), shift ) ) { Scale_sig( input_fx, length, add( sub( pSubblockEnergies->q_firState, q_input ), shift ) ); // q_firState + shift -#ifdef FIX_ISSUE_1186 q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift -#endif pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift move16(); pSubblockEnergies->firState2 = shl( pSubblockEnergies->firState2, shift ); // q_firState + shift move16(); pSubblockEnergies->q_firState = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift move16(); -#ifndef FIX_ISSUE_1186 - q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift -#endif } ELSE { @@ -715,11 +710,7 @@ void RunTransientDetection_ivas_fx( } /* Update subblock energies. */ -#ifdef MSAN_FIX Scale_sig( filteredInput_fx, length, sub( 0, q_input ) ); // q0 -#else - Scale_sig( filteredInput_fx, L_FRAME_MAX, 8 ); -#endif UpdateSubblockEnergies_ivas_fx( filteredInput_fx, length, pSubblockEnergies ); /* Run transient detectors. */ diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 9911d766a..7fe813d12 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -213,11 +213,7 @@ void transition_enc_fx( { /* this is called only to compute unused bits */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, -#else - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, -#endif st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } @@ -329,11 +325,7 @@ void transition_enc_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, -#else - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, -#endif unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* @@ -1042,11 +1034,7 @@ void transition_enc_ivas_fx( { /* this is called only to compute unused bits */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, -#else - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, -#endif st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } @@ -1158,11 +1146,7 @@ void transition_enc_ivas_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, -#else - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, -#endif unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index be86281ef..fb3a89350 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -72,10 +72,8 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #define INV_TAN30_FX 28377 // Q14 #define EPSILON_MANT 1180591621 /* 1e-12 = 0.5497558*(2^-39) in Q70 */ #define EPSILON_EXP ( -39 ) -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC #define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ #define ONE_DIV_EPSILON_EXP ( 40 ) -#endif #define ADAPT_HTPROTO_ROT_LIM_1 0.8f #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ @@ -135,10 +133,8 @@ static void matrixTransp2Mul_fx( Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx Word32 Ascale, Word32 Bscale, -#endif Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); @@ -813,12 +809,9 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( hDiracDecBin->useTdDecorr ) { -#ifdef FIX_ISSUE_1185 Word32 tmp_arr[60]; -#endif FOR( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { -#ifdef FIX_ISSUE_1185 q_cldfb[ch][slot] = sub( q_input, 1 ); move16(); @@ -836,15 +829,6 @@ static void ivas_dirac_dec_binaural_internal_fx( scale_sig32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, sub( st_ivas->cldfbAnaDec[ch]->p_filter_length, st_ivas->cldfbAnaDec[ch]->no_channels ), sub( q_input, st_ivas->cldfbAnaDec[ch]->Q_cldfb_state ) ); st_ivas->cldfbAnaDec[ch]->Q_cldfb_state = q_input; move16(); -#else - q_cldfb[ch][slot] = q_input; - move16(); - cldfbAnalysis_ts_fx_fixed_q( - &( st_ivas->hTcBuffer->tc_fx[ch][nBins * slot + offsetSamples] ), - Cldfb_RealBuffer_in_fx[ch][slot], - Cldfb_ImagBuffer_in_fx[ch][slot], - nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); -#endif /*FIX_ISSUE_1185*/ test(); test(); @@ -886,10 +870,8 @@ static void ivas_dirac_dec_binaural_internal_fx( { scale_sig32( Cldfb_RealBuffer_in_fx[cha][slot], 60, sub( q_inp, q_cldfb[cha][slot] ) ); // Q6 scale_sig32( Cldfb_ImagBuffer_in_fx[cha][slot], 60, sub( q_inp, q_cldfb[cha][slot] ) ); // Q6 -#ifdef FIX_ISSUE_1185 q_cldfb[cha][slot] = 6; move16(); -#endif } } @@ -1983,10 +1965,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( matrixMul_fx( Mre_fx, Mim_fx, &q_M, CxRe_fx, CxIm_fx, &q_Cx, tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp ); matrixTransp2Mul_fx( tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp, Mre_fx, Mim_fx, &q_M, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); /* When below the frequency limit where decorrelation is applied, we inject the decorrelated @@ -2151,23 +2131,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT { tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp2 ); tmp2 = ISqrt32( tmp2, &exp2 ); gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); q_gain = sub( 31, add( exp2, exp1 ) ); } -#else - { - Word16 exp_temp; - tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - tmp2 = BASOP_Util_Divide3232_Scale_cadence( tmp1, tmp2, &exp ); - exp2 = add( exp, sub( exp1, exp_temp ) ); - } - gain_fx = Sqrt32( tmp2, &exp2 ); - q_gain = sub( 31, exp2 ); -#endif // 1073741824 = 4 in Q28 @@ -2610,11 +2579,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotRePr_fx = &( outSlotRe_fx[0] ); outSlotImPr_fx = &( outSlotIm_fx[0] ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); move16(); } @@ -3260,7 +3225,6 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) -#ifdef FIX_1326_SUBSTITUTE_CMPMANT32EXP IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3272,19 +3236,6 @@ static void eig2x2_fx( return; } -#else - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( D_fx[0], *q_D, EPSILON_MANT, EPSILON_EXP ), -1 ) ) - { - Ure_fx[0][0] = ONE_IN_Q31; - move32(); - Ure_fx[1][1] = ONE_IN_Q31; - move32(); - *q_U = Q31; - move16(); - - return; - } -#endif /* Numeric case, when input is near an identity matrix with a gain */ tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 @@ -3493,7 +3444,6 @@ static void eig2x2_fx( move16(); } } -#ifdef FIX_1326_SPEEDUP_eig2x2_fx if ( q_U_1 != 0 ) { *q_U = q_U_1; @@ -3505,17 +3455,6 @@ static void eig2x2_fx( *q_U = q_U_2; move16(); } -#else - IF( q_U_1 != 0 ) - { - *q_U = q_U_1; - } - ELSE - { - *q_U = q_U_2; - } - move16(); -#endif return; } @@ -3570,11 +3509,6 @@ static void matrixMul_fx( Word16 chA, chB; Word16 min_q_shift1, min_q_shift2; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND -#ifndef IVAS_ENH64_CADENCE_CHANGES - Word32 tmp1, tmp2; -#endif -#endif min_q_shift1 = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); min_q_shift2 = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); @@ -3603,7 +3537,6 @@ static void matrixMul_fx( outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ) ) ); move32(); #else -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ), Are_fx[chA][1], Bre_fx[1][chB] ), Aim_fx[chA][0], Bim_fx[0][chB] ), @@ -3614,106 +3547,6 @@ static void matrixMul_fx( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ); move32(); -#else - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); - } - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bim_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); - } - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); - } - outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Are_fx[chA][1], Bim_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); - } - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } @@ -3742,15 +3575,11 @@ static void matrixTransp1Mul_fx( { Word16 chA, chB; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND - Word32 tmp1, tmp2; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ), Aim_fx[0][chA], Bim_fx[0][chB] ), @@ -3761,74 +3590,6 @@ static void matrixTransp1Mul_fx( Aim_fx[0][chA], Bre_fx[0][chB] ), Aim_fx[1][chA], Bre_fx[1][chB] ); move32(); -#else - test(); - test(); - test(); - IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Are_fx[1][chA], Bre_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - test(); - test(); - test(); - IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Aim_fx[1][chA], Bim_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_sub( tmp1, tmp2 ) ); - move32(); - - test(); - test(); - test(); - IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Aim_fx[1][chA], Bre_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); - outIm_fx[chA][chB] = L_sub( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Are_fx[1][chA], Bim_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif } } *q_out = sub( add( q_A, q_B ), 31 ); @@ -3850,10 +3611,8 @@ static void matrixTransp2Mul_fx( Word32 Bre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word32 Bim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word16 *q_B, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx Word32 Ascale, Word32 Bscale, -#endif Word32 outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word16 *q_out ) @@ -3861,15 +3620,8 @@ static void matrixTransp2Mul_fx( Word16 chA, chB; Word16 min_q_shift; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND -#ifndef IVAS_ENH64_CADENCE_CHANGES - Word32 tmp1, tmp2; -#endif -#endif -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx IF( Ascale == 1 ) -#endif { min_q_shift = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); scale_sig32( Are_fx[0], size, min_q_shift ); @@ -3878,9 +3630,7 @@ static void matrixTransp2Mul_fx( move16(); } -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx IF( Bscale == 1 ) -#endif { min_q_shift = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); scale_sig32( Bre_fx[0], size, min_q_shift ); @@ -3903,7 +3653,6 @@ static void matrixTransp2Mul_fx( outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], L_negate( Bim_fx[chB][0] ) ), Are_fx[chA][1], L_negate( Bim_fx[chB][1] ) ) ) ); move32(); #else -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ), Are_fx[chA][1], Bre_fx[chB][1] ), Aim_fx[chA][0], Bim_fx[chB][0] ), @@ -3914,75 +3663,6 @@ static void matrixTransp2Mul_fx( Are_fx[chA][0], Bim_fx[chB][0] ), Are_fx[chA][1], Bim_fx[chB][1] ); move32(); -#else - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) - tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) - tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Aim_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) - tmp1 = Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Aim_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) - tmp2 = Mpy_32_32( Aim_fx[chA][1], -Bim_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); - outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Are_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) - tmp1 = Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Are_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) - tmp2 = Mpy_32_32( Are_fx[chA][1], -Bim_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } @@ -4057,15 +3737,6 @@ static void chol2x2_fx( } ELSE { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[0][0], &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); - - outIm[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_im, outRe[0][0], &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); -#else Word32 denom; Word16 den_exp; Word32 my_outRe, my_outIm; @@ -4091,7 +3762,6 @@ static void chol2x2_fx( outIm[1][0] = Mpy_32_32( denom, my_outIm ); move32(); q_im = sub( q_im, den_exp ); -#endif } if ( outRe[1][0] == 0 ) { @@ -4110,16 +3780,11 @@ static void chol2x2_fx( // 4611686 = Q62 IF( e1 == 0 ) { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); - q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); -#else Word16 norm = norm_l( temp ); temp = L_shl( temp, norm ); q_tmp = add( q_tmp, norm ); temp = Mpy_32_32( temp, ONE_DIV_EPSILON_MANT ); q_tmp = sub( q_tmp, ONE_DIV_EPSILON_EXP ); -#endif } ELSE { @@ -4168,16 +3833,6 @@ static void chol2x2_fx( // 4611686 = Q62 IF( outRe[1][1] == 0 ) { -#if !defined( FIX_1072_REDUCE_DIVS ) - outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); - - outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, 4611686, &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); - -#else // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); Word32 tmp1 = 1953125005; /* 1/4611686 Q62 */ exp = 9; @@ -4190,19 +3845,9 @@ static void chol2x2_fx( outIm[0][1] = Mpy_32_32( tmp1, -c_im ); move32(); q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); -#endif } ELSE { -#if !defined( FIX_1072_REDUCE_DIVS ) - outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); - - outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, outRe[1][1], &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); -#else { // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); Word32 tmp1 = BASOP_Util_Divide3232_Scale_cadence( 0x7FFFFFFF, outRe[1][1], &exp ); @@ -4215,7 +3860,6 @@ static void chol2x2_fx( move32(); q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); } -#endif } if ( outRe[0][1] == 0 ) { @@ -4380,15 +4024,10 @@ static void formulate2x2MixingMatrix_fx( // 4611686 = Q62 IF( maxEne_fx == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC maxEneDiv_fx = ONE_DIV_EPSILON_MANT; move32(); q_maxEneDiv = 31 - ONE_DIV_EPSILON_EXP; move16(); -#else - maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12f in Q62 - q_maxEneDiv = add( sub( 31, exp ), sub( Q30, 62 ) ); -#endif } ELSE { @@ -4448,7 +4087,6 @@ static void formulate2x2MixingMatrix_fx( IF( temp == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC IF( E_out1 == 0 ) { Ghat_fx[0] = 0; @@ -4462,10 +4100,6 @@ static void formulate2x2MixingMatrix_fx( exp = sub( exp, sub( q_eout, 62 ) ); Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp } -#else - temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, 4611686, &exp ); // 4611686 = Q62 - exp = sub( exp, sub( q_eout, 62 ) ); -#endif } ELSE { @@ -4473,20 +4107,14 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp -#endif } -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp -#endif move32(); temp = Mpy_32_32( E_in1, 2147484 ); // 2147484 = 0.001f in Q31 temp = L_max( temp, E_in2 ); // q_ein IF( temp == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC IF( E_out2 == 0 ) { /* We can set hard-coded results */ Ghat_fx[1] = 0; @@ -4499,10 +4127,6 @@ static void formulate2x2MixingMatrix_fx( exp1 = sub( exp1, sub( q_eout, 62 ) ); Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 } -#else - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, 4611686, &exp1 ); // 4611686 = Q62 - exp1 = sub( exp1, sub( q_eout, 62 ) ); -#endif } ELSE { @@ -4510,13 +4134,8 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif } -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif move32(); q_Ghat = sub( 31, s_max( exp, exp1 ) ); @@ -4565,15 +4184,10 @@ static void formulate2x2MixingMatrix_fx( IF( D_fx[0] == 0 ) { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 - exp = sub( exp, sub( Q30, 62 ) ); -#else temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ move32(); exp = ONE_DIV_EPSILON_EXP; move16(); -#endif } ELSE { @@ -4583,7 +4197,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 exp1 = add( 0, 20 ); @@ -4594,25 +4207,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = ISqrt32( D_fx[1], &exp1 ); move32(); } -#else - IF( D_fx[1] == 0 ) - { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp1 ); // 4611686 = 1e-12 in Q62 - exp1 = sub( exp1, sub( Q30, 62 ) ); -#else - temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - exp1 = ONE_DIV_EPSILON_EXP; -#endif - } - ELSE - { - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); - exp1 = sub( exp1, sub( Q30, q_D ) ); - } - div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 - move32(); -#endif q_div = sub( 31, s_max( exp, exp1 ) ); div_fx[0] = L_shr( div_fx[0], sub( sub( 31, exp ), q_div ) ); // q_div @@ -4704,10 +4298,8 @@ static void formulate2x2MixingMatrix_fx( } matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ @@ -4718,7 +4310,6 @@ static void formulate2x2MixingMatrix_fx( { IF( Sx_fx[chB] == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Pre_fx[chA][chB] = Mpy_32_32( Pre_fx[chA][chB], ONE_DIV_EPSILON_MANT ); // q_Pre[chA][chB] = add(sub(31, q_P), 31 - ONE_DIV_EPSILON_EXP); q_Pre[chA][chB] = sub( 62 - ONE_DIV_EPSILON_EXP, q_P ); @@ -4727,26 +4318,12 @@ static void formulate2x2MixingMatrix_fx( Pim_fx[chA][chB] = Mpy_32_32( Pim_fx[chA][chB], ONE_DIV_EPSILON_MANT ); // q_Pim[chA][chB] = add(sub(31, q_P), 31 - ONE_DIV_EPSILON_EXP); q_Pim[chA][chB] = sub( 62 - ONE_DIV_EPSILON_EXP, q_P ); -#else - Pre_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pre_fx[chA][chB], 4611686, &exp ); // 4611686 = 1e-12 in Q62 - q_Pre[chA][chB] = add( sub( q_P, 62 ), sub( 31, exp ) ); - Pim_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pim_fx[chA][chB], 4611686, &exp ); // 4611686 = 1e-12 in Q62 - q_Pim[chA][chB] = add( sub( q_P, 62 ), sub( 31, exp ) ); -#endif } ELSE { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Word16 Pre_shift, Pim_shift; -#endif temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Pre_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pre_fx[chA][chB], temp, &exp ); - q_Pre[chA][chB] = add( sub( q_P, sub( 31, exp_temp ) ), sub( 31, exp ) ); - Pim_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pim_fx[chA][chB], temp, &exp ); - q_Pim[chA][chB] = add( sub( q_P, sub( 31, exp_temp ) ), sub( 31, exp ) ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); Pre_shift = norm_l( Pre_fx[chA][chB] ); Pim_shift = norm_l( Pim_fx[chA][chB] ); @@ -4755,7 +4332,6 @@ static void formulate2x2MixingMatrix_fx( q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); q_Pre[chA][chB] = add( q_temp, Pre_shift ); q_Pim[chA][chB] = add( q_temp, Pim_shift ); -#endif } if ( Pre_fx[chA][chB] == 0 ) { @@ -4858,10 +4434,8 @@ static void formulate2x2MixingMatrix_fx( matrixMul_fx( KyRe_fx, KyIm_fx, &q_ky, Pre_fx, Pim_fx, &q_P, tmpRe_fx, tmpIm_fx, &q_temp ); matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif Mre_fx, Mim_fx, q_M ); return; } diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 1ffe0da74..1afac99c4 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -55,12 +55,10 @@ #define DIRAC_DUCK_ALPHA_FX 1717986944 /* Q31 */ #define ONE_M_DIRAC_DUCK_ALPHA 429496736 /* Q31 */ -#ifdef FIX_1110_OPTIM_DIRAC_DECORR_PROC /* Maximal useful q-format, represents range of 2^-126 (float min) */ #define MAX_Q_FX 157 -#endif /*------------------------------------------------------------------------- * Local function prototypes *------------------------------------------------------------------------*/ @@ -590,18 +588,6 @@ void ivas_dirac_dec_decorr_process_fx( Word16 decorr_buff_tot_len = imult1616( imult1616( shl( decorr_buffer_len, 1 ), max_band_decorr ), num_channels ); guarded_bits = 0; -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - FOR( Word16 i = 0; i < decorr_buff_tot_len; i++ ) - { - IF( h_freq_domain_decorr_ap_state->decorr_buffer_fx[i] != 0 ) - { - guarded_bits = s_max( find_guarded_bits_fx( 2 ), 3 ); - } - } - q_shift = sub( getScaleFactor32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ), guarded_bits ); - Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, q_shift ); - q_decorr_buf = add( q_decorr_buf, q_shift ); -#else Flag is_zero = is_zero_arr( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ); if ( is_zero == 0 ) { @@ -617,7 +603,6 @@ void ivas_dirac_dec_decorr_process_fx( q_decorr_buf = add( q_decorr_buf, q_shift ); } } -#endif q_shift = getScaleFactor32( aux_buffer_fx, imult1616( imult1616( 2, num_protos_dir ), max_band_decorr_temp ) ); Word16 buf_len = shl( imult1616( num_protos_dir, max_band_decorr_temp ), 1 ); @@ -681,15 +666,8 @@ void ivas_dirac_dec_decorr_process_fx( /* MA part of filter impulse response */ FOR( l = 0; l < filter_length; l++ ) { -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_ma_fx[2 * l] = Mpy_32_16_1( input_real_fx, filter_coeff_num_real_fx[l] ); // Q_qux -3 = q_deorr - // frame_ma_fx[2 * l] = L_shr(frame_ma_fx[2 * l],3); // scaling to q_decorr_buf - frame_ma_fx[add( shl( l, 1 ), 1 )] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr - // frame_ma_fx[2 * l + 1] = L_shr(frame_ma_fx[2 * l + 1], 3); // scaling to q_decorr_buf -#else frame_ma_fx[2 * l] = Mpy_32_16_1( input_real_fx, filter_coeff_num_real_fx[l] ); // Q_qux -3 = q_deorr frame_ma_fx[2 * l + 1] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr -#endif move32(); move32(); } @@ -705,32 +683,14 @@ void ivas_dirac_dec_decorr_process_fx( filter_frame_real_fx = decorr_buffer_ptr_fx[0]; // q_decorr filter_frame_imag_fx = decorr_buffer_ptr_fx[1]; // q_decorr -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - decorr_buffer_ptr_fx += shl( decorr_buffer_step, 1 ); -#else Word16 decorr_buffer_step2x = shl( decorr_buffer_step, 1 ); decorr_buffer_ptr_fx += decorr_buffer_step2x; move16(); -#endif FOR( l = 1; l < filter_length; l++ ) { // q adjustment needed// -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ); // q_decorr - Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_1 = L_shl( temp_1, 3 ); // q_decorr - decorr_buffer_ptr_fx[0] = L_sub( decorr_buffer_ptr_fx[0], temp_1 ); // q_deocor - decorr_buffer_ptr_fx[1] = L_add( decorr_buffer_ptr_fx[1], frame_ma_fx[add( shl( l, 1 ), 1 )] ); // q_decorr - Word32 temp_2 = Mpy_32_16_1( filter_frame_imag_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_2 = L_shl( temp_2, 3 ); // q_decorr - decorr_buffer_ptr_fx[1] = L_sub( decorr_buffer_ptr_fx[1], temp_2 ); // q_decorr - decorr_buffer_ptr_fx += imult1616( 2, decorr_buffer_step ); - move32(); - move32(); - move32(); -#else Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 temp_1 = L_shl( temp_1, 3 ); // q_decorr decorr_buffer_ptr_fx[0] = L_sub( L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ), temp_1 ); // q_deocor @@ -743,7 +703,6 @@ void ivas_dirac_dec_decorr_process_fx( decorr_buffer_ptr_fx += decorr_buffer_step2x; move16(); -#endif } } } @@ -764,7 +723,6 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // scaling to get max precision for aux_buffer values// -#ifdef MSAN_FIX q_shift = Q31; move16(); offset = shl( max_band_decorr, 1 ); @@ -777,10 +735,6 @@ void ivas_dirac_dec_decorr_process_fx( { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], offset, q_shift ); } -#else - q_shift = L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ); - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); -#endif q_frame_f = add( q_frame_f, q_shift ); @@ -802,24 +756,8 @@ void ivas_dirac_dec_decorr_process_fx( q_direct_energy = q_aux_buffer; move16(); -#ifdef FIX_1110_OPTIM_DIRAC_DECORR_PROC /* Attention: this loop reports norm=0, whenever any data is 0. */ /* Therefore, useful left-shifts are skipped, accuracy is lost. */ -#endif -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - /* calculate the power of the decorrelated signal */ - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - offset1 = shl( imult1616( ch_idx, num_freq_bands ), 1 ); - offset2 = shl( imult1616( ch_idx, max_band_decorr ), 1 ); - FOR( Word16 i = 0; i < 2 * max_band_decorr; i++ ) - { - aux_64[add( offset2, i )] = W_mult0_32_32( frame_dec_fx[add( offset1, i )], frame_dec_fx[add( offset1, i )] ); - move64(); - norm = s_min( norm, W_norm( aux_64[add( offset2, i )] ) ); - } - } -#else /* calculate the power of the decorrelated signal */ Word64 *m64_aux = aux_64; move32(); @@ -849,7 +787,6 @@ void ivas_dirac_dec_decorr_process_fx( move32(); } norm = W_norm( min64 ); -#endif norm = sub( norm, 1 /*find_guarded_bits_fx( 2 )*/ ); FOR( Word16 i = 0; i < 2 * num_channels * max_band_decorr; i++ ) { @@ -866,34 +803,6 @@ void ivas_dirac_dec_decorr_process_fx( /* smooth energies */ -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - v_multc_fixed( aux_buffer_fx, ONE_M_DIRAC_DUCK_ALPHA, aux_buffer_fx, imult1616( num_channels, max_band_decorr ) ); // q_aux_buffer - - v_multc_fixed( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) ); // same-q - - v_add_fixed_me( aux_buffer_fx, sub( 31, q_aux_buffer ), h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, e_reverb_energy_smooth, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, &e_reverb_energy_smooth, imult1616( num_channels, max_band_decorr ), 0 ); - h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = sub( 31, e_reverb_energy_smooth ); - - v_multc_fixed( direct_energy_fx, ONE_M_DIRAC_DUCK_ALPHA, direct_energy_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q - - v_multc_fixed( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q - - v_add_fixed_me( direct_energy_fx, sub( 31, q_direct_energy ), h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, e_direct_energy_smooth, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, &e_direct_energy_smooth, imult1616( num_protos_dir, max_band_decorr ), 0 ); - h_freq_domain_decorr_ap_state->q_direct_energy_smooth = sub( 31, e_direct_energy_smooth ); - move16(); - - // scaling energy buffers for better precision for higher values// - q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); - 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 ) ); - 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(); -#else Word16 len = imult1616( num_channels, max_band_decorr ); Word16 aux_e = sub( 31, q_aux_buffer ); Word16 max_e = s_max( aux_e, e_reverb_energy_smooth ); @@ -950,13 +859,11 @@ void ivas_dirac_dec_decorr_process_fx( } 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 ); -#endif e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // this step is b/c we are left shifting frame_dec_fx at the end of below for loop/ -#ifdef MSAN_FIX q_shift = Q31; move16(); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -969,10 +876,6 @@ void ivas_dirac_dec_decorr_process_fx( { Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); } -#else - q_shift = sub( L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ), 2 ); - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); -#endif q_frame_f = add( q_frame_f, q_shift ); FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) @@ -1006,13 +909,8 @@ void ivas_dirac_dec_decorr_process_fx( duck_gain = shl( duck_gain, sub( e_duck_gain, 1 ) ); // Q14 -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f - frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 1 ); // q_frame_f -#else frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 1 ); // q_frame_f -#endif move32(); move32(); } @@ -1029,13 +927,8 @@ void ivas_dirac_dec_decorr_process_fx( } */ duck_gain = shl_sat( duck_gain, sub( e_duck_gain, 1 ) ); // Q14 -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 2 ); // q_frame_dec - frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 2 ); // q_frame_dec -#else frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_dec frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 1 ); // q_frame_dec -#endif move32(); move32(); } @@ -1061,27 +954,19 @@ void ivas_dirac_dec_decorr_process_fx( q_shift = sf; move16(); // scaling it to sf -#ifdef MSAN_FIX FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); } -#else - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q -#endif q_frame_f = add( q_frame_f, sf ); } ELSE IF( q_shift < 0 ) { // scaling it to input q -#ifdef MSAN_FIX FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); } -#else - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q -#endif q_frame_f = q_input_frame; q_if_local = 0; move16(); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 1b4ee91b2..87cdb6699 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -1079,7 +1079,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 ) ) { -#ifdef FIX_1072_SPEEDUP_gainpanning /*is there any difference in any bitstream?*/ Word16 temp_q1 = sub( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); FOR( Word16 kk = 0; kk < tmp16; kk++ ) { @@ -1088,17 +1087,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); -#else - 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_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*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 } -#ifdef FIX_1072_SPEEDUP_gainpanning 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++ ) { @@ -1108,11 +1097,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word32 aux; IF( temp_q1 < 0 ) { -#ifdef FIX_USAN_ISSUES Word32 temp_q1_equiv = L_lshl( (Word32) 0x80000000, temp_q1 ); -#else - Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); -#endif FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); @@ -1142,25 +1127,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } -#else - FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, - &h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); /*temp_q*/ - - IF( NE_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - Scale_sig32( aux_buf, num_freq_bands, sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ) ); /*temp_q->(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ - } - - v_add_fixed( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], - num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ - } -#endif /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 4e0d3ab71..59c93ae55 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -778,9 +778,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->frame_dec_f_fx, 2 * num_outputs_diff * num_freq_bands ); -#endif hDirAC_mem->frame_dec_f_len = imult1616( imult1616( 2, num_outputs_diff ), num_freq_bands ); } } @@ -813,12 +811,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; move16(); -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size_ho ); -#else - set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size ); - hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; -#endif IF( NE_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { @@ -870,9 +863,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_protos_dir ), num_freq_bands ); -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len ); -#endif move16(); hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = Q31; move16(); @@ -896,9 +887,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirAC_mem->proto_diffuse_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_outputs_diff ), num_freq_bands ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->proto_diffuse_buffer_f_fx, hDirAC_mem->proto_diffuse_buffer_f_len ); -#endif } } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx = hDirAC_mem->proto_direct_buffer_f_fx; @@ -961,9 +950,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->onset_filter_fx, imult1616( num_outputs_diff, num_freq_bands ) ); -#endif } } } @@ -985,9 +972,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->onset_filter_fx, imult1616( 2, num_freq_bands ) ); -#endif } } @@ -1725,11 +1710,7 @@ void protoSignalComputation2_fx( 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 ); -#ifdef MSAN_FIX 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 ) ) ); -#else - q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ), L_norm_arr( ImagBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ) ); -#endif // MSAN_FIX temp_q_shift = s_min( temp_q_shift, q_shift ); } @@ -2775,13 +2756,8 @@ void ivas_dirac_dec_compute_diffuse_proto_fx( Word16 new_diff_e = s_max( diff_e, old_diff_e ); Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx, diffuse_start, sub( old_diff_e, new_diff_e ) ); // 31-new_diff_e -#ifdef MSAN_FIX Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, i_mult( shl( num_freq_bands_diff, 1 ), hDirACRend->hOutSetup.nchan_out_woLFE ), sub( diff_e, new_diff_e ) ); // 31-new_diff_e -#else - Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, - sub( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_len, diffuse_start ), sub( diff_e, new_diff_e ) ); -#endif h_dirac_output_synthesis_state->proto_diffuse_buffer_f_q = sub( 31, new_diff_e ); move16(); @@ -2972,10 +2948,8 @@ void ivas_masa_init_stereotype_detection_fx( move16(); stereo_type_detect->target_power_y_smooth_fx = 0; move32(); -#ifdef MSAN_FIX stereo_type_detect->q_target_power_y_smooth = 31; move16(); -#endif stereo_type_detect->lr_total_bb_ratio_db_fx = 0; move32(); @@ -4215,11 +4189,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // q_cldfb } Word16 out_size = imult1616( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, 0, hMasaExtRend->cldfbSynRend[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, hMasaExtRend->cldfbSynRend[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, sub( 11, q_out ) ); // q11 idx_in++; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index f3b4d1755..d5df77045 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -754,10 +754,8 @@ void ivas_mcmasa_param_est_ana_fx( computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ) -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Q direction_vector_fx = Q30*/ /* Power and intensity estimation for diffuseness */ diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index 01e35efe1..30bf8f00a 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -393,9 +393,7 @@ static void GenerateITD_fx( Word16 num_az_idx, num_ev_idx; Word16 BM_idx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; Word16 itdMod_e; -#ifdef MSAN_FIX set16_fx( AzIdx, 0, HRTF_MODEL_BSPLINE_NUM_COEFFS ); -#endif // MSAN_FIX /* Wrap the requested azimuth to the range of the BSplines */ azim_fx = L_add( azim_fx, model->azimKSeq_fx[0] ); diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index 5787ded3f..7e35b80b2 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -573,10 +573,8 @@ static void TDREND_SRC_SPATIAL_Init_fx( TDREND_SPATIAL_VecInit_fx( SrcSpatial_p->Front_p_fx + nC * 3, 0, 0, ONE_IN_Q30 ); /*Assuming Q30*/ } -#ifdef MSAN_FIX SrcSpatial_p->q_Pos_p = Q31; move16(); -#endif /* Source directional attenuation */ SrcSpatial_p->DirAttenEnabled = FALSE; // Q0 diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 8beb5a0ec..3b01f62ca 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -1,9 +1,7 @@ #include "ivas_prot_fx.h" #include "ivas_prot_rend_fx.h" -#ifdef FIX_DISCLAIMER #include -#endif Word16 ivas_get_nchan_buffers_dec_ivas_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -161,7 +159,6 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( return nchan_out_buff; } -#ifdef FIX_DISCLAIMER /*---------------------------------------------------------------------* * get_channel_config() * @@ -272,4 +269,3 @@ ivas_error get_channel_config( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 04afce118..695e05fdf 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -81,12 +81,10 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( const Word32 ivas_total_brate /* i : total IVAS bitrate */ ); -#ifdef FIX_DISCLAIMER ivas_error get_channel_config( const AUDIO_CONFIG config, /* i : audio configuration */ Word8 *str /* o : string with the configuration name */ ); -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 870f8795d..9b149940c 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1529,9 +1529,7 @@ ivas_error ivas_reverb_open_fx( params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter; params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0]; params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0]; -#ifdef MSAN_FIX set32_fx( pState->fft_filter_color_1.fft_spectrum_fx, 0, RV_FILTER_MAX_FFT_SIZE ); -#endif /* Note: these temp buffers can only be used before the final step of the FFT filter design : */ /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */ @@ -1647,18 +1645,11 @@ ivas_error ivas_reverb_open_fx( IF( pState->do_corr_filter ) { /* Computing correlation filters on the basis of target IA coherence */ -#ifdef MSAN_FIX FOR( i = 0; i < shl( sub( nr_fc_fft_filter, 1 ), 1 ); i++ ) { pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ move32(); } -#else - FOR( i = 0; i < RV_FILTER_MAX_FFT_SIZE; i++ ) - { - pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ - } -#endif // MSAN_FIX Word32 *pHrtf_inter_aural_coherence_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 ) ); FOR( i = 0; i < nr_fc_fft_filter; i++ ) diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index aebb80a54..e6f8f2653 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -2271,12 +2271,10 @@ void SHrotmatgen_fx( Word16 R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; -#ifdef MSAN_FIX FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { set16_fx( R_lm1[i], 0, HEADROT_SHMAT_DIM ); } -#endif Word16 R_l[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; Word32 result; SHrotmat[0][0] = ONE_IN_Q14; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 386644ab1..a8f32514d 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -666,11 +666,7 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx Word32 ***filterStatesLeftReal_fx; Word32 ***filterStatesLeftImag_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStatesLeft; -#else /* OPT_BASOP_ADD_v1 */ - Word16 ***Q_filterStatesLeft; -#endif /* OPT_BASOP_ADD_v1 */ Word16 numTapsArray[BINAURAL_CONVBANDS]; Word16 numTaps; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3ea159d7f..84e771106 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8481,7 +8481,6 @@ static void intermidiate_ext_dirac_render( } } -#ifdef FIX_DISCLAIMER static ivas_error printConfigInfo_rend( IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ ) @@ -8574,4 +8573,3 @@ void IVAS_REND_PrintDisclaimer( void ) return; } -#endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 0a489600a..e837daa4f 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -324,7 +324,6 @@ void IVAS_REND_Close( ); -#ifdef FIX_DISCLAIMER /* Disclaimer and info printing */ void IVAS_REND_PrintInputConfig( @@ -338,7 +337,6 @@ ivas_error IVAS_REND_PrintConfig( void IVAS_REND_PrintDisclaimer( void ); -#endif /* clang-format on */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index e667dcfe5..c2e3d8a2a 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1201,11 +1201,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); -#ifdef MSAN_FIX floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); -#else - floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); -#endif } } } -- GitLab From 88209e93b149fd65a8921985e32feab918a34692 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 16:13:40 +0530 Subject: [PATCH 160/358] Clang formatting --- lib_com/bits_alloc_fx.c | 96 ++++++------ lib_com/cldfb.c | 8 +- lib_com/gs_inact_switching_fx.c | 22 +-- lib_com/ivas_dirac_com_fx.c | 3 +- lib_com/ivas_prot_fx.h | 3 +- lib_com/ivas_qmetadata_com_fx.c | 2 - lib_com/prot_fx.h | 130 ++++++++-------- lib_com/swb_bwe_com_fx.c | 4 +- lib_com/tools_fx.c | 50 +++--- lib_dec/FEC_HQ_phase_ecu_fx.c | 8 +- lib_dec/acelp_core_dec_ivas_fx.c | 38 ++--- lib_dec/fd_cng_dec_fx.c | 4 +- lib_dec/ivas_binRenderer_internal_fx.c | 3 - lib_dec/ivas_core_dec_fx.c | 10 +- lib_dec/ivas_mdct_core_dec_fx.c | 10 +- lib_dec/ivas_spar_decoder_fx.c | 2 +- lib_dec/ivas_stat_dec.h | 2 +- lib_dec/ivas_stereo_icbwe_dec_fx.c | 10 +- lib_dec/ivas_svd_dec_fx.c | 145 +++++++++--------- lib_enc/acelp_core_enc_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 1 - lib_enc/core_enc_init_fx.c | 4 +- lib_enc/dtx_fx.c | 10 +- lib_enc/enc_acelpx_fx.c | 2 +- lib_enc/hq_core_enc_fx.c | 4 +- lib_enc/igf_enc.c | 4 +- lib_enc/ivas_core_pre_proc_front_fx.c | 14 +- lib_enc/ivas_dirac_enc_fx.c | 21 +-- lib_enc/ivas_mcmasa_enc_fx.c | 6 +- lib_enc/ivas_mdct_core_enc_fx.c | 12 +- lib_enc/ivas_omasa_enc_fx.c | 6 +- lib_enc/ivas_stat_enc.h | 2 +- lib_enc/ivas_stereo_dmx_evs_fx.c | 20 +-- lib_enc/ivas_stereo_ica_enc_fx.c | 8 +- lib_enc/ivas_stereo_icbwe_enc_fx.c | 2 +- lib_enc/ivas_stereo_td_analysis_fx.c | 14 +- lib_enc/ivas_td_low_rate_enc_fx.c | 4 +- lib_enc/prot_fx_enc.h | 18 +-- lib_enc/speech_music_classif_fx.c | 12 +- lib_enc/tcx_utils_enc_fx.c | 4 +- lib_enc/transient_detection_fx.c | 4 +- .../ivas_dirac_dec_binaural_functions_fx.c | 6 +- lib_rend/ivas_mcmasa_ana_fx.c | 6 +- 43 files changed, 355 insertions(+), 381 deletions(-) diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index cb71f0f28..8162a98d3 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -762,31 +762,31 @@ static ivas_error acelp_FCB_allocator_ivas( *--------------------------------------------------------------------*/ ivas_error config_acelp1( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signalling_bits, /* i : number of signalling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signalling_bits, /* i : number of signalling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, bits, nb_subfr; @@ -1887,31 +1887,31 @@ ivas_error config_acelp1( *--------------------------------------------------------------------*/ ivas_error config_acelp1_IVAS( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signaling_bits, /* i : number of signaling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signaling_bits, /* i : number of signaling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, bits, nb_subfr; diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 408580169..845ec1f11 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1097,10 +1097,10 @@ void cldfbAnalysis_ts_fx_fixed_q( * Conduct inverse multple overlap cmplex low delay MDCT *--------------------------------------------------------------------*/ void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ const Word16 shift, /* i : scale for state buffer */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index 421b2a705..54fef9e37 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -158,18 +158,18 @@ void Inac_swtch_ematch_fx( void Inac_switch_ematch_ivas_fx( - Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ - Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ - const Word16 coder_type, /* i : Coding mode */ + Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ + Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ + const Word16 coder_type, /* i : Coding mode */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 L_frame, /* i : Frame lenght */ - const Word16 Q_exc, /* i : input and output format of exc2 */ - const Word16 bfi, /* i : frame lost indicator */ - const Word16 last_core, /* i : Last core used */ - const Word16 last_codec_mode, /* i : Last codec mode */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const Word16 element_mode /* i : element mode */ + const Word16 L_frame, /* i : Frame lenght */ + const Word16 Q_exc, /* i : input and output format of exc2 */ + const Word16 bfi, /* i : frame lost indicator */ + const Word16 last_core, /* i : Last core used */ + const Word16 last_codec_mode, /* i : Last codec mode */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const Word16 element_mode /* i : element mode */ ) { Word16 Ener_per_bd[MBANDS_GN16k]; diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 7d481d181..b16b94f1d 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -610,8 +610,7 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_z, /* o: Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ , - Word16 *i_e_band -) + Word16 *i_e_band ) { Word16 i; Word32 intensityNorm; diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index fab166b6d..246f4d297 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3237,8 +3237,7 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_z, /*Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ , - Word16 *i_e_band -); + Word16 *i_e_band ); UWord8 ivas_masa_surrcoh_signicant_fx( diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index ee11f2b02..a5fbf9e83 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -446,8 +446,6 @@ ivas_error only_reduce_bits_direction_fx( } } } - - } *reduce_bits_out = negate( reduce_bits ); diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 71c1590c2..d7ed9a140 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4851,31 +4851,31 @@ Word16 BITS_ALLOC_config_acelp( const Word16 nb_subfr ); ivas_error config_acelp1( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signalling_bits, /* i : number of signalling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signalling_bits, /* i : number of signalling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); Word16 set_ACELP_flag( @@ -5846,18 +5846,18 @@ void Inac_swtch_ematch_fx( ); void Inac_switch_ematch_ivas_fx( - Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ - Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ - const Word16 coder_type, /* i : Coding mode */ + Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ + Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ + const Word16 coder_type, /* i : Coding mode */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 L_frame, /* i : Frame lenght */ - const Word16 Q_exc, /* i : input and output format of exc2 */ - const Word16 bfi, /* i : frame lost indicator */ - const Word16 last_core, /* i : Last core used */ - const Word16 last_codec_mode, /* i : Last codec mode */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const Word16 element_mode /* i : element mode */ + const Word16 L_frame, /* i : Frame lenght */ + const Word16 Q_exc, /* i : input and output format of exc2 */ + const Word16 bfi, /* i : frame lost indicator */ + const Word16 last_core, /* i : Last core used */ + const Word16 last_codec_mode, /* i : Last codec mode */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const Word16 element_mode /* i : element mode */ ); // igf_base_fx.c @@ -9740,10 +9740,10 @@ void cldfbAnalysis_ivas_fx( ); void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ const Word16 shift, /* i : scale for state buffer */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); @@ -10973,31 +10973,31 @@ void lsf_syn_mem_backup_ivas_fx( Word16 *pstreaklen ); ivas_error config_acelp1_IVAS( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signaling_bits, /* i : number of signaling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signaling_bits, /* i : number of signaling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); ivas_error push_next_indice( @@ -11051,8 +11051,8 @@ void calculate_hangover_attenuation_gain_ivas_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void core_coder_reconfig_ivas_fx( diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 228d43247..11da78c46 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2534,7 +2534,7 @@ void hq_generic_decoding_fx( { exp = norm_l( L_tmp ); frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ - tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ + tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ fenvL_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /*Q1 */ @@ -3082,7 +3082,7 @@ void hq_generic_decoding_ivas_fx( { exp = norm_l( L_tmp ); frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ - tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ + tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ fenvL_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /*Q1 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index d403c583d..5219d076c 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -487,13 +487,13 @@ void Copy( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move16(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move16(); + } - return; + return; } /*-------------------------------------------------------------------* * Copy64: @@ -519,13 +519,13 @@ void Copy64( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move64(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move64(); + } - return; + return; } void set64_fx( @@ -566,15 +566,15 @@ void Copy_pword( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i].v.im = x[i].v.im; - y[i].v.re = x[i].v.re; - move16(); - move16(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i].v.im = x[i].v.im; + y[i].v.re = x[i].v.re; + move16(); + move16(); + } - return; + return; } /*-------------------------------------------------------------------* * Copy32: @@ -599,11 +599,11 @@ void Copy32( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move32(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move32(); + } } void set8_fx( diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 74f1bfc09..b8c16474e 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1590,7 +1590,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( *pPlocs ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1601,7 +1601,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && EQ_16( *pPlocs, 1 ) ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( *pPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1647,7 +1647,7 @@ static void ivas_spec_ana_fx( IF( EQ_16( currPlocs, ( sub( Lprot2_1, DELTA_CORR_F0_INT ) ) ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( currPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1661,7 +1661,7 @@ static void ivas_spec_ana_fx( * whould point */ IF( n > 0 ) /* fs/2 which makes special case . */ { - Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( currPlocs, 2 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 5807f2c67..ea82f09de 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -77,21 +77,21 @@ ivas_error acelp_core_dec_ivas_fx( { Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/; - Word16 old_exc_fx[L_EXC_DEC], *exc_fx; /* excitation signal buffer */ - Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx; /* synthesis signal buffer */ - Word16 output_frame; /* frame length at output sampling freq. */ - Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ - Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ - Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ - Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ - Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ - Word32 enr_q_fx; /* E information for FER protection */ - Word16 tmp_noise_fx; /* Long term temporary noise energy */ - Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ - Word16 FEC_pitch_fx; /* FEC pitch */ + Word16 old_exc_fx[L_EXC_DEC], *exc_fx; /* excitation signal buffer */ + Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx; /* synthesis signal buffer */ + Word16 output_frame; /* frame length at output sampling freq. */ + Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ + Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ + Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ + Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ + Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ + Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ + Word32 enr_q_fx; /* E information for FER protection */ + Word16 tmp_noise_fx; /* Long term temporary noise energy */ + Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ + Word16 FEC_pitch_fx; /* FEC pitch */ Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ - Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ + Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ Word16 i, j, int_fs; Word16 tc_subfr; Word16 allow_cn_step; @@ -1810,7 +1810,7 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) + scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); @@ -1892,13 +1892,13 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) + scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn ); - scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 + scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -1988,12 +1988,12 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) + scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn ); - Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 + Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index df18d3dba..c1289b8a3 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -5270,7 +5270,7 @@ void generate_stereo_masking_noise_fx( { hFdCngCom = st->hFdCngDec->hFdCngCom; Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ - Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ + Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ set32_fx( &Np_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); set32_fx( &Ns_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); @@ -5278,7 +5278,7 @@ void generate_stereo_masking_noise_fx( IF( !fadeOut ) { Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ - generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 + generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 /* Generate masking noise for secondary channel */ IF( flag_sec_CNA ) { diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index f78f14e8e..c05b8beb2 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -339,7 +339,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - } } /* set memories */ @@ -1264,7 +1263,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; - } free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); @@ -1272,7 +1270,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; - } free( hBinRenConvModule->filterStatesLeftReal_fx ); diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 4e654030b..588640d0a 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -524,7 +524,7 @@ ivas_error ivas_core_dec_fx( } Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 - Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 + Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 IF( st->cldfbAna ) { scale_sig32( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, Q10 - Q11 ); /* 9 * (Word16)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f) , Q10 */ @@ -630,8 +630,8 @@ ivas_error ivas_core_dec_fx( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_output ) ); // Q11 - Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 - Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 + Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 + Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 } /*---------------------------------------------------------------------* @@ -1147,8 +1147,8 @@ ivas_error ivas_core_dec_fx( q = 2; move16(); - Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 - Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 + Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 + Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 Scale_sig( hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, hBWE_TD->prev_Q_bwe_syn ) ); // Q8 Copy_Scale_sig_32_16( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, ( 2 * ALLPASSSECTIONS_STEEP ), sub( hBWE_TD->prev_Q_bwe_syn2, Q11 ) ); // prev_Q_bew_syn2 diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 71839557a..7d5f7d737 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1172,13 +1172,13 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_syn_Overl_TDAC ) ); // st->hTcxDec->Q_syn_Overl_TDAC -> q_win Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_old_syn_Overl ) ); // Q(-1 - st->Q_syn) -> q_win st->hTcxDec->Q_old_syn_Overl = q_win; - Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win - Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win - Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win - Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win + Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win + Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win - Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win + Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win FOR( k = 0; k < nSubframes[ch]; k++ ) { init_tcx_info_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], k, bfi, &tcx_offset[ch], diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index c3e2ad096..a7b66ff87 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -1352,7 +1352,7 @@ static void ivas_spar_calc_smooth_facs_fx( smooth_long_avg_fx[b] = L_add( smooth_long_avg_fx[b], smooth_buf_fx[b][i] ); // Q0 move32(); } - smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 + smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 move32(); smooth_long_avg_fx[b] = Mpy_32_32( smooth_long_avg_fx[b], 107374182 /*(1/20 in Q31)*/ ); // Q0 move32(); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 429a99ca4..891be05be 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -961,7 +961,7 @@ typedef struct decoder_tc_buffer_structure Word32 *tc_buffer_fx; /* the buffer itself */ Word16 tc_buff_len; /*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV - Word16 no_channels; /*Stores no of channels in tc_fx with values*/ + Word16 no_channels; /*Stores no of channels in tc_fx with values*/ Word16 q_tc_fx; TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ Word16 nchan_transport_jbm; /* number of TCs after TC decoding */ diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 1c2ecffaf..c9f7cac92 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -718,8 +718,8 @@ void stereo_icBWE_dec_fx( IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) { temp1_fx = 0; @@ -813,7 +813,7 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prev_Q_fsout = tmp; move16(); } - Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ + Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ *Q_syn = sub( *Q_syn, 1 ); @@ -877,8 +877,8 @@ void stereo_icBWE_dec_fx( IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) { temp1_fx = 0; diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index dd9859504..8a9224ffa 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -294,7 +294,6 @@ Word16 svd_fx( push_wmops( "svd_fx" ); - /* Collecting Values */ FOR( iCh = 0; iCh < nChannelsL; iCh++ ) { @@ -385,11 +384,11 @@ static Word16 BidagonalDiagonalisation_fx( Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) singularValues_fx_e*/ Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: secDiag_fx_e*/ Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ - Word16 *secDiag_new_e, /* i/o: */ - const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ - const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ - const Word32 eps_x, /* i : eps_x_e*/ - const Word16 eps_x_e /* i : */ + Word16 *secDiag_new_e, /* i/o: */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ + const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ + const Word32 eps_x, /* i : eps_x_e*/ + const Word16 eps_x_e /* i : */ ) { Word16 kCh, nCh, iCh, jCh, split; @@ -898,52 +897,52 @@ static void biDiagonalReductionLeft_fx( secDiag_e[currChannel] = *sig_x_e; move16(); -/* Setting values to 0 */ -( *sig_x ) = 0; -move32(); -( *g ) = 0; -move32(); - -IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ -{ - idx = currChannel; - move16(); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ - } + /* Setting values to 0 */ + ( *sig_x ) = 0; + move32(); + ( *g ) = 0; + move32(); - IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ { - Word16 invVal_e; - Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); - norm_x = 0; - move32(); - norm_x_e = 0; + idx = currChannel; move16(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { + ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ + } + + IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + { + Word16 invVal_e; + Word32 invVal; + invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); + norm_x = 0; + move32(); + norm_x_e = 0; + move16(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); move16(); 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) */ - } - IF( GT_16( norm_x_e, 0 ) ) - { - norm_x = MAX_32; - move32(); - norm_x_e = 0; + } + IF( GT_16( norm_x_e, 0 ) ) + { + norm_x = MAX_32; + move32(); + norm_x_e = 0; + move16(); + } + L_temp_e = norm_x_e; move16(); - } - L_temp_e = norm_x_e; - move16(); - L_temp = Sqrt32( norm_x, &L_temp_e ); - L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 - //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); + L_temp = Sqrt32( norm_x, &L_temp_e ); + L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 + //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); if ( singularVectors[currChannel][idx] >= 0 ) { L_temp = L_negate( L_temp ); @@ -951,52 +950,51 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ ( *g ) = L_temp; move32(); - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ - move32(); + r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ + singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ + move32(); - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); - FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ - { - norm_x = 0; - move32(); - norm_x_e = 0; - move16(); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { + 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) */ - } + } - f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */ + 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 ) ); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] ); - move32(); + move32(); + } } - } - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ - move32(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ + move32(); singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e ); - move16(); + move16(); + } } + // rescaling block + singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */ + move32(); + singularValues_e[currChannel] = *sig_x_e; + move16(); } - // rescaling block - singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */ - move32(); - singularValues_e[currChannel] = *sig_x_e; - move16(); -} - -return; + return; } /*------------------------------------------------------------------------- @@ -1108,7 +1106,7 @@ static void biDiagonalReductionRight_fx( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { - singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ + singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ move32(); } } @@ -1120,9 +1118,6 @@ static void biDiagonalReductionRight_fx( singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); move16(); } - - - } } @@ -1230,7 +1225,7 @@ static void singularVectorsAccumulationLeft_fx( { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { - singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ + singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ move32(); } } diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index a93690738..f9f941dbd 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -1430,7 +1430,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); IF( st->element_mode > EVS_MONO && st->hTcxEnc != NULL ) { - Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn + Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 1 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); // st->Q_syn st->hTcxEnc->q_Txnq = st->Q_syn; move16(); diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 54f57b287..bb35cf037 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4525,7 +4525,6 @@ void coder_tcx_fx( n, st, hm_cfg ); - } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 405b3ac2b..14dbd5962 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -943,8 +943,8 @@ static void init_modes_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 44be8dcc6..9a66572ab 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -60,12 +60,12 @@ static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, /* _ None */ /*==================================================================================*/ void dtx_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word16 vad, /* i : vad flag for DTX Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word16 vad, /* i : vad flag for DTX Q0*/ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ) { Word16 alpha, i, j, Q_speech2; diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index 9612696ed..240f9859c 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -781,7 +781,7 @@ void E_ACELP_4tsearchx_ivas_fx( alp = shr( alp, 1 ); Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/ Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ - Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ + Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ } diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 6bc466e3d..ff19cfebc 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -481,8 +481,8 @@ void hq_core_enc_ivas_fx( TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); Copy_Scale_sig_16_32_no_sat( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ - inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ - L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ + inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ + L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; move16(); move16(); diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index d5f071784..2680bd9f6 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2517,8 +2517,8 @@ void IGFEncResetTCX10BitCounter_ivas_fx( *-------------------------------------------------------------------*/ void IGFEncApplyMono_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index bf7c36eef..96c1b168f 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -125,14 +125,14 @@ ivas_error pre_proc_front_ivas_fx( const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover, LR channels Q0*/ Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN (band_energies_LR_fx_q)*/ Word16 band_energies_LR_fx_q, - const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ - const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ - const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ - const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ + const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ + const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO , diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index 59447c022..615a6f4b6 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -51,11 +51,9 @@ static void computeIntensityVector_enc_fx( Word32 Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], const Word16 enc_param_start_band, /* i : first band to process */ const Word16 num_frequency_bands, - Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] - , + Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS], Word16 q_cldfb, - Word16 q_intensity_real[DIRAC_MAX_NBANDS] -); + Word16 q_intensity_real[DIRAC_MAX_NBANDS] ); /*------------------------------------------------------------------------- * ivas_dirac_enc_open() @@ -1123,11 +1121,9 @@ void ivas_dirac_param_est_enc_fx( Cldfb_ImagBuffer_fx, hDirAC->hConfig->enc_param_start_band, num_freq_bands, - intensity_real_fx - , + intensity_real_fx, cldfb_q, - intensity_real_q - ); + intensity_real_q ); IF( !hodirac_flag ) { computeDirectionVectors_fixed( @@ -1138,10 +1134,8 @@ void ivas_dirac_param_est_enc_fx( num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], - direction_vector_fx[2] - , - 31, intensity_real_q - ); + direction_vector_fx[2], + 31, intensity_real_q ); direction_vector_q = Q30; move16(); @@ -1465,8 +1459,7 @@ static void computeIntensityVector_enc_fx( Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] /* q_intensity_real */ , Word16 q_cldfb, - Word16 q_intensity_real[DIRAC_MAX_NBANDS] -) + Word16 q_intensity_real[DIRAC_MAX_NBANDS] ) { /* Reminder * X = a + ib; Y = c + id diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 0071b67ea..7a5718e99 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -1178,10 +1178,8 @@ void ivas_mcmasa_param_est_enc_fx( num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], - direction_vector_fx[2], c_e - , - NULL - ); + direction_vector_fx[2], c_e, + NULL ); /* Power and intensity estimation for diffuseness */ computeIntensityVector_enc_fx( diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 4b5b3fcbe..f7da231a3 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -429,11 +429,11 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 - Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 - scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 + Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 + scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); tmp = BASOP_Util_Divide1616_Scale( NORM_MDCT_FACTOR, s, &exp_tmp ); @@ -896,8 +896,8 @@ static UWord16 enc_ste_pre_mdct( absMagnR_fx = Sqrt32( L_add( Mpy_32_32( sigR1_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI1_fx[s], sigI1_fx[s] ) ), &absMagnR_e ); corr_fx = L_add( corr_fx, L_add( Mpy_32_32( sigR0_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI0_fx[s], sigI1_fx[s] ) ) ); // q_com*2 - 31 - sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 - sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 + sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 + sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 sumMagnL_fx = BASOP_Util_Add_Mant32Exp( sumMagnL_fx, sumMagnL_e, absMagnL_fx, absMagnL_e, &sumMagnL_e ); sumMagnR_fx = BASOP_Util_Add_Mant32Exp( sumMagnR_fx, sumMagnR_e, absMagnR_fx, absMagnR_e, &sumMagnR_e ); sumPrdLR_fx = BASOP_Util_Add_Mant32Exp( sumPrdLR_fx, sumPrdLR_e, Mpy_32_32( absMagnL_fx, absMagnR_fx ), add( absMagnL_e, absMagnR_e ), &sumPrdLR_e ); diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 1433c988f..f1187bc6c 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1199,10 +1199,8 @@ static void ivas_omasa_param_est_enc_fx( computeIntensityVector_enc_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, guard_bits ); intensity_real_e = sub( add( 62, guard_bits ), shl( q, 1 ) ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e - , - NULL - ); + computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e, + NULL ); /* Power estimation for diffuseness */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 4a6543026..f421fd034 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1179,7 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; - Word32 isd_rate_s_fx; // Q31 + Word32 isd_rate_s_fx; // Q31 Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 2ed17e25a..625ff8ee9 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -155,8 +155,8 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word16 itd[], /* o : estimated itd Q0 */ - const Word16 input_frame /* i : input frame length per channel */ + Word16 itd[], /* o : estimated itd Q0 */ + const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( const Word32 src_fx[], /* i : input signal Q16 */ @@ -198,9 +198,9 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word16 itd_fx[], /* o : estimated itd */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio */ + Word16 itd_fx[], /* o : estimated itd */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio */ ); /*-------------------------------------------------------------------* * estimate_itd_wnd_fft() @@ -1136,9 +1136,9 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word16 itd_fx[], /* o : estimated itd Q0 */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio Q31 */ + Word16 itd_fx[], /* o : estimated itd Q0 */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) { Word16 itd_cand[CPE_CHANNELS], i, n, cnt[CPE_CHANNELS], Lh, peak_range, *on, *itdLR, prev_off[CPE_CHANNELS], eps_fx; @@ -1448,8 +1448,8 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word16 itd[], /* o : estimated itd Q0 */ - const Word16 input_frame /* i : input frame length per channel */ + Word16 itd[], /* o : estimated itd Q0 */ + const Word16 input_frame /* i : input frame length per channel */ ) { Word32 specLr[L_FRAME48k / 2 + 1], specLi[L_FRAME48k / 2 + 1], specRr[L_FRAME48k / 2 + 1], specRi[L_FRAME48k / 2 + 1]; diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 8410f7546..78ea50d7e 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1095,8 +1095,8 @@ static void corrStatsEst_fx( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], 429496730 /* 0.2 in Q31*/ ), hStereoTCA->delay_0_mem_exp, L_mult0( 26214 /* 0.8 in Q15*/, corrLagStats[0] ), Q16, &temp ); /* Q31-temp */ move32(); Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, L_negate( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ - inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ - IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 + inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ + IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 { set32_fx( &( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], MAX_DELAYREGLEN - 1 ); hStereoTCA->delay_0_mem_exp = temp; @@ -1964,8 +1964,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ - scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ + scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ + hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ tempF_fx = tempF_16fx; move32(); diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 25e2366dd..02d20543b 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -822,7 +822,7 @@ void stereo_icBWE_enc_ivas_fx( set32_fx( shb_frame_nonref_fx, 0, L_LOOK_16k + L_FRAME16k ); max_e = s_max( hStereoICBWE->mem_shb_speech_nonref_e, shb_speech_nonref_e ); - Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e + Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e hStereoICBWE->mem_shb_speech_nonref_e = max_e; shb_frame_nonref_e = max_e; diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index f9b6b0bf3..6ffd05c0c 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -71,13 +71,13 @@ #define RATIO_MAX 1.5f /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ -#define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ -#define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ -#define B_ADAP_FX_Q16 ( 10486 ) /* 0.16f in Q16 */ +#define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ +#define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ +#define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ +#define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ +#define B_ADAP_FX_Q16 ( 10486 ) /* 0.16f in Q16 */ #define PC_LIMIT 64 #define RATIO_PG_HR 0.94f diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index 63cbb30e9..bdc39e797 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -338,8 +338,8 @@ void encod_gen_2sbfr( * Update memory of the weighting filter *-----------------------------------------------------------------*/ - Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ - Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ + Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ + Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ Ltmp = L_negate( Ltmp ); Ltmp = L_mac( Ltmp, xn[2 * L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index f80373787..3f7f17fe7 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -177,12 +177,12 @@ void dtx_fx( ); void dtx_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word16 vad, /* i : vad flag for DTX Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word16 vad, /* i : vad flag for DTX Q0*/ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ); Word16 dtx_hangover_addition_fx( @@ -1232,8 +1232,8 @@ void AVQ_cod_lpc_fx( ); void ProcessIGF_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ Word32 *pMDCTSpectrum, /* i : MDCT spectrum */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -3067,8 +3067,8 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | Word16 last_core_acelp /**< in: Q0 | indictaor if last frame was acelp coded */ ); -void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ - Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ +void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ + Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index ff9e2d936..b9f47136f 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -890,7 +890,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis tmp = div_s( tmp2, tmp1 ); /*Q(15+exp3) */ L_tmp = L_shl( tmp, sub( 1, exp3 ) ); /*Q16 */ - ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ + ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ } } @@ -2201,12 +2201,12 @@ Word16 ivas_smc_gmm_fx( ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_music_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 - pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 + wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_noise_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 - pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 + wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); } @@ -2220,7 +2220,7 @@ Word16 ivas_smc_gmm_fx( *high_lpn_flag = 1; move32(); } - hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 + hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lps_fx = extract_h( L_shl_sat( lps_fx, 16 - 11 ) ); // Q7 move16(); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index c84843384..e0a944981 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3784,8 +3784,8 @@ void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) * *---------------------------------------------------------------------*/ void ProcessIGF_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ Word32 *pMDCTSpectrum, /* i : MDCT spectrum (*q_spectrum) */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 92f01b5dd..60d661db4 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -678,8 +678,8 @@ void RunTransientDetection_ivas_fx( IF( GT_16( sub( q_input, pSubblockEnergies->q_firState ), shift ) ) { Scale_sig( input_fx, length, add( sub( pSubblockEnergies->q_firState, q_input ), shift ) ); // q_firState + shift - q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift - pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift + q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift + pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift move16(); pSubblockEnergies->firState2 = shl( pSubblockEnergies->firState2, shift ); // q_firState + shift move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index fb3a89350..2376babcd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -72,9 +72,9 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #define INV_TAN30_FX 28377 // Q14 #define EPSILON_MANT 1180591621 /* 1e-12 = 0.5497558*(2^-39) in Q70 */ #define EPSILON_EXP ( -39 ) -#define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ -#define ONE_DIV_EPSILON_EXP ( 40 ) -#define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ +#define ONE_DIV_EPSILON_EXP ( 40 ) +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index d5df77045..cfdd43116 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -753,10 +753,8 @@ void ivas_mcmasa_param_est_ana_fx( /* Direction estimation */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ) - , - NULL - ); /* Q direction_vector_fx = Q30*/ + computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), + NULL ); /* Q direction_vector_fx = Q30*/ /* Power and intensity estimation for diffuseness */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, FoaEven_RealBuffer_fx, FoaEven_ImagBuffer_fx, num_freq_bands, intensity_even_real_fx ); /*2*inp_q-31*/ -- GitLab From f40595a1e0584e88670c723566ce112d9a40dc40 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 17:25:41 +0530 Subject: [PATCH 161/358] Fix for 3GPP issue 1414: ApplyFdCng_ivas_fx() called twice Link #1414 --- lib_dec/acelp_core_dec_ivas_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index ea82f09de..bd8c6ec93 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -660,7 +660,7 @@ ivas_error acelp_core_dec_ivas_fx( STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ); move32(); } - ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + Word16 new_sidNoiseEstExp = 31 - Q4; move16(); Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) ); // Q(31-sidNoiseEstExp) -- GitLab From 0d5424b95a3ba5400bc9936d4f968f0c49d9b630 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 24 Mar 2025 09:18:10 +0530 Subject: [PATCH 162/358] Q-factor of synthesis memory buffers of LPDmem struct updates --- lib_com/lsf_tools_fx.c | 8 ++++---- lib_enc/cod_tcx_fx.c | 4 ++-- lib_enc/core_enc_init_fx.c | 6 ++++++ lib_enc/init_enc_fx.c | 14 ++++---------- lib_enc/ivas_tcx_core_enc_fx.c | 16 ++-------------- lib_enc/ivas_td_low_rate_enc_fx.c | 1 + lib_enc/tcx_utils_enc_fx.c | 9 ++++++++- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 54f0ae3ed..5f0b3b57b 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -3044,11 +3044,11 @@ void lsf_syn_mem_backup_ivas_fx( /* back-up memories */ FOR( i = 0; i < M; i++ ) { - mem_syn_bck[i] = hLPDmem->mem_syn[i]; // Q: ( 15 - st_fx->hLPDmem->e_mem_syn ) + mem_syn_bck[i] = hLPDmem->mem_syn[i]; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); } - *mem_w0_bck = hLPDmem->mem_w0; // ( 15 - st_fx->hLPDmem->e_mem_syn ) + *mem_w0_bck = hLPDmem->mem_w0; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); @@ -3263,12 +3263,12 @@ void lsf_syn_mem_restore_ivas_fx( } /* restoring memories */ - hLPDmem->mem_w0 = mem_w0_bck; // Q(15 - st_fx->hLPDmem->e_mem_syn ) + hLPDmem->mem_w0 = mem_w0_bck; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); FOR( i = 0; i < M; i++ ) { - hLPDmem->mem_syn[i] = mem_syn_bck[i]; // Q(15 - st_fx->hLPDmem->e_mem_syn ) + hLPDmem->mem_syn[i] = mem_syn_bck[i]; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); } diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index bb35cf037..4bb44eae2 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -3743,7 +3743,7 @@ void QuantizeTCXSpectrum_fx( } /* Quantize original spectrum */ - sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e ); + sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e ); tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); @@ -4730,7 +4730,7 @@ void InternalTCXDecoder_fx( } ELSE { - mdct_shaping( spectrum_fx, L_frame, gainlpc_fx, gainlpc_e ); + mdct_noiseShaping_ivas_fx( spectrum_fx, spectrum_e, L_frame, gainlpc_fx, gainlpc_e ); } /*-----------------------------------------------------------* * Apply gain * diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 14dbd5962..05f838a3a 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1561,6 +1561,10 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { set16_fx( hLPDmem->syn, 0, 1 + M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); + hLPDmem->q_lpd_syn = Q15; + hLPDmem->q_mem_syn = Q15; + move16(); + move16(); } IF( st->hTcxEnc != NULL ) @@ -1591,6 +1595,8 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); set16_fx( hLPDmem->syn, 0, M ); hLPDmem->q_lpd_syn = Q15; + hLPDmem->q_mem_syn = Q15; + move16(); move16(); } IF( st->hTcxEnc != NULL ) diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 1d695659c..ea944dd75 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -998,16 +998,18 @@ void LPDmem_enc_init_ivas_fx( set16_fx( hLPDmem->mem_syn2, 0, M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); set16_fx( hLPDmem->mem_syn3, 0, M ); + hLPDmem->q_lpd_old_exc = Q15; + move16(); hLPDmem->q_lpd_syn = Q15; move16(); + hLPDmem->q_mem_syn = Q15; + move16(); hLPDmem->mem_w0 = 0; move16(); hLPDmem->tilt_code = 0; move16(); hLPDmem->gc_threshold = 0; move32(); - hLPDmem->q_mem_syn = Q15; - move16(); hLPDmem->dm_fx.prev_state = 0; move16(); /* This corresponds to st_fx->dispMem in FLP */ hLPDmem->dm_fx.prev_gain_code = 0; @@ -1019,14 +1021,6 @@ void LPDmem_enc_init_ivas_fx( move16(); } - hLPDmem->q_lpd_syn = Q15; - move16(); - hLPDmem->q_lpd_old_exc = Q15; - move16(); - hLPDmem->q_mem_syn = Q15; - move16(); - - return; } diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 159012ac2..8dbd4731c 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -562,9 +562,9 @@ void stereo_tcx_core_enc( } Scale_sig( st->synth, st->L_frame, s ); /* st->Q_syn + s */ Scale_sig( st->hLPDmem->syn, M + 1, s ); /* st->Q_syn + s */ + st->hLPDmem->q_lpd_syn = add( st->hLPDmem->q_lpd_syn, s ); Q_new = add( Q_new, s ); move16(); - move16(); coder_tcx_post_ivas_fx( st, st->hLPDmem, st->hTcxCfg, st->synth, A_q_fx, Aw_fx, st->wspeech_enc, Q_new ); @@ -688,19 +688,7 @@ void stereo_tcx_core_enc( { set16_fx( pitch_buf_fx, L_SUBFR * ONE_IN_Q6, NB_SUBFR16k ); /* Q6 */ } - /* Memory scaling to keep everything in common q */ - Word16 curr_q_syn = sub( shl( Q_new, 1 ), 1 ); - Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn2, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( s_min( Q_new, st->hLPDmem->q_mem_syn ), Q_new ) ); /* s_min( Q_new, st->hLPDmem->q_mem_syn ) */ - move16(); - Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn3, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - st->hLPDmem->q_mem_syn = s_min( curr_q_syn, st->hLPDmem->q_mem_syn ); - move16(); - st->hLPDmem->q_lpd_syn = Q_new; - move16(); + IF( st->hTdCngEnc != NULL ) { FOR( Word16 ii = 0; ii < HO_HIST_SIZE; ii++ ) diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index bdc39e797..77ddb35aa 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -157,6 +157,7 @@ void tdm_low_rate_enc( { E_UTIL_synthesis( 0, p_Aq, &exc_wo_nf_fx[i_subfr], &synth[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1, M ); /* Q_new */ p_Aq += ( M + 1 ); + scale_sig( hLPDmem->mem_syn, M, sub( hLPDmem->q_mem_syn, Q_new ) ); // Q_new -> hLPDmem->q_mem_syn } /*--------------------------------------------------------------------------------------* diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index e0a944981..7d268b92a 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2799,12 +2799,14 @@ void tcx_encoder_memory_update_ivas_fx( Copy( xn_buf, synth, L_frame_glob ); Copy( synth + sub( L_frame_glob, M + 1 ), LPDmem->syn, M + 1 ); + LPDmem->q_lpd_syn = Q_new; + move16(); IF( st->tcxonly == 0 ) { /* Update weighted synthesis */ Residu3_fx( Ai + imult1616( sub( st->nb_subfr, 1 ), ( M + 1 ) ), synth + sub( L_frame_glob, 1 ), &tmp, 1, 0 ); - LPDmem->mem_w0 = sub_sat( wsig[sub( L_frame_glob, 1 )], tmp ); + LPDmem->mem_w0 = sub_sat( wsig[L_frame_glob - 1], tmp ); move16(); } @@ -2817,6 +2819,11 @@ void tcx_encoder_memory_update_ivas_fx( Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn, M ); Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn2, M ); Copy( synth + sub( L_frame_glob, L_SYN_MEM ), LPDmem->mem_syn_r, L_SYN_MEM ); + + /* Aligning the Q-factor of the remaining synthesis memory buffers */ + Scale_sig( LPDmem->mem_syn1_fx, M, sub( Q_new, LPDmem->q_mem_syn ) ); + Scale_sig( LPDmem->mem_syn3, M, sub( Q_new, LPDmem->q_mem_syn ) ); + LPDmem->q_mem_syn = Q_new; // resultant q of synth after E_UTIL_f_preemph2 move16(); -- GitLab From 7745e2b1aacfd73bfa93953a048a3ff824c6da1c Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 24 Mar 2025 10:41:39 +0530 Subject: [PATCH 163/358] Fix for 3GPP issue 1425: IssueAssert in generate_masking_noise_dirac_ivas_fx of BASOP decoder when fed with MASA bitstream from BASOP encoder Link #1425 --- lib_dec/fd_cng_dec_fx.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index c1289b8a3..2f9c567c1 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1318,13 +1318,10 @@ Word16 ApplyFdCng_ivas_fx( e_shift = sub( s, q_norm ); } } - FOR( ; k < hFdCngCom->npart; k++ ) + FOR( ; j < FFTCLDFBLEN; j++ ) { - FOR( ; j <= hFdCngCom->part[k]; j++ ) - { - cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], sub( s, e_shift ) ); /*Q: s*/ - move32(); - } + cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], sub( s, e_shift ) ); /*Q: s*/ + move32(); } *cngNoiseLevel_exp = add( add( hFdCngDec->bandNoiseShape_exp, s2 ), e_shift ); @@ -1685,14 +1682,13 @@ Word16 ApplyFdCng_ivas_fx( } /* adapt scaling for rest of the buffer */ s = sub( *cngNoiseLevel_exp, add( hFdCngDec->bandNoiseShape_exp, s2 ) ); - FOR( ; k < hFdCngCom->npart; k++ ) + + FOR( ; j < FFTCLDFBLEN; j++ ) { - FOR( ; j <= hFdCngCom->part[k]; j++ ) - { - cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ - move32(); - } + cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ + move32(); } + *cngNoiseLevel_exp = add( hFdCngDec->bandNoiseShape_exp, s2 ); move16(); } @@ -1759,15 +1755,15 @@ Word16 ApplyFdCng_ivas_fx( } /* adapt scaling for rest of the buffer */ s = sub( *cngNoiseLevel_exp, add( hFdCngDec->bandNoiseShape_exp, s2 ) ); - FOR( ; k < hFdCngCom->npart; k++ ) + + FOR( ; j < FFTCLDFBLEN; j++ ) { - FOR( ; j <= hFdCngCom->part[k]; j++ ) - { - /* NOTE: saturation is added here as part of issue 1218 fix. after rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ - cngNoiseLevel[j] = L_shl_sat( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ - move32(); - } + /* NOTE: saturation is added here as part of issue 1218 fix. after rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ + cngNoiseLevel[j] = L_shl_sat( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ + move32(); } + + *cngNoiseLevel_exp = add( hFdCngDec->bandNoiseShape_exp, s2 ); move16(); } -- GitLab From c63f60e770047a825baac275d55b4f17dd6a44d7 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 24 Mar 2025 15:07:19 +0530 Subject: [PATCH 164/358] Fix for 3GPP issue 1419: BER detect in Stereo Decoder at 13.2 kbps DTX Link #1419 --- lib_enc/lsf_enc_fx.c | 2 +- lib_enc/mslvq_enc_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 6761dfb82..e6d08c49d 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -733,7 +733,7 @@ static void lsfq_CNG_ivas_fx( /* MSVQ_ROM to be updated */ mslvq_cng_ivas_fx( idx_cv, dd, qlsf, ddq, idx_lead_cng, idx_scale_cng, wghts ); - index_lvq_ivas_fx( ddq, idx_lead_cng, idx_scale_cng, START_CNG + idx_cv, idx_lvq, 0 ); + index_lvq_ivas_fx( ddq, idx_lead_cng, idx_scale_cng, START_CNG_IVAS + idx_cv, idx_lvq, 0 ); Vr_add( qlsf, &CNG_SN1_fx[idx_cv * M], qlsf, M ); /* write the VQ index to the bitstream */ diff --git a/lib_enc/mslvq_enc_fx.c b/lib_enc/mslvq_enc_fx.c index af5a82b69..f15b80655 100644 --- a/lib_enc/mslvq_enc_fx.c +++ b/lib_enc/mslvq_enc_fx.c @@ -244,7 +244,7 @@ Word32 mslvq_cng_ivas_fx( /* for CNG there is only one bitrate but several lattice quantizer structures, depending on the previous VQ stage */ - mode_glb = add( START_CNG, idx_cv ); + mode_glb = add( START_CNG_IVAS, idx_cv ); move16(); p_sigma = sigma_MSLVQ_fx[mode]; // x2.56 -- GitLab From c93ce9f445b6840fec45c9e206da6e8d6cf7353f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 24 Mar 2025 15:13:17 +0530 Subject: [PATCH 165/358] Fix for 3GPP issue 1410: Major Difference for Stereo input at noisy segments 13.2 kbps DTX 32kHz SWB Link #1410 --- lib_enc/ivas_core_pre_proc_front_fx.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 96c1b168f..4ff34272f 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1855,7 +1855,7 @@ static void calculate_energy_buffer_ivas_fx( const Word32 input_Fs, /* i : input sampling rate Q0*/ Word16 *enerBuffer_dft_e ) { - Word16 i, j; + Word16 i, j, guard_bits; Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; Word64 *p_nrg_DMX_fx; Word32 *pDFT_DMX_fx; /*q_DFT_DMX_fx*/ @@ -1863,8 +1863,6 @@ static void calculate_energy_buffer_ivas_fx( Word16 band_res_dft_fx, chan_width_f_fx, start, stop; Word16 norm_nrg_DMX_fx; Word64 max_abs_nrg_DMX_fx; - Flag overflow = 0; - move32(); max_abs_nrg_DMX_fx = 0; move64(); @@ -1881,22 +1879,23 @@ static void calculate_energy_buffer_ivas_fx( start = 1; move16(); - pDFT_DMX_fx = hCPE->hStereoDft->DFT_fx[0]; /*q_DFT_DMX_fx = 31-hCPE->hStereoDft->DFT_fx_e[0]*/ + guard_bits = add( find_guarded_bits_fx( extract_h( chan_width_bins_fx ) ), 1 ); /* Q0 */ + + pDFT_DMX_fx = hCPE->hStereoDft->DFT_fx[0]; /* q_DFT_DMX_fx = 31 - hCPE->hStereoDft->DFT_fx_e[0] */ p_nrg_DMX_fx = nrg_DMX_fx; - *p_nrg_DMX_fx = Mpy_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ); /*2 * q_DFT_DMX_fx -31 */ + *p_nrg_DMX_fx = W_shr( W_mult_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ), guard_bits ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); FOR( i = 0; i < no_channels; i++ ) { - stop = extract_l( L_shr( L_add( Mpy_32_16_1( chan_width_bins_fx, add( i, 1 ) ), 1 ), 1 ) ); + stop = extract_l( L_shr( L_add( Mpy_32_16_1( chan_width_bins_fx, add( i, 1 ) ), 1 ), 1 ) ); /* Q0 */ FOR( j = start; j < stop; j++ ) { - *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ) ); /*2 * q_DFT_DMX_fx -31 */ + *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); - *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ) ); + *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); - // 2 * DFT_fx_e } IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) { @@ -1910,11 +1909,11 @@ static void calculate_energy_buffer_ivas_fx( norm_nrg_DMX_fx = W_norm( max_abs_nrg_DMX_fx ); FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ { - enerBuffer_dft_fx[i] = W_extract_h( W_shl_o( nrg_DMX_fx[i], norm_nrg_DMX_fx, &overflow ) ) / 3; /*q_enerBuffer_dft_fx=2 * q_DFT_DMX_fx -31+ norm_nrg_DMX_fx -32*/ + enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx - 32 */ move32(); } - *enerBuffer_dft_e = sub( add( 32, shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ) ), norm_nrg_DMX_fx ); /*31-q_enerBuffer_dft_fx*/ + *enerBuffer_dft_e = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx ); move16(); /* Set remaining entries of enerBuffer to zero */ -- GitLab From 222bf462ed4a61c0bcb48c7e4617bab1c2284e28 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 24 Mar 2025 13:52:15 +0100 Subject: [PATCH 166/358] Use L_norm_arr instead of getScaleFactor32. Add assert checking proto_power_smooth q values. --- lib_dec/ivas_dirac_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 1c06de82d..a52390f68 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3774,7 +3774,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - exp = s_min( exp, getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); + exp = s_min( exp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + i, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); } FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { @@ -3804,7 +3804,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - exp = s_min( exp, getScaleFactor32( 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 ) ) ) ); + exp = s_min( exp, L_norm_arr( 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 ) ) ) ); } FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { -- GitLab From dc953d6b954c44e839c54a0de07d5da3716131c7 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 7 Mar 2025 15:04:57 +0100 Subject: [PATCH 167/358] first draft of the improvement. --- lib_enc/ivas_sns_enc_fx.c | 102 +++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index dfd207c3e..36c5cebec 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -170,6 +170,103 @@ static Word16 sns_1st_cod_fx( return index; } +static Word16 sns_1st_cod_fx_q15( + const Word32 *sns_fx, /* i : vector to quantize */ + const Word16 L_frame, + const Word16 core, + Word32 *snsq_fx /* o : quantized sns Q16 */ +) +{ + Word16 index; + const Word16 split_len = M / 2; + move16(); + const Word16 *means; + const Word16 means_fix = 2; // Q15 + push_wmops("sns_1st_cod_fx_q15"); + move16(); + /* remove means */ + means = NULL; + SWITCH( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + FOR( Word16 i = 0; i < M; ++i ) + { + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + snsq_fx[i] = L_add(sns_fx[i], L_negate( tmp ) ); + move32(); + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1; + Word16 dist_split; + Word64 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + move16(); + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = 0x7fffffffffffffffull; + dist_split = 0; + FOR( Word16 i = 0; i < 32; ++i ) + { + Word64 dist_fx = 0; + move64(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 dist; + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + move16(); + dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); + dist_fx = W_mac_32_32( dist_fx, dist, dist ); + } + + if ( LT_64( dist_fx, dist_min_fx ) ) + { + dist_min_fx= dist_fx; + dist_split =i ; + } + } + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + move32(); + } + + /* for second split shift by five bits to store both indices as one 10 bit value */ + IF( EQ_16( split, 1 ) ) + { + dist_split = shl( dist_split, 5 ); + } + + index = add( index, dist_split ); + } + pop_wmops(); + return index; +} + /*------------------------------------------------------------------- * sns_2st_cod() * @@ -275,7 +372,7 @@ void sns_avq_cod_fx( Word16 indxt[256], nbits, nbt, nit; Word32 snsmid_q0_fx[M]; - index[0] = sns_1st_cod_fx( sns_fx, exp_sns, L_frame, core, sns_q_fx ); + index[0] = sns_1st_cod_fx_q15( sns_fx, L_frame, core, sns_q_fx ); move16(); nit = 1 + 2; move16(); @@ -302,7 +399,8 @@ void sns_avq_cod_fx( { index++; - index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); +// index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From d557e115a42e4ca5fa1ff56a95ad0c97f312ed0d Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 7 Mar 2025 15:34:59 +0100 Subject: [PATCH 168/358] addressed some code review comments in sns_1st_cod_fx_q15(). --- lib_enc/ivas_sns_enc_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 36c5cebec..edcc33905 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -225,6 +225,8 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = cdbk; dist_min_fx = 0x7fffffffffffffffull; dist_split = 0; + move64(); + move16(); FOR( Word16 i = 0; i < 32; ++i ) { Word64 dist_fx = 0; @@ -233,12 +235,11 @@ static Word16 sns_1st_cod_fx_q15( { Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - move16(); dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); dist_fx = W_mac_32_32( dist_fx, dist, dist ); } - if ( LT_64( dist_fx, dist_min_fx ) ) + IF ( LT_64( dist_fx, dist_min_fx ) ) { dist_min_fx= dist_fx; dist_split =i ; @@ -256,7 +257,7 @@ static Word16 sns_1st_cod_fx_q15( } /* for second split shift by five bits to store both indices as one 10 bit value */ - IF( EQ_16( split, 1 ) ) + if( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } -- GitLab From 9d90ec3885d76536134f7a8f26b8bbee36ca6a27 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Mar 2025 18:42:08 +0100 Subject: [PATCH 169/358] formatting --- lib_enc/ivas_sns_enc_fx.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index edcc33905..d5a15eaa1 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -182,7 +182,7 @@ static Word16 sns_1st_cod_fx_q15( move16(); const Word16 *means; const Word16 means_fix = 2; // Q15 - push_wmops("sns_1st_cod_fx_q15"); + push_wmops( "sns_1st_cod_fx_q15" ); move16(); /* remove means */ means = NULL; @@ -203,7 +203,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_add(sns_fx[i], L_negate( tmp ) ); + snsq_fx[i] = L_add( sns_fx[i], L_negate( tmp ) ); move32(); } @@ -213,8 +213,8 @@ static Word16 sns_1st_cod_fx_q15( { const Word16 *cdbk_ptr; Word16 j0, j1; - Word16 dist_split; - Word64 dist_min_fx; + Word16 dist_split; + Word64 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; @@ -225,26 +225,26 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = cdbk; dist_min_fx = 0x7fffffffffffffffull; dist_split = 0; - move64(); - move16(); - FOR( Word16 i = 0; i < 32; ++i ) - { - Word64 dist_fx = 0; - move64(); - FOR( Word16 j = j0; j < j1; ++j ) - { - Word32 dist; - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - dist = ( L_add(snsq_fx[j], L_negate( tmp_1 ) ) ); - dist_fx = W_mac_32_32( dist_fx, dist, dist ); - } - - IF ( LT_64( dist_fx, dist_min_fx ) ) - { - dist_min_fx= dist_fx; - dist_split =i ; - } - } + move64(); + move16(); + FOR( Word16 i = 0; i < 32; ++i ) + { + Word64 dist_fx = 0; + move64(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 dist; + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); + dist_fx = W_mac_32_32( dist_fx, dist, dist ); + } + + IF( LT_64( dist_fx, dist_min_fx ) ) + { + dist_min_fx = dist_fx; + dist_split = i; + } + } /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; @@ -257,14 +257,14 @@ static Word16 sns_1st_cod_fx_q15( } /* for second split shift by five bits to store both indices as one 10 bit value */ - if( EQ_16( split, 1 ) ) + if ( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } index = add( index, dist_split ); } - pop_wmops(); + pop_wmops(); return index; } @@ -401,7 +401,7 @@ void sns_avq_cod_fx( index++; index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); -// index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + // index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From 8ae004120e7dac853096aa92ebbad6163de5b8ac Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 10 Mar 2025 13:59:00 +0100 Subject: [PATCH 170/358] sns_1st_cod_fx_q15() implemented with a 32 bit multiplication. --- lib_enc/ivas_sns_enc_fx.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index d5a15eaa1..3f614483f 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -214,7 +214,7 @@ static Word16 sns_1st_cod_fx_q15( const Word16 *cdbk_ptr; Word16 j0, j1; Word16 dist_split; - Word64 dist_min_fx; + Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; @@ -223,23 +223,26 @@ static Word16 sns_1st_cod_fx_q15( j1 = add( j0, split_len ); cdbk_ptr = cdbk; - dist_min_fx = 0x7fffffffffffffffull; + dist_min_fx = MAXVAL_WORD32; dist_split = 0; - move64(); + move32(); move16(); FOR( Word16 i = 0; i < 32; ++i ) { - Word64 dist_fx = 0; - move64(); + Word32 dist_fx = 0; + move32(); FOR( Word16 j = j0; j < j1; ++j ) { Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); - dist_fx = W_mac_32_32( dist_fx, dist, dist ); + dist = L_shr( dist, 4 ); // TODO: Magic shift. + dist = L_mult( extract_l( dist ), extract_l( dist ) ); + dist = L_shr( dist, 4 ); // TODO: Magic shift + dist_fx = L_add( dist_fx, dist ); } - IF( LT_64( dist_fx, dist_min_fx ) ) + IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; dist_split = i; -- GitLab From 08931100877083b6da7c75702f4c0dde3110e2b2 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 10 Mar 2025 14:30:29 +0100 Subject: [PATCH 171/358] appl --- lib_enc/ivas_sns_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 3f614483f..b2da2ca78 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -236,9 +236,9 @@ static Word16 sns_1st_cod_fx_q15( Word32 dist; Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift. + dist = L_shr( dist, 4 ); // TODO: Magic shift. dist = L_mult( extract_l( dist ), extract_l( dist ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift + dist = L_shr( dist, 4 ); // TODO: Magic shift dist_fx = L_add( dist_fx, dist ); } -- GitLab From d6bea61a73d6e70eb0f592b0f34476ef9264809f Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Tue, 11 Mar 2025 13:18:07 +0100 Subject: [PATCH 172/358] minor wmops improvement in sns_1st_cod_fx_q15. --- lib_enc/ivas_sns_enc_fx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index b2da2ca78..b57674417 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -203,7 +203,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_add( sns_fx[i], L_negate( tmp ) ); + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -233,9 +233,10 @@ static Word16 sns_1st_cod_fx_q15( move32(); FOR( Word16 j = j0; j < j1; ++j ) { + Word32 tmp; Word32 dist; - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - dist = ( L_add( snsq_fx[j], L_negate( tmp_1 ) ) ); + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + dist = L_sub( snsq_fx[j], tmp ); dist = L_shr( dist, 4 ); // TODO: Magic shift. dist = L_mult( extract_l( dist ), extract_l( dist ) ); dist = L_shr( dist, 4 ); // TODO: Magic shift @@ -253,8 +254,8 @@ static Word16 sns_1st_cod_fx_q15( cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++ , cdbk_fix ); // Q16 snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } -- GitLab From 8d92d646939725ff3b80d83422f87b9b620cad9b Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 11:15:44 +0100 Subject: [PATCH 173/358] preparation for the cleanup. --- lib_enc/ivas_sns_enc_fx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index b57674417..54bceec9a 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -203,7 +203,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -235,11 +235,15 @@ static Word16 sns_1st_cod_fx_q15( { Word32 tmp; Word32 dist; + Word16 tmp2; + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 dist = L_sub( snsq_fx[j], tmp ); - dist = L_shr( dist, 4 ); // TODO: Magic shift. - dist = L_mult( extract_l( dist ), extract_l( dist ) ); - dist = L_shr( dist, 4 ); // TODO: Magic shift + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + + tmp2 = extract_l( dist ); + dist = L_mult( tmp2, tmp2 ); + dist = L_shr( dist, 4 ); // make sure that the sum does not overflow dist_fx = L_add( dist_fx, dist ); } @@ -255,7 +259,7 @@ static Word16 sns_1st_cod_fx_q15( FOR( Word16 j = j0; j < j1; ++j ) { Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( *cdbk_ptr++ , cdbk_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } -- GitLab From 95d4681f8725fb3c0850ec3083e444eb5695697e Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 11:53:54 +0100 Subject: [PATCH 174/358] merge candiate. --- lib_enc/ivas_sns_enc_fx.c | 376 +++++++++++++++++++------------------- 1 file changed, 184 insertions(+), 192 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 54bceec9a..7cda2970b 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,221 +59,214 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - Word16 index, i; - const Word16 split_len = M / 2; - move16(); - const Word16 *means; - const Word16 means_fix = 2; // Q15 - move16(); - /* remove means */ - means = NULL; - SWITCH( L_frame ) + IF( exp_sns == Q15) { - case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; - break; - case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; - break; - case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; - break; - default: - assert( !"illegal frame length in sns_1st_cod" ); - } - Word16 exp_snsq_buffer[M] = { 0 }, exp_snsq = 0; - move16(); - move16(); - FOR( i = 0; i < M; ++i ) - { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 - exp_snsq_buffer[i] = 0; + Word16 index; + const Word16 split_len = M / 2; move16(); - snsq_fx[i] = BASOP_Util_Add_Mant32Exp( sns_fx[i], exp_sns, L_negate( tmp ), 15, &exp_snsq_buffer[i] ); - move32(); - } - FOR( i = 0; i < M; i++ ) - { - exp_snsq = s_max( exp_snsq_buffer[i], exp_snsq ); - } - FOR( i = 0; i < M; i++ ) - { - snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); - move32(); - } - - index = 0; - move16(); - FOR( Word16 split = 0; split < 2; ++split ) - { - const Word16 *cdbk_ptr; - Word16 j0, j1, index_split; - Word32 dist_min_fx; - const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + const Word16 *means; + const Word16 means_fix = 2; // Q15 move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - - j0 = imult1616( split, split_len ); - j1 = add( j0, split_len ); - - cdbk_ptr = cdbk; - dist_min_fx = MAXVAL_WORD32; - Word16 exp_dist_min = 31; - index_split = 0; - FOR( i = 0; i < 32; ++i ) + /* remove means */ + means = NULL; + SWITCH( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + FOR( Word16 i = 0; i < M; ++i ) { - Word32 dist_fx = 0; + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); - Word16 exp_dist = 0; + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1; + Word16 dist_split; + Word32 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); - FOR( Word16 j = j0; j < j1; ++j ) + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = MAXVAL_WORD32; + dist_split = 0; + move32(); + move16(); + FOR( Word16 i = 0; i < 32; ++i ) { - Word32 tmp_fx; - Word16 exp_tmp = 0; - move16(); - Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - tmp_fx = BASOP_Util_Add_Mant32Exp( snsq_fx[j], exp_snsq, L_negate( tmp_1 ), 15, &exp_tmp ); - Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 - dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 + Word32 dist_fx = 0; + move32(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp; + Word32 dist; + Word16 tmp2; + + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + dist = L_sub( snsq_fx[j], tmp ); + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + + tmp2 = extract_l( dist ); + dist = L_mult( tmp2, tmp2 ); + dist = L_shr( dist, 4 ); // make sure that the sum does not overflow + dist_fx = L_add( dist_fx, dist ); + } + + IF( LT_32( dist_fx, dist_min_fx ) ) + { + dist_min_fx = dist_fx; + dist_split = i; + } } - - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + FOR( Word16 j = j0; j < j1; ++j ) { - dist_min_fx = dist_fx; + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); - exp_dist_min = exp_dist; - move16(); - index_split = i; - move16(); } + + /* for second split shift by five bits to store both indices as one 10 bit value */ + if ( EQ_16( split, 1 ) ) + { + dist_split = shl( dist_split, 5 ); + } + + index = add( index, dist_split ); } - - /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; - FOR( Word16 j = j0; j < j1; ++j ) + return index; + } ELSE { + Word16 index, i; + const Word16 split_len = M / 2; + move16(); + const Word16 *means; + const Word16 means_fix = 2; // Q15 + move16(); + /* remove means */ + means = NULL; + SWITCH( L_frame ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + Word16 exp_snsq_buffer[M] = { 0 }, exp_snsq = 0; + move16(); + move16(); + FOR( i = 0; i < M; ++i ) + { + Word32 tmp = L_mult( means[i], means_fix ); // Q16 + exp_snsq_buffer[i] = 0; + move16(); + snsq_fx[i] = BASOP_Util_Add_Mant32Exp( sns_fx[i], exp_sns, L_negate( tmp ), 15, &exp_snsq_buffer[i] ); move32(); } - - /* for second split shift by five bits to store both indices as one 10 bit value */ - IF( EQ_16( split, 1 ) ) + FOR( i = 0; i < M; i++ ) { - index_split = shl( index_split, 5 ); + exp_snsq = s_max( exp_snsq_buffer[i], exp_snsq ); } - - index = add( index, index_split ); - } - - return index; -} - -static Word16 sns_1st_cod_fx_q15( - const Word32 *sns_fx, /* i : vector to quantize */ - const Word16 L_frame, - const Word16 core, - Word32 *snsq_fx /* o : quantized sns Q16 */ -) -{ - Word16 index; - const Word16 split_len = M / 2; - move16(); - const Word16 *means; - const Word16 means_fix = 2; // Q15 - push_wmops( "sns_1st_cod_fx_q15" ); - move16(); - /* remove means */ - means = NULL; - SWITCH( L_frame ) - { - case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; - break; - case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; - break; - case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; - break; - default: - assert( !"illegal frame length in sns_1st_cod" ); - } - FOR( Word16 i = 0; i < M; ++i ) - { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 - move32(); - } - - index = 0; - move16(); - FOR( Word16 split = 0; split < 2; ++split ) - { - const Word16 *cdbk_ptr; - Word16 j0, j1; - Word16 dist_split; - Word32 dist_min_fx; - const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 - move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - - j0 = imult1616( split, split_len ); - j1 = add( j0, split_len ); - - cdbk_ptr = cdbk; - dist_min_fx = MAXVAL_WORD32; - dist_split = 0; - move32(); - move16(); - FOR( Word16 i = 0; i < 32; ++i ) + FOR( i = 0; i < M; i++ ) { - Word32 dist_fx = 0; + snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); move32(); + } + + index = 0; + move16(); + FOR( Word16 split = 0; split < 2; ++split ) + { + const Word16 *cdbk_ptr; + Word16 j0, j1, index_split; + Word32 dist_min_fx; + const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 + move16(); + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = imult1616( split, split_len ); + j1 = add( j0, split_len ); + + cdbk_ptr = cdbk; + dist_min_fx = MAXVAL_WORD32; + Word16 exp_dist_min = 31; + index_split = 0; + FOR( i = 0; i < 32; ++i ) + { + Word32 dist_fx = 0; + move32(); + Word16 exp_dist = 0; + move16(); + FOR( Word16 j = j0; j < j1; ++j ) + { + Word32 tmp_fx; + Word16 exp_tmp = 0; + move16(); + Word32 tmp_1 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + tmp_fx = BASOP_Util_Add_Mant32Exp( snsq_fx[j], exp_snsq, L_negate( tmp_1 ), 15, &exp_tmp ); + Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 + dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 + } + + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) + { + dist_min_fx = dist_fx; + move32(); + exp_dist_min = exp_dist; + move16(); + index_split = i; + move16(); + } + } + + /* set quantized vector */ + cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp; - Word32 dist; - Word16 tmp2; - - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - - tmp2 = extract_l( dist ); - dist = L_mult( tmp2, tmp2 ); - dist = L_shr( dist, 4 ); // make sure that the sum does not overflow - dist_fx = L_add( dist_fx, dist ); + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_4 = L_mult( ( *cdbk_ptr++ ), cdbk_fix ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + move32(); } - - IF( LT_32( dist_fx, dist_min_fx ) ) + + /* for second split shift by five bits to store both indices as one 10 bit value */ + IF( EQ_16( split, 1 ) ) { - dist_min_fx = dist_fx; - dist_split = i; + index_split = shl( index_split, 5 ); } + + index = add( index, index_split ); } - - /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; - FOR( Word16 j = j0; j < j1; ++j ) - { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 - Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 - move32(); - } - - /* for second split shift by five bits to store both indices as one 10 bit value */ - if ( EQ_16( split, 1 ) ) - { - dist_split = shl( dist_split, 5 ); - } - - index = add( index, dist_split ); + + return index; } - pop_wmops(); - return index; } /*------------------------------------------------------------------- @@ -381,7 +374,7 @@ void sns_avq_cod_fx( Word16 indxt[256], nbits, nbt, nit; Word32 snsmid_q0_fx[M]; - index[0] = sns_1st_cod_fx_q15( sns_fx, L_frame, core, sns_q_fx ); + index[0] = sns_1st_cod_fx( sns_fx, exp_sns, L_frame, core, sns_q_fx ); move16(); nit = 1 + 2; move16(); @@ -408,8 +401,7 @@ void sns_avq_cod_fx( { index++; - index[0] = sns_1st_cod_fx_q15( snsmid_fx, L_frame, core, snsmid_q_fx ); - // index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); + index[0] = sns_1st_cod_fx( snsmid_fx, exp_snsmid, L_frame, core, snsmid_q_fx ); move16(); nit = 1 + 2; move16(); -- GitLab From b934c216373187aabab3803c34d2bbdd46829394 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Mar 2025 12:01:43 +0100 Subject: [PATCH 175/358] applied the clang patch. --- lib_enc/ivas_sns_enc_fx.c | 48 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 7cda2970b..7b1aa46de 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == Q15) + IF( exp_sns == Q15 ) { Word16 index; const Word16 split_len = M / 2; @@ -86,10 +86,10 @@ static Word16 sns_1st_cod_fx( FOR( Word16 i = 0; i < M; ++i ) { Word32 tmp = L_mult( means[i], means_fix ); // Q16 - snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 + snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } - + index = 0; move16(); FOR( Word16 split = 0; split < 2; ++split ) @@ -101,10 +101,10 @@ static Word16 sns_1st_cod_fx( const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - + j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); - + cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; dist_split = 0; @@ -119,44 +119,46 @@ static Word16 sns_1st_cod_fx( Word32 tmp; Word32 dist; Word16 tmp2; - + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); + dist = L_sub( snsq_fx[j], tmp ); dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - + tmp2 = extract_l( dist ); dist = L_mult( tmp2, tmp2 ); dist = L_shr( dist, 4 ); // make sure that the sum does not overflow dist_fx = L_add( dist_fx, dist ); } - + IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; dist_split = i; } } - + /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { - Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 + Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 Word32 tmp_4 = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 + snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } - + /* for second split shift by five bits to store both indices as one 10 bit value */ if ( EQ_16( split, 1 ) ) { dist_split = shl( dist_split, 5 ); } - + index = add( index, dist_split ); } return index; - } ELSE { + } + ELSE + { Word16 index, i; const Word16 split_len = M / 2; move16(); @@ -199,7 +201,7 @@ static Word16 sns_1st_cod_fx( snsq_fx[i] = L_shr( snsq_fx[i], exp_snsq - exp_snsq_buffer[i] ); move32(); } - + index = 0; move16(); FOR( Word16 split = 0; split < 2; ++split ) @@ -210,10 +212,10 @@ static Word16 sns_1st_cod_fx( const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; - + j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); - + cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; Word16 exp_dist_min = 31; @@ -234,7 +236,7 @@ static Word16 sns_1st_cod_fx( Word32 tmp_2 = Mpy_32_32( tmp_fx, tmp_fx ); // exp_tmp*2 dist_fx = BASOP_Util_Add_Mant32Exp( dist_fx, exp_dist, tmp_2, exp_tmp * 2, &exp_dist ); // exp_tmp*2 } - + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dist_fx, exp_dist, dist_min_fx, exp_dist_min ), -1 ) ) { dist_min_fx = dist_fx; @@ -245,7 +247,7 @@ static Word16 sns_1st_cod_fx( move16(); } } - + /* set quantized vector */ cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) @@ -255,16 +257,16 @@ static Word16 sns_1st_cod_fx( snsq_fx[j] = L_add( tmp_4, tmp_3 ); // Q16 move32(); } - + /* for second split shift by five bits to store both indices as one 10 bit value */ IF( EQ_16( split, 1 ) ) { index_split = shl( index_split, 5 ); } - + index = add( index, index_split ); } - + return index; } } -- GitLab From 451006570aed7b42153a3ce4ba4ced74e21b28c5 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 19 Mar 2025 11:15:50 +0100 Subject: [PATCH 176/358] add missing move16(), move32(); don't change variable name to stay closer to float and the other variant --- lib_enc/ivas_sns_enc_fx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 7b1aa46de..2271b6ac6 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -96,7 +96,7 @@ static Word16 sns_1st_cod_fx( { const Word16 *cdbk_ptr; Word16 j0, j1; - Word16 dist_split; + Word16 index_split; Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); @@ -107,7 +107,7 @@ static Word16 sns_1st_cod_fx( cdbk_ptr = cdbk; dist_min_fx = MAXVAL_WORD32; - dist_split = 0; + index_split = 0; move32(); move16(); FOR( Word16 i = 0; i < 32; ++i ) @@ -133,12 +133,14 @@ static Word16 sns_1st_cod_fx( IF( LT_32( dist_fx, dist_min_fx ) ) { dist_min_fx = dist_fx; - dist_split = i; + move32(); + index_split = i; + move16(); } } /* set quantized vector */ - cdbk_ptr = &cdbk[imult1616( dist_split, split_len )]; + cdbk_ptr = &cdbk[imult1616( index_split, split_len )]; FOR( Word16 j = j0; j < j1; ++j ) { Word32 tmp_3 = L_mult( means[j], means_fix ); // Q16 @@ -150,10 +152,10 @@ static Word16 sns_1st_cod_fx( /* for second split shift by five bits to store both indices as one 10 bit value */ if ( EQ_16( split, 1 ) ) { - dist_split = shl( dist_split, 5 ); + index_split = shl( index_split, 5 ); } - index = add( index, dist_split ); + index = add( index, index_split ); } return index; } -- GitLab From af35e72f6dd60c918968a8c593f2223bbabe8cac Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 09:16:55 +0100 Subject: [PATCH 177/358] added some comments for an easier review. --- lib_enc/ivas_sns_enc_fx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 2271b6ac6..c38da5958 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == Q15 ) + IF( exp_sns == 15 ) { Word16 index; const Word16 split_len = M / 2; @@ -72,20 +72,20 @@ static Word16 sns_1st_cod_fx( SWITCH( L_frame ) { case L_FRAME16k: - means = &sns_1st_means_16k[core - 1][0]; + means = &sns_1st_means_16k[core - 1][0]; // Q14 break; case L_FRAME25_6k: - means = &sns_1st_means_25k6[core - 1][0]; + means = &sns_1st_means_25k6[core - 1][0]; // Q14 break; case L_FRAME32k: - means = &sns_1st_means_32k[core - 1][0]; + means = &sns_1st_means_32k[core - 1][0]; // Q14 break; default: assert( !"illegal frame length in sns_1st_cod" ); } FOR( Word16 i = 0; i < M; ++i ) { - Word32 tmp = L_mult( means[i], means_fix ); // Q16 + Word32 tmp = L_mult( means[i], means_fix ); // Q14->Q16 snsq_fx[i] = L_sub( sns_fx[i], tmp ); // Q16 move32(); } @@ -100,7 +100,7 @@ static Word16 sns_1st_cod_fx( Word32 dist_min_fx; const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15 move16(); - const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; // Q12 j0 = imult1616( split, split_len ); j1 = add( j0, split_len ); @@ -114,14 +114,14 @@ static Word16 sns_1st_cod_fx( { Word32 dist_fx = 0; move32(); - FOR( Word16 j = j0; j < j1; ++j ) + FOR( Word16 j = j0; j < j1; ++j ) // j1-j0=split_len. split_len=M/2. M=16 { Word32 tmp; Word32 dist; Word16 tmp2; - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16 - dist = L_sub( snsq_fx[j], tmp ); + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 + dist = L_sub( snsq_fx[j], tmp ); // Q16 dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow tmp2 = extract_l( dist ); @@ -783,7 +783,7 @@ Word16 quantize_sns_fx( IF( zero_side_flag[k] ) { set32_fx( snsQ_fx, 0, M ); - CONTINUE; + continue; } nStages = SNS_MSVQ_NSTAGES_SIDE; -- GitLab From f4682bc8978736c28c26fe17b1944c7fc517becb Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 09:19:06 +0100 Subject: [PATCH 178/358] applied the formatting patch. --- lib_enc/ivas_sns_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index c38da5958..cccf25c6b 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -121,8 +121,8 @@ static Word16 sns_1st_cod_fx( Word16 tmp2; tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 - dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow + dist = L_sub( snsq_fx[j], tmp ); // Q16 + dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow tmp2 = extract_l( dist ); dist = L_mult( tmp2, tmp2 ); -- GitLab From ec203c64954af8985ff7be3973c14bd71298c1ed Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 10:59:04 +0100 Subject: [PATCH 179/358] updated the style to the standard of the rest of the code. the magic shifts have been explained. total 150.00 603.963 644.322 631.525 --- lib_enc/ivas_sns_enc_fx.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index cccf25c6b..69398ae7e 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -59,7 +59,7 @@ static Word16 sns_1st_cod_fx( Word32 *snsq_fx /* o : quantized sns Q16 */ ) { - IF( exp_sns == 15 ) + IF( exp_sns == Q15 ) { Word16 index; const Word16 split_len = M / 2; @@ -118,15 +118,12 @@ static Word16 sns_1st_cod_fx( { Word32 tmp; Word32 dist; - Word16 tmp2; - tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12-Q16 + tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12->Q16 dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow - - tmp2 = extract_l( dist ); - dist = L_mult( tmp2, tmp2 ); - dist = L_shr( dist, 4 ); // make sure that the sum does not overflow + dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. + dist = Mpy_32_32( dist, dist ); + dist = L_shr( dist, 3 ); // make sure that the sum of 8 values does not overflow dist_fx = L_add( dist_fx, dist ); } -- GitLab From 56793b3541e5053f09eccdfe95f9d36d40067229 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 17 Mar 2025 11:11:27 +0100 Subject: [PATCH 180/358] applied the clang formatting patch. --- lib_enc/ivas_sns_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 69398ae7e..88c2a5b7c 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -121,7 +121,7 @@ static Word16 sns_1st_cod_fx( tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12->Q16 dist = L_sub( snsq_fx[j], tmp ); // Q16 - dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. + dist = L_shl( dist, 11 ); // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom. dist = Mpy_32_32( dist, dist ); dist = L_shr( dist, 3 ); // make sure that the sum of 8 values does not overflow dist_fx = L_add( dist_fx, dist ); -- GitLab From 869ad0393008c0d7b617f13f692ca463fd837d81 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 19 Mar 2025 11:18:10 +0100 Subject: [PATCH 181/358] continue using CONTINUE instead of continue --- lib_enc/ivas_sns_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 88c2a5b7c..22cd98cad 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -780,7 +780,7 @@ Word16 quantize_sns_fx( IF( zero_side_flag[k] ) { set32_fx( snsQ_fx, 0, M ); - continue; + CONTINUE; } nStages = SNS_MSVQ_NSTAGES_SIDE; -- GitLab From 6d0693316b9506bb18a65e3352a2fdc49a2f5263 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 18 Mar 2025 10:02:06 +0530 Subject: [PATCH 182/358] Fix for 3GPP issue 1384: Decoder crash for Stereo at 16.4kbps in cng_params_upd_ivas_fx() Link #1384 --- lib_com/cng_exc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index aa1ceea81..b314357ad 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -1165,7 +1165,7 @@ void cng_params_upd_ivas_fx( L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); - sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); + sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow ); move32(); /* Q6 */ ptR++; ptI--; -- GitLab From 1591c3ed6e24eb945f29f0ef4b2736f8df630e44 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 19 Mar 2025 12:36:30 +0530 Subject: [PATCH 183/358] Fix for 3GPP issue 1408: Decoder crash for ParamMC 5.1 at 48/64/80 kbps decoding to mono in ivas_ls_setup_conversion_fx() Link #1408 --- lib_dec/ivas_jbm_dec_fx.c | 11 ----------- lib_dec/ivas_mc_param_dec_fx.c | 17 ++++++++++++----- lib_dec/ivas_out_setup_conversion_fx.c | 6 +++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index e7ee06648..1918ce3f3 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1288,18 +1288,7 @@ ivas_error ivas_jbm_dec_tc_fx( test(); IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - s = Q16 - Q11; - move16(); - s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, s ); - } ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); - } } } ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index db56ad03e..b2a8bd30b 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -123,7 +123,7 @@ ivas_error ivas_param_mc_dec_open_fx( Word16 nchan_out_transport; Word16 nchan_out_cov; Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 proto_mtx_norm_fx; + Word32 proto_mtx_norm_fx, tmp32; Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; Word16 max_param_band_residual; UWord16 config_index; @@ -374,20 +374,27 @@ ivas_error ivas_param_mc_dec_open_fx( Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, imult1616( nchan_out_transport, nchan_out_cov ), 4 ); /*Q.26*/ IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { - proto_mtx_norm_fx = ONE_IN_Q26; /*Q26*/ + tmp32 = ONE_IN_Q26; /*Q26*/ move32(); FOR( k = 0; k < nchan_transport * nchan_out_cov; k++ ) { - proto_mtx_norm_fx = L_max( L_abs( proto_mtx_norm_fx ), L_abs( proto_matrix_fx[k] ) ); /*Q.26*/ + tmp32 = L_max( L_abs( tmp32 ), L_abs( proto_matrix_fx[k] ) ); /*Q.26*/ } - proto_mtx_norm_fx = divide3232( ONE_IN_Q26, proto_mtx_norm_fx ); /*Q15*/ + proto_mtx_norm_fx = divide3232( ONE_IN_Q26, tmp32 ); /*Q15*/ /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ FOR( k = 0; k < nchan_transport; k++ ) { FOR( Word16 i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl( Mult_32_16( proto_matrix_fx[k * nchan_out_cov + i], extract_l( proto_mtx_norm_fx ) ), 4 ); /*Q.30*/ + IF( EQ_32( proto_matrix_fx[k * nchan_out_cov + i], tmp32 ) ) + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = ONE_IN_Q30; // Q30 + } + ELSE + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl( Mult_32_16( proto_matrix_fx[k * nchan_out_cov + i], extract_l( proto_mtx_norm_fx ) ), 4 ); /*Q.30*/ + } move32(); } } diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index c7bf0655d..756eed60e 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -586,14 +586,14 @@ void ivas_ls_setup_conversion_fx( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const Word16 input_chans, /* i : number of input channels to the renderer */ const Word16 output_frame, /* i : frame length */ - Word32 *input[], /* i : LS input/output synthesis signal Q16*/ - Word32 *output[] /* i/o: LS input/output synthesis signal Q16*/ + Word32 *input[], /* i : LS input/output synthesis signal Qx*/ + Word32 *output[] /* i/o: LS input/output synthesis signal Qx*/ ) { Word16 chInIdx, chOutIdx, idx; LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; Word32 dmxCoeff, tmpVal; - Word32 output_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // Q16 + Word32 output_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // Qx push_wmops( "LS_Renderer" ); -- GitLab From daf39ebc2fb46799a2c5367e4314fd6335300640 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 15:47:00 +0530 Subject: [PATCH 184/358] Bug fix in CNG_enc_ivas_fx, saturation removal and correction of macro value for MASA path --- lib_com/ivas_cnst.h | 2 +- lib_com/rom_com.c | 15 +++++++++++++++ lib_com/rom_com.h | 19 ++++++++++--------- lib_com/swb_tbe_com_fx.c | 2 +- lib_enc/cng_enc_fx.c | 8 ++++---- lib_enc/swb_tbe_enc_fx.c | 24 ++++++++++++------------ 6 files changed, 43 insertions(+), 27 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2abb790f1..9243b3f50 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1285,7 +1285,7 @@ enum #define MASA_RATIO_THRESHOLD 0.1f #define MASA_ANGLE_TOLERANCE 0.5f #define MASA_RATIO_THRESHOLD_FX 214748365 // 0.1 in Q31 -#define MASA_RATIO_TOLERANCE_FX 214748364/*0.1 Q30*/ +#define MASA_RATIO_TOLERANCE_FX 107374182 // 0.1 in Q30 #define MASA_ANGLE_TOLERANCE_FX ONE_IN_Q21 // 0.5 in Q22 #define MASA_LIMIT_NO_BANDS_SUR_COH 8 #define MINIMUM_BIT_BUDGET_NORMAL_META 100 diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 87b323d0a..e6f392ff0 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -25351,6 +25351,21 @@ const Word16 lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = { 13107, 14746 }; + +const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[LPC_SHB_ORDER] = { + // Q15 + 32767, + 31165, + 26509, + 19262, + 10123, + 0, + -10124, + -19261, + -26509, + -31166, +}; + const Word16 ivas_lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = { /* Q15 */ 1489, diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 10bce5bb2..73156b989 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1504,15 +1504,16 @@ extern const Word16 tab_hup_l_fx[]; // Q15 extern const Word16 mfreq_loc_Q2fx[]; // Q0 extern const Word16 mfreq_loc_div_25[]; // Q0 -extern const Word16 band_len_idx[]; // Q0 -extern const Word16 band_len_ener_shift[]; // Q0 -extern const Word16 fine_gain_pred_sqrt_bw[]; // Q11 -extern const Word16 ivas_band_len_idx[]; // Q0 -extern const Word16 ivas_band_len_ener_shift[]; // Q0 -extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; // Q11 -extern const Word16 Mean_isf_wb[]; // Q2.56 -extern const Word16 lsp_shb_prev_tbl_fx[]; // Q15 -extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; // Q15 +extern const Word16 band_len_idx[]; // Q0 +extern const Word16 band_len_ener_shift[]; // Q0 +extern const Word16 fine_gain_pred_sqrt_bw[]; // Q11 +extern const Word16 ivas_band_len_idx[]; // Q0 +extern const Word16 ivas_band_len_ener_shift[]; // Q0 +extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; // Q11 +extern const Word16 Mean_isf_wb[]; // Q2.56 +extern const Word16 lsp_shb_prev_tbl_fx[]; // Q15 +extern const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[]; // Q15 +extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; // Q15 extern const Word16 tab_ari_qnew[4][4]; // enhancer.c diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 238478b1a..04b6ba187 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -930,7 +930,7 @@ static void Calc_st_filt_tbe_ivas_enc_fx( { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } - g0 = extract_h( L_shl_sat( L_g0, 14 ) ); + g0 = extract_h( L_shl( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index b65d41403..99e99bef7 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1305,19 +1305,19 @@ void CNG_enc_ivas_fx( move16(); BREAK; case L_FRAME32k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME32k_Q31; move16(); BREAK; case L_FRAME16k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME16k_Q31; move16(); BREAK; case L_FRAME8k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME8k_Q31; move16(); BREAK; case L_FRAME4k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME4k_Q31; move16(); BREAK; default: diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index ba8ee5aa8..9b4f15dc5 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -21,7 +21,6 @@ #define ENVSHBRES_ACORR_MIN 40 /* minimum lag for calculating autocorrelation function on SHB residual TD envelope */ #define ENVSHBRES_ACORR_MAX 80 /* maximum lag for calculating autocorrelation function on SHB residual TD envelope */ - /*-----------------------------------------------------------------* * Local functions *-----------------------------------------------------------------*/ @@ -551,7 +550,7 @@ void InitSWBencBuffer_ivas_fx( FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { - hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_fx[i]; + hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_swb_tbe_enc_fx[i]; move16(); } @@ -3109,14 +3108,7 @@ void swb_tbe_enc_ivas_fx( } } - /* stab_check = a2lsp( lsf_shb, lpc_shb, LPC_SHB_ORDER ); - stab_check missing */ - /* LPC to LSP conversion */ - /* LPC: Q12, LSP: Q15 */ - E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); - - /* LSP to LSF conversion */ - /* LSP: Q15, LSF: Q15 */ - E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); + /* stab_check = a2lsp( lsf_shb, lpc_shb, LPC_SHB_ORDER ); */ test(); test(); @@ -3124,8 +3116,8 @@ void swb_tbe_enc_ivas_fx( { FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { - // hBWE_TD->prev_lsp_shb_fx[i] = i / 20.0f; - hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_fx[i]; + // hBWE_TD->prev_lsp_shb_fx[i] = i / 20.0f; // This value in float enc is lsf. + hBWE_TD->prev_lsp_shb_fx[i] = lsp_shb_prev_tbl_swb_tbe_enc_fx[i]; // lsf converted to lsp as fixed enc stores lsp. move16(); } } @@ -3135,6 +3127,14 @@ void swb_tbe_enc_ivas_fx( // mvr2r( hBWE_TD->prev_lsp_shb, lsf_shb, LPC_SHB_ORDER ); // } + /* LPC to LSP conversion */ + /* LPC: Q12, LSP: Q15 */ + E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); + + /* LSP to LSF conversion */ + /* LSP: Q15, LSF: Q15 */ + E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); + Copy( lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); Copy( lsf_shb_fx, lsf_shb_orig_fx, LPC_SHB_ORDER ); -- GitLab From 516b2695912defd25c5952a507b7222e2c6af793 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Mar 2025 15:13:24 +0100 Subject: [PATCH 185/358] add COMPLEXITY/logs folder to artifacts --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91fbd0569..7a28b9871 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1748,6 +1748,7 @@ voip-be-on-merge-request: expire_in: 2 week paths: - $CI_JOB_NAME-public + - COMPLEXITY/logs complexity-stereo-in-stereo-out: extends: -- GitLab From ff1b7531fcd80872adf384296c6a2f639e5f70a3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Mar 2025 16:02:06 +0100 Subject: [PATCH 186/358] remove log folder b4 running COMPLEXITY check this should avoid archiving any old logs in case not all of them are overwritten (e.g. when new modes are added) --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a28b9871..abd8e02ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1741,6 +1741,8 @@ voip-be-on-merge-request: - *update-ltv-repo - *build-float-ref-and-dut-binaries - *complexity-measurements-setup + # delete previous jobs logfiles if present (-f flag ensures return calue of 0 even in first run where this folder is not present) + - rm -rf COMPLEXITY/logs - which coan artifacts: name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" -- GitLab From 1a5211b704558c3b8342995161d61068b4e681ce Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 10:11:14 +0530 Subject: [PATCH 187/358] Fix for 3GPP issue 1409: Stereo Encoder: Differences in DTX for LTV 16 kHz signal Link #1409 --- lib_enc/cng_enc_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 99e99bef7..6c99a4306 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1876,7 +1876,7 @@ void CNG_enc_ivas_fx( { E_LPC_f_lsp_a_conversion( hDtxEnc->lspCNG_fx, Aq, M ); exp = sub( Q14, norm_s( Aq[0] ) ); - Scale_sig( Aq, M, sub( Q12, exp ) ); // Q12 + Scale_sig( Aq, M + 1, sub( Q12, exp ) ); // Q12 } tmp_loop = shr( st_fx->L_frame, 6 ); @@ -1986,19 +1986,19 @@ void CNG_enc_ivas_fx( move16(); BREAK; case L_FRAME32k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME32k_Q31; move16(); BREAK; case L_FRAME16k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME16k_Q31; move16(); BREAK; case L_FRAME8k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME8k_Q31; move16(); BREAK; case L_FRAME4k: - inv_frame_len = ONE_BY_L_FRAME48k_Q31; + inv_frame_len = ONE_BY_L_FRAME4k_Q31; move16(); BREAK; default: -- GitLab From 05c15d809f7b0d956df12413d1c5f2c9ee35fa7e Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 15:53:43 +0100 Subject: [PATCH 188/358] Fix for stereo DMX / PHA mode : Change the resolution and improve the precision of several variables. --- lib_com/options.h | 3 - lib_enc/ivas_stat_enc.h | 9 +- lib_enc/ivas_stereo_dmx_evs_fx.c | 195 ++++++++++++++++++++++++++----- 3 files changed, 175 insertions(+), 32 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5be5d8a48..dab0c796c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,7 +175,4 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ -#define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ -#define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ -#define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 918acc417..c817a0825 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1183,7 +1183,11 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word32 isd_rate_s_fx; // Q31 +#else Word16 isd_rate_s_fx; // Q15 +#endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 @@ -1224,8 +1228,11 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; - +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx; // Q0 +#else Word32 itd_fx; // Q16 +#endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index ae8a8203e..bfb703c94 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -65,12 +65,20 @@ #define Q_BAND_FX 536870912 /*Q31*/ -#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 +#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 +#define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 +#define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 +#define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 +#define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 +#else +#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 +#endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 @@ -153,8 +161,12 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word32 itd[], /* o : estimated itd Q16 */ - const Word16 input_frame /* i : input frame length per channel */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd[], /* o : estimated itd Q0 */ +#else + Word32 itd[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( const Word32 src_fx[], /* i : input signal Q16 */ @@ -196,9 +208,13 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word32 itd_fx[], /* o : estimated itd */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx[], /* o : estimated itd */ +#else + Word32 itd_fx[], /* o : estimated itd */ +#endif + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio */ ); /*-------------------------------------------------------------------* * estimate_itd_wnd_fft() @@ -604,12 +620,21 @@ static void calc_poc_fx( Ni = L_sub( specLi[i], specRi[i] ); // spec_e Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e - // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) + // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) +#else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) +#endif { isd_cnt_h = add( isd_cnt_h, 1 ); } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 + IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 +#else IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) +#endif { isd_cnt_l = add( isd_cnt_l, 1 ); } @@ -618,10 +643,19 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); + move32(); +#else hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); move16(); +#endif +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) +#else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) +#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { @@ -646,7 +680,11 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) +#else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) +#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { @@ -711,11 +749,36 @@ static void calc_poc_fx( FOR( j = 0; j < STEREO_DMX_EVS_SUBBAND_SIZE; ( j++, i++ ) ) { + /* Energy */ + +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + + // Left + W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) + } + tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEl_e[n] ); + move32(); + + // Right + W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); // Q(62-(2*specR_e)) -> Q(63 - ((2*specR_e) +1)) + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); // Q(63 - ((2*spec_e) - (L_tmp_e - 1)) + } + tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); + move32(); +#else tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); move32(); tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); move32(); +#endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e @@ -746,11 +809,35 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + + Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); + Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); + + // eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), 0, &eneL_e ); + W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); + } + eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneL_e ); + + // eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), 0, &eneR_e ); + W_tmp = W_add( W_mult0_32_32( specRr[i], specRr[i] ), W_mult0_32_32( specRi[i], specRi[i] ) ); + L_tmp_e = W_norm( W_tmp ); + IF( L_tmp_e != 0 ) + { + W_tmp = W_shl( W_tmp, L_tmp_e ); + } + eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); +#else Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), shl( spec_e, 1 ), &Ni_e ); eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); +#endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); @@ -768,7 +855,13 @@ static void calc_poc_fx( move32(); Pi[n] = L_add( Mpy_32_32_r( ipd_ff[n], Pi[n] ), Mpy_32_32_r( L_sub( MAX_32, ipd_ff[n] ), tPi ) ); move32(); + // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); + Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); + Pn = Isqrt_lc( Pn, &Pn_e ); +#else L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); L_tmp_e = 1; move16(); @@ -776,6 +869,8 @@ static void calc_poc_fx( Pn_e = L_tmp_e; move16(); Pn = ISqrt32( L_tmp, &Pn_e ); +#endif + Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); Pi[n] = L_shl_sat( Mpy_32_32_r( Pi[n], Pn ), Pn_e ); // Q31 @@ -984,7 +1079,13 @@ static void calc_poc_fx( #ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else + +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 +#else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 +#endif + #endif move32(); } @@ -1015,7 +1116,11 @@ static void calc_poc_fx( energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 +#else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 +#endif move32(); } } @@ -1118,9 +1223,13 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word32 itd_fx[], /* o : estimated itd Q16 */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio Q31 */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd_fx[], /* o : estimated itd Q0 */ +#else + Word32 itd_fx[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) { Word16 itd_cand[CPE_CHANNELS], i, n, cnt[CPE_CHANNELS], Lh, peak_range, *on, *itdLR, prev_off[CPE_CHANNELS], eps_fx; @@ -1430,8 +1539,12 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word32 itd[], /* o : estimated itd Q16 */ - const Word16 input_frame /* i : input frame length per channel */ +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 itd[], /* o : estimated itd Q0 */ +#else + Word32 itd[], /* o : estimated itd Q16 */ +#endif + const Word16 input_frame /* i : input frame length per channel */ ) { Word32 specLr[L_FRAME48k / 2 + 1], specLi[L_FRAME48k / 2 + 1], specRr[L_FRAME48k / 2 + 1], specRi[L_FRAME48k / 2 + 1]; @@ -1938,9 +2051,9 @@ void stereo_dmx_evs_enc_fx( hStereoDmxEVS->dmx_weight_fx, hStereoDmxEVS->pre_dmx_energy_fx, hStereoDmxEVS->pre_dmx_energy_fx_e, hStereoDmxEVS->aux_dmx_energy_fx, hStereoDmxEVS->aux_dmx_energy_fx_e ); // Downscaling signals to avoid accumulation overflows - scale_sig32( data_fx[0], input_frame, -5 ); // Q16->Q11 - scale_sig32( data_fx[1], input_frame, -5 ); // Q16->Q11 - scale_sig32( dmx_poc_data, input_frame, -5 ); // Q16->Q11 + scale_sig32( data_fx[0], input_frame, -5 ); // Q31->Q26 + scale_sig32( data_fx[1], input_frame, -5 ); // Q31->Q26 + scale_sig32( dmx_poc_data, input_frame, -5 ); // Q31->Q26 /* pha */ @@ -1969,9 +2082,11 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_prev_taps[m]; - // fx_tmp = BASOP_Util_Add_Mant32Exp(fx_tmp, fx_tmp_e, Mpy_32_32(p_data_mem[n - m], p_prev_taps[m]),15,&fx_tmp_e); - fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q11 + fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + fx_tmp = L_shl( fx_tmp, 1 ); // Q26 +#endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); move32(); } @@ -1981,7 +2096,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < fad_len; n++ ) { // mem_prev[n] += p_data[n] * INV_SQRT_2; - mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 + mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -1994,10 +2109,13 @@ void stereo_dmx_evs_enc_fx( FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ ) { // ftmp += p_data_mem[n - m] * p_curr_taps[m]; - fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q11 + fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + fx_tmp = L_shl( fx_tmp, 1 ); // Q26 +#endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -2006,7 +2124,7 @@ void stereo_dmx_evs_enc_fx( FOR( n = 0; n < n_samples; n++ ) { // dmx_pha_data[n] += p_data[n] * INV_SQRT_2; - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( p_data[n], INV_SQRT_2_Q31 ) ); // Q26 move32(); } } @@ -2016,7 +2134,7 @@ void stereo_dmx_evs_enc_fx( { dmx_pha_data[n] = Mpy_32_32( dmx_pha_data[n], fad_g[n] ); move32(); - dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q11 + dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( mem_prev[n], fad_g[m] ) ); // Q26 move32(); } @@ -2025,7 +2143,11 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) +#else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) +#endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { @@ -2102,9 +2224,9 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { - p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 + p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); - p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q11 + p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_pha_data[n] ) ); // Q26 move32(); } } @@ -2121,16 +2243,15 @@ void stereo_dmx_evs_enc_fx( FOR( ( n = 0, m = ( fad_len - 1 ) ); n < fad_len; ( n++, m-- ) ) { - p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q11 + p_dmx_data[n] = Mpy_32_32( p_dmx_data[n], fad_g[n] ); // Q26 move32(); - p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q11 + p_dmx_data[n] = L_add( p_dmx_data[n], Mpy_32_32( fad_g[m], dmx_poc_data[n] ) ); // Q26 move32(); } } } - Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q11->Q0 - + Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q26->Q15 return; } @@ -2383,6 +2504,23 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); + hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; + move16(); + IF( EQ_32( input_Fs, 16000 ) ) + { + hStereoDmxEVS->hPHA->win_fx[pha_len - 1] = 7373; /*0.45f in Q14*/ + move16(); + } + ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) + { + hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 2 )] = 19302; /*1.1781f in Q14*/ + move16(); + hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ + move16(); + } +#else trans_len = idiv1616( pha_len, 20 ); set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; @@ -2396,6 +2534,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); move16(); } +#endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); -- GitLab From 52335369cfb04ff88a64b903228b5689c4bfb786 Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 16:48:53 +0100 Subject: [PATCH 189/358] clang-format correction. --- lib_enc/ivas_stat_enc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index c817a0825..19f9a436e 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1184,7 +1184,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure Word16 init_frmCntr; #ifdef FIX_1386_STEREO_DMX_EVS_PHA - Word32 isd_rate_s_fx; // Q31 + Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 #endif @@ -1231,7 +1231,7 @@ typedef struct stereo_dmx_evs_enc_data_structure #ifdef FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else - Word32 itd_fx; // Q16 + Word32 itd_fx; // Q16 #endif Word32 pre_dmx_energy_fx[1]; -- GitLab From 7d123bed506e5e0330996c61b3ac5e9e2ff487ce Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 16:58:01 +0100 Subject: [PATCH 190/358] Useless variable removed. --- lib_enc/ivas_stereo_dmx_evs_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index bfb703c94..e6b6b338f 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -2272,7 +2272,11 @@ ivas_error stereo_dmx_evs_init_encoder_fx( Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; +#ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 *win; +#else Word16 *win, tmp_r; +#endif const Word16 *p_ipd_w; Word16 tmp_e; -- GitLab From 817f786fe481d93cbac99aee4c36b119c30edd8e Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Wed, 12 Mar 2025 17:23:12 +0100 Subject: [PATCH 191/358] Useless variable removed. --- lib_enc/ivas_stereo_dmx_evs_fx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index e6b6b338f..690e0b35e 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -2270,11 +2270,13 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; - Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; - Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; #ifdef FIX_1386_STEREO_DMX_EVS_PHA + Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; + Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; #else + Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; + Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; Word16 *win, tmp_r; #endif const Word16 *p_ipd_w; -- GitLab From 1394fcfe99910683e2983fc50f71aec0e53343a7 Mon Sep 17 00:00:00 2001 From: Arnaud Lefort Date: Tue, 18 Mar 2025 15:30:28 +0100 Subject: [PATCH 192/358] Switch cleaned for fix 1386. --- lib_enc/ivas_stat_enc.h | 4 +-- lib_enc/ivas_stereo_dmx_evs_fx.c | 50 ++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 19f9a436e..ef278d188 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1183,7 +1183,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 #else Word16 isd_rate_s_fx; // Q15 @@ -1228,7 +1228,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 #else Word32 itd_fx; // Q16 diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 690e0b35e..933270c33 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -68,7 +68,7 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 @@ -161,7 +161,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ @@ -208,7 +208,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ #else Word32 itd_fx[], /* o : estimated itd */ @@ -621,7 +621,7 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) #else IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) @@ -629,7 +629,7 @@ static void calc_poc_fx( { isd_cnt_h = add( isd_cnt_h, 1 ); } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 #else @@ -643,7 +643,7 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); #else @@ -651,7 +651,7 @@ static void calc_poc_fx( move16(); #endif -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) #else IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) @@ -680,7 +680,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) #else ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) @@ -752,7 +752,7 @@ static void calc_poc_fx( /* Energy */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) @@ -809,7 +809,7 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); @@ -857,7 +857,7 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); @@ -1076,17 +1076,17 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; -#ifdef FIX_ISSUE_1153 +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 #endif -#endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } @@ -1094,6 +1094,7 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); +#ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #ifdef FIX_ISSUE_1153 Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); IF( shift ) @@ -1103,20 +1104,25 @@ static void calc_poc_fx( move16(); } #endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA + energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); +#else #ifdef FIX_ISSUE_1153 energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); #else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); #endif +#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 #else hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 @@ -1223,7 +1229,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ #else Word32 itd_fx[], /* o : estimated itd Q16 */ @@ -1539,7 +1545,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ #else Word32 itd[], /* o : estimated itd Q16 */ @@ -2084,7 +2090,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); @@ -2111,7 +2117,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 #endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; @@ -2143,7 +2149,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) #else IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) @@ -2270,7 +2276,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; @@ -2510,7 +2516,7 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); -#ifdef FIX_1386_STEREO_DMX_EVS_PHA +#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); -- GitLab From f8db9100fcea5b92a5b5f5ee79ccb7fabdac6789 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 10:39:39 +0100 Subject: [PATCH 193/358] - added some wmops push/pop, - added FIX_xxxx_SPEEDUP_00: not implemented, no bitstream - added FIX_xxxx_SPEEDUP_01: not implemented yet --- lib_com/basop_util.c | 6 +- lib_dec/ivas_jbm_dec_fx.c | 2 +- .../ivas_dirac_dec_binaural_functions_fx.c | 72 +++++++++++++++++-- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index b7ee35ab3..fa8d097df 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1010,6 +1010,7 @@ Word32 div_w( Word32 L_num, Word32 L_den ) } } + Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; @@ -1017,6 +1018,8 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; + //push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); + /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1038,6 +1041,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; + //pop_wmops(); return ( (Word32) 0 ); } @@ -1058,7 +1062,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - + //pop_wmops(); return z; } diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1918ce3f3..ce60c0d65 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1875,7 +1875,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - push_wmops( "ivas_dec_render" ); + push_wmops( "ivas_dec_render (IDR)" ); /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index b5dd1f8b9..8153775b7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,6 +45,9 @@ #include "wmc_auto.h" +//#define FIX_xxxx_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream +//#define FIX_xxxx_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui + Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -504,8 +507,9 @@ void ivas_dirac_dec_binaural_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - + pop_wmops();/*push_wmops( "IDR binaural internal (IDRBI)" );*/ FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -708,6 +712,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } } /* CLDFB Analysis of input */ + push_wmops( "IDRBI CLDFB ANALYSYS" ); FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) @@ -857,6 +862,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } } } + pop_wmops(); /*push_wmops( "IDRBI CLDFB ANALYSYS" );*/ test(); IF( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) @@ -921,7 +927,9 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); + push_wmops( "IDRBI cov matrices" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); + pop_wmops();/*push_wmops( "IDRBI cov matrices" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -959,7 +967,9 @@ static void ivas_dirac_dec_binaural_internal_fx( move16(); } + push_wmops( "IDRBI proc matrices (IRDBI pm)" ); ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); + pop_wmops(); /*push_wmops( "IDRBI proc matrices (IRDBI pm)" );*/ q_inp = Q6; move16(); @@ -1005,8 +1015,10 @@ static void ivas_dirac_dec_binaural_internal_fx( hDiracDecBin->q_processMtxDecPrev = q_mat; move16(); + push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); - + pop_wmops(); /*push_wmops( "IDRBI processOutput" ); + */ hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -1843,6 +1855,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); } + push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" ); FOR( bin = 0; bin < nBins; bin++ ) { Word32 tmpMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain_fx; @@ -1866,6 +1879,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_CrEne = Q31; move16(); + push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" ); IF( GT_16( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ) { hDiracDecBin->ChEne_fx[1][bin] = L_shr( hDiracDecBin->ChEne_fx[1][bin], sub( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ); @@ -1935,7 +1949,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->q_ChCrossOut, prototypeMtx_fx, Mre_fx, Mim_fx, &q_M, hDiracDecBin->reqularizationFactor_fx ); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" );*/ + push_wmops( "IDRBI pm LOOP1 sec B" ); IF( LT_16( hDiracDecBin->q_ChEne, hDiracDecBin->q_ChCross ) ) { CxRe_fx[0][0] = hDiracDecBin->ChEne_fx[0][bin]; @@ -1989,9 +2005,13 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( #endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec B" );*/ + /* When below the frequency limit where decorrelation is applied, we inject the decorrelated * residual (or missing) signal component. The procedure is active when there are not enough independent * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ + + push_wmops( "IDRBI pm LOOP1 sec C" ); IF( LT_16( bin, max_band_decorr ) ) { Word32 decorrelationReductionFactor_fx; @@ -2107,7 +2127,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_Mdec = Q31; move16(); } + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec C" );*/ + push_wmops( "IDRBI pm LOOP1 sec D" ); /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ tmp1 = L_add( CrEneL_fx, CrEneR_fx ); exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); @@ -2198,6 +2220,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_processMtxDec_bin = q_processMtxDec[bin]; move16(); move16(); + /* Store processing matrices */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -2232,7 +2255,10 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); q_processMtxDec[bin] = sub( q_Mdec, 16 ); move16(); + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec D" );*/ + + push_wmops( "IDRBI pm LOOP1 sec E" ); IF( separateCenterChannelRendering ) { /* The rendering of the separate center channel in masa + mono mode. @@ -2322,7 +2348,10 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } + pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec E" );*/ } + pop_wmops(); /*push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" );*/ + /* Aligning Q-factors of all bins in the processing matrices to a common Q-factor */ minimum_s( q_processMtx, nBins, &hDiracDecBin->q_processMtx ); minimum_s( q_processMtxPrev, nBins, &hDiracDecBin->q_processMtxPrev ); @@ -2342,6 +2371,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( minimum_s( q_processMtxDec, nBins, &hDiracDecBin->q_processMtxDec ); minimum_s( q_processMtxDecPrev, nBins, &hDiracDecBin->q_processMtxDecPrev ); + push_wmops( "IRDBI pm LOOP2" ); FOR( bin = 0; bin < nBins; bin++ ) { FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2381,6 +2411,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } + pop_wmops(); /*push_wmops( "IRDBI pm LOOP2" );*/ return; } @@ -4354,7 +4385,9 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4377,9 +4410,12 @@ static void formulate2x2MixingMatrix_fx( Cout_im = Mpy_32_32( Cout_im, maxEneDiv_fx ); q_cout = sub( add( q_cout, q_maxEneDiv ), 31 ); + push_wmops( "formulate2x2MixingMatrix cholesky" ); /* Cholesky decomposition of target / output covariance matrix */ chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix cholesky" );*/ + push_wmops( "formulate2x2MixingMatrix Eigendecomp" ); /* Eigendecomposition of input covariance matrix */ eig2x2_fx( E_in1, E_in2, q_ein, Cin_re, Cin_im, q_cin, Uxre_fx, Uxim_fx, &q_Ux, Sx_fx, &q_Sx ); @@ -4397,7 +4433,9 @@ static void formulate2x2MixingMatrix_fx( move32(); matrixDiagMul_fx( Uxre_fx, Uxim_fx, q_Ux, Sx_fx, q_Sx, Kxre_fx, Kxim_fx, &q_Kx ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Eigendecomp" );*/ + push_wmops( "formulate2x2MixingMatrix RegSMInv" ); /* Regularize the diagonal Sx for matrix inversion */ Sx_fx[0] = L_max( L_shr( Sx_fx[0], 1 ), Mpy_32_16_1( Sx_fx[1], regularizationFactor_fx ) ); Sx_fx[1] = L_max( L_shr( Sx_fx[1], 1 ), L_shl( Mpy_32_16_1( Sx_fx[0], regularizationFactor_fx ), 1 ) ); @@ -4432,8 +4470,9 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp @@ -4469,8 +4508,9 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4487,7 +4527,9 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); + pop_wmops(); + push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" ); /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4513,17 +4555,29 @@ static void formulate2x2MixingMatrix_fx( move32(); } } + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); + push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ + push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ + push_wmops( "oPtoA MT1M" ); +#ifdef FIX_xxxx_SPEEDUP_01 + matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + + eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#endif + pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ IF( D_fx[0] == 0 ) { @@ -4537,8 +4591,10 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); exp = sub( exp, sub( Q30, q_D ) ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); @@ -4555,7 +4611,9 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4657,7 +4715,9 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ #if ( BINAURAL_CHANNELS != 2 ) FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4740,7 +4800,9 @@ static void formulate2x2MixingMatrix_fx( { Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); + pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); @@ -4811,6 +4873,8 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Mre_fx, Mim_fx, q_M ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" );*/ + return; } -- GitLab From 1ab4b454e41d0ab88e1189d667c1a3f38943ccf3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 10:41:26 +0100 Subject: [PATCH 194/358] change names of macros from xxxx to 1326 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 8153775b7..716b16262 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,8 +45,8 @@ #include "wmc_auto.h" -//#define FIX_xxxx_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_xxxx_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui +//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream +//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -4568,7 +4568,7 @@ static void formulate2x2MixingMatrix_fx( /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); -#ifdef FIX_xxxx_SPEEDUP_01 +#ifdef FIX_1326_SPEEDUP_01 matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -- GitLab From f35583b7b5e0cbad554dcd9ee197307a3b158791 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 27 Feb 2025 16:56:36 +0100 Subject: [PATCH 195/358] added and activated FIX_1326_SPEEDUP_00 - 07 --- .../ivas_dirac_dec_binaural_functions_fx.c | 190 +++++++++++++++++- 1 file changed, 182 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 716b16262..d1fb6c23c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,8 +46,13 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : rollout loop in mul, only 3 out of 4 results are needed - maybe a=b can also benefitcui - +#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS +#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -3280,6 +3285,19 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) +#ifdef FIX_1326_SPEEDUP_02 + IF ( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) + { + Ure_fx[0][0] = ONE_IN_Q31; + move32(); + Ure_fx[1][1] = ONE_IN_Q31; + move32(); + *q_U = Q31; + move16(); + + return; + } +#else IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( D_fx[0], *q_D, EPSILON_MANT, EPSILON_EXP ), -1 ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3291,8 +3309,24 @@ static void eig2x2_fx( return; } +#endif /* Numeric case, when input is near an identity matrix with a gain */ +#ifdef FIX_1326_SPEEDUP_03 //178.932 + tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 + + IF( LT_32( pm_fx, L_shl_sat(tmp1, sub(q_tmp1,q_tmp2) ) ) ) + { + Ure_fx[0][0] = ONE_IN_Q30; + move32(); + Ure_fx[1][1] = ONE_IN_Q30; + move32(); + *q_U = Q30; + move16(); + + return; + } +#else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3323,6 +3357,7 @@ static void eig2x2_fx( return; } } +#endif q_U_1 = 0; q_U_2 = 0; @@ -3431,10 +3466,22 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + +#ifdef FIX_1326_SPEEDUP_04 + Word16 exp_tmp2; + Word32 eps_tmp; + + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); + eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); + + tmp3 = L_add( L_shr ( tmp2,1), L_shr(eps_tmp,1) ); // Add Epsilon if relevant + + exp_tmp3 = add(exp_tmp2 , 1); +#else 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 ); +#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); @@ -4387,7 +4434,7 @@ static void formulate2x2MixingMatrix_fx( { push_wmops( "formulate2x2MixingMatrix Division" ); maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4468,6 +4515,28 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE +#ifdef FIX_1326_SPEEDUP_05 + { + Word16 shift = norm_l( temp ); + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); + exp_temp = sub( 31, q_ein ); + if ( temp == 0 ) + { + exp_temp = EPSILON_EXP; + move32(); + } + if (temp == 0) + { + temp = EPSILON_MANT; + move32(); + } + temp = ISqrt32( temp , &exp_temp); + shift = sub( 31, q_eout ); + Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); + move32(); + exp = add( shift, exp_temp ); + } +#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4478,6 +4547,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } +#endif #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4506,16 +4576,36 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE +#ifdef FIX_1326_SPEEDUP_06 + { + Word16 shift = norm_l( temp ); + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); + exp_temp = sub(31, q_ein); + if ( temp == 0 ) + { + exp_temp = add( 0, EPSILON_EXP ); + } + if (temp == 0) + { + temp = L_add( 0, EPSILON_MANT ); + } + temp = ISqrt32( temp, &exp_temp ); + shift = sub( 31, q_eout ); + Ghat_fx[1] = Mpy_32_32( temp, ISqrt32( E_out2, &shift ) ); + exp_temp = add( shift, exp_temp ); + } +#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } +#endif #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4555,21 +4645,86 @@ static void formulate2x2MixingMatrix_fx( move32(); } } - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); #ifdef FIX_1326_SPEEDUP_01 - matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); + + { + Word16 chA, chB; + { + chA = 0, chB = 0; + tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), + Are_fx[1][0], Are_fx[1][0] ), + Aim_fx[0][0], Aim_fx[0][0] ), + Aim_fx[1][0], Aim_fx[1][0] ); + move32(); + } + { + chA = 0, chB = 1; + tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), + Are_fx[1][1], Are_fx[1][0] ), + Aim_fx[0][1], Aim_fx[0][0] ), + Aim_fx[1][1], Aim_fx[1][0] ); + move32(); + tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), + Are_fx[1][1], Aim_fx[1][0] ), + Aim_fx[0][1], Are_fx[0][0] ), + Aim_fx[1][1], Are_fx[1][0] ); + move32(); + } + { + chA = 1, chB = 0; + tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), + Are_fx[1][1], Are_fx[1][1] ), + Aim_fx[0][1], Aim_fx[0][1] ), + Aim_fx[1][1], Aim_fx[1][1] ); + move32(); + } + { + chA = 1, chB = 1; + } + + q_temp = sub( add( q_A, q_A ), 31 ); + + move16(); + Word16 ZeroState = add( 1, 0 ); + if (tmpRe_fx[0][0] != 0) + { + ZeroState = add(0, 0); + } + if ( tmpRe_fx[1][1] != 0 ) + { + ZeroState = add( 0, 0 ); + } + if ( tmpRe_fx[1][0] != 0 ) + { + ZeroState = add( 0, 0 ); + } + if ( tmpIm_fx[1][0] != 0 ) + { + ZeroState = add( 0, 0 ); + } + + if ( sub(ZeroState,1) == 0 ) + { + q_temp = Q31; + move16(); + } + + } + eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); #else @@ -4579,6 +4734,24 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ +#ifdef FIX_1326_SPEEDUP_07 + IF( D_fx[0] == 0 ) + { + //temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + //exp = ONE_DIV_EPSILON_EXP; + div_fx[0] = L_add(0,2047986068); //Sqrt32( temp, &exp ); // Q = 31 - exp + exp = add(0,20); + } + ELSE + { + exp = sub( 31, q_D ); + div_fx[0] = ISqrt32( D_fx[0], &exp ); + //temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + //exp = sub( exp, sub( Q30, q_D ) ); + //div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); + } +#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4598,6 +4771,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); +#endif IF( D_fx[1] == 0 ) { -- GitLab From 53b1831e4ce530c0d8939abe31b35b684f04979f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 16:32:41 +0100 Subject: [PATCH 196/358] apply clang patch --- lib_com/basop_util.c | 6 +- .../ivas_dirac_dec_binaural_functions_fx.c | 139 +++++++++--------- 2 files changed, 72 insertions(+), 73 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index fa8d097df..609ca234d 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1018,7 +1018,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; - //push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); + // push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1041,7 +1041,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; - //pop_wmops(); + // pop_wmops(); return ( (Word32) 0 ); } @@ -1062,7 +1062,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - //pop_wmops(); + // pop_wmops(); return z; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index d1fb6c23c..577ee62f7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -514,7 +514,7 @@ void ivas_dirac_dec_binaural_render_fx( Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - pop_wmops();/*push_wmops( "IDR binaural internal (IDRBI)" );*/ + pop_wmops(); /*push_wmops( "IDR binaural internal (IDRBI)" );*/ FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -934,7 +934,7 @@ static void ivas_dirac_dec_binaural_internal_fx( test(); push_wmops( "IDRBI cov matrices" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops();/*push_wmops( "IDRBI cov matrices" );*/ + pop_wmops(); /*push_wmops( "IDRBI cov matrices" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -1023,7 +1023,7 @@ static void ivas_dirac_dec_binaural_internal_fx( push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); pop_wmops(); /*push_wmops( "IDRBI processOutput" ); - */ + */ hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -3286,7 +3286,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) #ifdef FIX_1326_SPEEDUP_02 - IF ( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) + IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; move32(); @@ -3312,20 +3312,20 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 //178.932 +#ifdef FIX_1326_SPEEDUP_03 // 178.932 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 - IF( LT_32( pm_fx, L_shl_sat(tmp1, sub(q_tmp1,q_tmp2) ) ) ) - { - Ure_fx[0][0] = ONE_IN_Q30; - move32(); - Ure_fx[1][1] = ONE_IN_Q30; - move32(); - *q_U = Q30; - move16(); + IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) + { + Ure_fx[0][0] = ONE_IN_Q30; + move32(); + Ure_fx[1][1] = ONE_IN_Q30; + move32(); + *q_U = Q30; + move16(); - return; - } + return; + } #else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 @@ -3470,13 +3470,13 @@ static void eig2x2_fx( #ifdef FIX_1326_SPEEDUP_04 Word16 exp_tmp2; Word32 eps_tmp; - + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); - tmp3 = L_add( L_shr ( tmp2,1), L_shr(eps_tmp,1) ); // Add Epsilon if relevant + tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); // Add Epsilon if relevant - exp_tmp3 = add(exp_tmp2 , 1); + exp_tmp3 = add( exp_tmp2, 1 ); #else tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); q_tmp2 = sub( 31, q_tmp2 ); @@ -4525,17 +4525,17 @@ static void formulate2x2MixingMatrix_fx( exp_temp = EPSILON_EXP; move32(); } - if (temp == 0) + if ( temp == 0 ) { temp = EPSILON_MANT; move32(); } - temp = ISqrt32( temp , &exp_temp); + temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); move32(); exp = add( shift, exp_temp ); - } + } #else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); @@ -4580,12 +4580,12 @@ static void formulate2x2MixingMatrix_fx( { Word16 shift = norm_l( temp ); temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub(31, q_ein); + exp_temp = sub( 31, q_ein ); if ( temp == 0 ) { exp_temp = add( 0, EPSILON_EXP ); } - if (temp == 0) + if ( temp == 0 ) { temp = L_add( 0, EPSILON_MANT ); } @@ -4663,46 +4663,46 @@ static void formulate2x2MixingMatrix_fx( { Word16 chA, chB; - { + { chA = 0, chB = 0; - tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), - Are_fx[1][0], Are_fx[1][0] ), - Aim_fx[0][0], Aim_fx[0][0] ), - Aim_fx[1][0], Aim_fx[1][0] ); - move32(); - } - { - chA = 0, chB = 1; - tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), - Are_fx[1][1], Are_fx[1][0] ), - Aim_fx[0][1], Aim_fx[0][0] ), - Aim_fx[1][1], Aim_fx[1][0] ); - move32(); - tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), - Are_fx[1][1], Aim_fx[1][0] ), - Aim_fx[0][1], Are_fx[0][0] ), - Aim_fx[1][1], Are_fx[1][0] ); - move32(); - } - { - chA = 1, chB = 0; - tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), - Are_fx[1][1], Are_fx[1][1] ), - Aim_fx[0][1], Aim_fx[0][1] ), - Aim_fx[1][1], Aim_fx[1][1] ); - move32(); - } - { - chA = 1, chB = 1; - } + tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), + Are_fx[1][0], Are_fx[1][0] ), + Aim_fx[0][0], Aim_fx[0][0] ), + Aim_fx[1][0], Aim_fx[1][0] ); + move32(); + } + { + chA = 0, chB = 1; + tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), + Are_fx[1][1], Are_fx[1][0] ), + Aim_fx[0][1], Aim_fx[0][0] ), + Aim_fx[1][1], Aim_fx[1][0] ); + move32(); + tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), + Are_fx[1][1], Aim_fx[1][0] ), + Aim_fx[0][1], Are_fx[0][0] ), + Aim_fx[1][1], Are_fx[1][0] ); + move32(); + } + { + chA = 1, chB = 0; + tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), + Are_fx[1][1], Are_fx[1][1] ), + Aim_fx[0][1], Aim_fx[0][1] ), + Aim_fx[1][1], Aim_fx[1][1] ); + move32(); + } + { + chA = 1, chB = 1; + } q_temp = sub( add( q_A, q_A ), 31 ); move16(); Word16 ZeroState = add( 1, 0 ); - if (tmpRe_fx[0][0] != 0) + if ( tmpRe_fx[0][0] != 0 ) { - ZeroState = add(0, 0); + ZeroState = add( 0, 0 ); } if ( tmpRe_fx[1][1] != 0 ) { @@ -4717,12 +4717,11 @@ static void formulate2x2MixingMatrix_fx( ZeroState = add( 0, 0 ); } - if ( sub(ZeroState,1) == 0 ) + if ( sub( ZeroState, 1 ) == 0 ) { - q_temp = Q31; + q_temp = Q31; move16(); } - } @@ -4732,23 +4731,23 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); #endif - pop_wmops();/*push_wmops( "oPtoA MT1M" );*/ + pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ #ifdef FIX_1326_SPEEDUP_07 IF( D_fx[0] == 0 ) { - //temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - //exp = ONE_DIV_EPSILON_EXP; - div_fx[0] = L_add(0,2047986068); //Sqrt32( temp, &exp ); // Q = 31 - exp - exp = add(0,20); + // temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + // exp = ONE_DIV_EPSILON_EXP; + div_fx[0] = L_add( 0, 2047986068 ); // Sqrt32( temp, &exp ); // Q = 31 - exp + exp = add( 0, 20 ); } ELSE { exp = sub( 31, q_D ); div_fx[0] = ISqrt32( D_fx[0], &exp ); - //temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - //exp = sub( exp, sub( Q30, q_D ) ); - //div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + // temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + // exp = sub( exp, sub( Q30, q_D ) ); + // div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); } #else @@ -4787,7 +4786,7 @@ static void formulate2x2MixingMatrix_fx( { push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4889,7 +4888,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ @@ -4976,7 +4975,7 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); - pop_wmops();/*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); -- GitLab From 08deb10bdc6ee2f4688cec4b2e10293c5fa7ba19 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:04:07 +0100 Subject: [PATCH 197/358] added FIX_1326_SPEEDUP_08 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 577ee62f7..2dac2b867 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,6 +53,7 @@ #define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS #define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS #define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4772,6 +4773,20 @@ static void formulate2x2MixingMatrix_fx( move32(); #endif +#ifdef FIX_1326_SPEEDUP_08 + // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster + { + div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 + exp1 = add( 0, 20 ); // move32(); + } + + IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt + { + exp1 = sub( 31, q_D ); + div_fx[1] = ISqrt32( D_fx[1], &exp1 ); + move32(); + } +#else IF( D_fx[1] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4791,7 +4806,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 move32(); - +#endif q_div = sub( 31, s_max( exp, exp1 ) ); div_fx[0] = L_shr( div_fx[0], sub( sub( 31, exp ), q_div ) ); // q_div -- GitLab From 55f867a1af26a4153aafe537ae6c1294552ed7c5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:07:26 +0100 Subject: [PATCH 198/358] fixed warning --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 2dac2b867..7c243d7d8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3770,6 +3770,7 @@ static void matrixMul_fx( return; } +#ifndef FIX_1326_SPEEDUP_01 static void matrixTransp1Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -3883,6 +3884,7 @@ static void matrixTransp1Mul_fx( return; } +#endif /*FIX_1326_SPEEDUP_01*/ static void matrixTransp2Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4663,7 +4665,7 @@ static void formulate2x2MixingMatrix_fx( // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); { - Word16 chA, chB; + //Word16 chA, chB; { chA = 0, chB = 0; tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), @@ -4673,7 +4675,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 0, chB = 1; + //chA = 0, chB = 1; tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), Are_fx[1][1], Are_fx[1][0] ), Aim_fx[0][1], Aim_fx[0][0] ), @@ -4686,7 +4688,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 1, chB = 0; + //chA = 1, chB = 0; tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), Are_fx[1][1], Are_fx[1][1] ), Aim_fx[0][1], Aim_fx[0][1] ), @@ -4694,7 +4696,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - chA = 1, chB = 1; + //chA = 1, chB = 1; } q_temp = sub( add( q_A, q_A ), 31 ); -- GitLab From 187febb7fb8d24325911889c5441f6373ec3f5e2 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 4 Mar 2025 17:11:02 +0100 Subject: [PATCH 199/358] apply clang patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7c243d7d8..1544b4f1a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4665,7 +4665,7 @@ static void formulate2x2MixingMatrix_fx( // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); { - //Word16 chA, chB; + // Word16 chA, chB; { chA = 0, chB = 0; tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), @@ -4675,7 +4675,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 0, chB = 1; + // chA = 0, chB = 1; tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), Are_fx[1][1], Are_fx[1][0] ), Aim_fx[0][1], Aim_fx[0][0] ), @@ -4688,7 +4688,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 1, chB = 0; + // chA = 1, chB = 0; tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), Are_fx[1][1], Are_fx[1][1] ), Aim_fx[0][1], Aim_fx[0][1] ), @@ -4696,7 +4696,7 @@ static void formulate2x2MixingMatrix_fx( move32(); } { - //chA = 1, chB = 1; + // chA = 1, chB = 1; } q_temp = sub( add( q_A, q_A ), 31 ); -- GitLab From 3029cb4d6b89ab8eff9b6115e57344f9981c9946 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 09:26:29 +0100 Subject: [PATCH 200/358] activated SPEEDUP8 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 1544b4f1a..f024f53ba 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,14 +46,14 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS -#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS +//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs +//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs! Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- -- GitLab From 13aaba5d9f609e048bdcdf102eaab5be8573b3ad Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 11:13:06 +0100 Subject: [PATCH 201/358] activate SPEEDUP 07 small version --- .../ivas_dirac_dec_binaural_functions_fx.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f024f53ba..c452437f1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -52,8 +52,8 @@ //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS //#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs! +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs , no replacement of divSqrt +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4746,12 +4746,18 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32( D_fx[0], &exp ); - // temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - // exp = sub( exp, sub( Q30, q_D ) ); - // div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp +#if 1 //old code + push_wmops( "formulate2x2MixingMatrix Division" ); + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + exp = sub( exp, sub( Q30, q_D ) ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); +#else + exp = sub(31, q_D); + div_fx[0] = ISqrt32_2( D_fx[0], &exp ); move32(); +#endif } #else IF( D_fx[0] == 0 ) -- GitLab From 22c89e001bfb9427c4d97c0413a80163f57d723c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 11:18:14 +0100 Subject: [PATCH 202/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index c452437f1..1e37860c9 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4746,18 +4746,18 @@ static void formulate2x2MixingMatrix_fx( } ELSE { -#if 1 //old code +#if 1 // old code push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); #else - exp = sub(31, q_D); + exp = sub( 31, q_D ); div_fx[0] = ISqrt32_2( D_fx[0], &exp ); move32(); -#endif +#endif } #else IF( D_fx[0] == 0 ) -- GitLab From d8ff057a51e3e22604ffb296cdd1bca905918765 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 12:22:09 +0100 Subject: [PATCH 203/358] activated speedup 01 02 03 04 --- .../ivas_dirac_dec_binaural_functions_fx.c | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 1e37860c9..06b5be3ee 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,14 +46,14 @@ #include "wmc_auto.h" //#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -//#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 2.8 WMOPS //Big DIffs , no replacement of divSqrt -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! +#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE +#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4521,8 +4521,12 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_05 { Word16 shift = norm_l( temp ); +#if 1 // oldcode + temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); +#else + temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31, q_ein ); + exp_temp = sub( 30, q_ein ); if ( temp == 0 ) { exp_temp = EPSILON_EXP; @@ -4533,6 +4537,7 @@ static void formulate2x2MixingMatrix_fx( temp = EPSILON_MANT; move32(); } +#endif temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); @@ -4582,8 +4587,11 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_06 { Word16 shift = norm_l( temp ); +#if 0 //oldcode + temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); +#else temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31, q_ein ); + exp_temp = sub( 31 - 1, q_ein ); if ( temp == 0 ) { exp_temp = add( 0, EPSILON_EXP ); @@ -4592,10 +4600,22 @@ static void formulate2x2MixingMatrix_fx( { temp = L_add( 0, EPSILON_MANT ); } +#endif +#if 1 //oldcode - new code introduces too much noise + push_wmops( "formulate2x2MixingMatrix Division" ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ + exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); +#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC + Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 +#endif +#else temp = ISqrt32( temp, &exp_temp ); shift = sub( 31, q_eout ); - Ghat_fx[1] = Mpy_32_32( temp, ISqrt32( E_out2, &shift ) ); - exp_temp = add( shift, exp_temp ); + Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); + exp1 = add( shift, exp_temp ); +#endif + } #else { -- GitLab From 84ba37670d88e4552d717dc88ebdb681121b95b8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 12:35:34 +0100 Subject: [PATCH 204/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 06b5be3ee..5fcc8a2d1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -54,6 +54,7 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE #define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE +#define FIX_1326_SPEEDUP_09 // Relocate matrixMul Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -4587,7 +4588,7 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_06 { Word16 shift = norm_l( temp ); -#if 0 //oldcode +#if 0 // oldcode temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); #else temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); @@ -4601,7 +4602,7 @@ static void formulate2x2MixingMatrix_fx( temp = L_add( 0, EPSILON_MANT ); } #endif -#if 1 //oldcode - new code introduces too much noise +#if 1 // oldcode - new code introduces too much noise push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ @@ -4614,8 +4615,7 @@ static void formulate2x2MixingMatrix_fx( shift = sub( 31, q_eout ); Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); exp1 = add( shift, exp_temp ); -#endif - +#endif } #else { @@ -4749,10 +4749,17 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); +#ifdef FIX_1326_SPEEDUP_09 + matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif #else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); + +#ifdef FIX_1326_SPEEDUP_09 + matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4860,7 +4867,9 @@ static void formulate2x2MixingMatrix_fx( move16(); } +#ifndef FIX_1326_SPEEDUP_09 matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); +#endif exp = L_norm_arr( div_fx, BINAURAL_CHANNELS ); scale_sig32( div_fx, BINAURAL_CHANNELS, exp ); -- GitLab From ed23bfb94952e39a5e4826aef8e3831012b6749f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 14:30:57 +0100 Subject: [PATCH 205/358] activate speedup 09 10 11 for testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 80 ++++++++++++++----- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 5fcc8a2d1..e99cb6b34 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,16 +45,25 @@ #include "wmc_auto.h" -//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence in current bitstream -#define FIX_1326_SPEEDUP_01 // optimize matrixTransp1Mul_fx -> eig2x2_fx : .4 WMOPS -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs -- > DONT USE -#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // ? WMOPS //Big DIffs , no replacement of divSqrt , PIPELINE GREEN, --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs, PIPELINE GREEN! -- > USE -#define FIX_1326_SPEEDUP_09 // Relocate matrixMul +// MHZ NUMBERS: +// NULL: 179.292 + + +//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence --> DONT USE +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE +//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS +//#define FIX_1326_SPEEDUP_14 // Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -2142,6 +2151,14 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); +#ifdef FIX_1326_SPEEDUP_11 + { + Word16 shift1 = s_max( 0, sub( q_tmp2, q_CrEne ) ); + Word16 shift2 = s_max( 0, sub( q_CrEne, q_tmp2 ) ); + realizedOutputEne_fx = L_add( L_shr( tmp1, shift2 ), L_shr( tmp2, shift1 ) ); + q_realizedOutputEne = s_min( q_CrEne, q_tmp2 ); + } +#else IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2154,7 +2171,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_realizedOutputEne = q_tmp2; move16(); } - +#endif exp = sub( get_min_scalefactor( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_fx[1][bin] ), 1 ); targetOutputEne_fx = L_add( L_shl( hDiracDecBin->ChEneOut_fx[0][bin], exp ), L_shl( hDiracDecBin->ChEneOut_fx[1][bin], exp ) ); q_targetOutputEne = add( hDiracDecBin->q_ChEneOut, exp ); @@ -2177,9 +2194,17 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_missingOutputEne = q_targetOutputEne; move16(); } - tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); +#ifdef FIX_1326_SPEEDUP_13 + { + Word16 exp_temp; + tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + tmp2 = ISqrt32( tmp2, &exp_temp ); + gain_fx = Mpy_32_32(tmp2, Sqrt32(tmp1, &exp1)); + q_gain = sub( 31, add( exp_temp, exp1 ) ); + } +#else { Word16 exp_temp; tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); @@ -2188,6 +2213,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } gain_fx = Sqrt32( tmp2, &exp2 ); q_gain = sub( 31, exp2 ); +#endif + // 1073741824 = 4 in Q28 IF( LT_16( q_gain, Q28 ) ) @@ -4749,17 +4776,11 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#ifdef FIX_1326_SPEEDUP_09 - matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif #else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#ifdef FIX_1326_SPEEDUP_09 - matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4849,7 +4870,19 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = L_shr( div_fx[1], sub( sub( 31, exp1 ), q_div ) ); // q_div move32(); + // 1310720000 = 10,000.0f in Q17 +#ifdef FIX_1326_SPEEDUP_09 + { + Word16 shift1 = s_max( sub( Q17, q_div ), 0 ); + Word16 shift2 = s_max( sub( q_div, Q17 ), 0 ); + + div_fx[0] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[0], shift2 ) ); // q_div + move32(); + div_fx[1] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[1], shift2 ) ); // q_div + move32(); + } +#else IF( LT_16( q_div, Q17 ) ) { div_fx[0] = L_min( L_shr( 1310720000, sub( Q17, q_div ) ), div_fx[0] ); // q_div @@ -4866,10 +4899,9 @@ static void formulate2x2MixingMatrix_fx( q_div = Q17; move16(); } +#endif -#ifndef FIX_1326_SPEEDUP_09 matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); -#endif exp = L_norm_arr( div_fx, BINAURAL_CHANNELS ); scale_sig32( div_fx, BINAURAL_CHANNELS, exp ); @@ -4884,7 +4916,11 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpRe_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { +#ifdef FIX_1326_SPEEDUP_10 + hdrm_re[chA][chB] = W_norm( W_tmp ); +#else hdrm_re[chA][chB] = sub( W_norm( W_tmp ), 0 ); +#endif move16(); W_tmp = W_shl( W_tmp, hdrm_re[chA][chB] ); tmpRe_fx[chA][chB] = W_extract_h( W_tmp ); @@ -4901,7 +4937,11 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpIm_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { +#ifdef FIX_1326_SPEEDUP_10 + hdrm_im[chA][chB] = W_norm( W_tmp ); +#else hdrm_im[chA][chB] = sub( W_norm( W_tmp ), 0 ); +#endif move16(); W_tmp = W_shl( W_tmp, hdrm_im[chA][chB] ); tmpIm_fx[chA][chB] = W_extract_h( W_tmp ); -- GitLab From 9f4a6477e7ca13411cb30936b04cb8063fbdd6b0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 14:56:15 +0100 Subject: [PATCH 206/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e99cb6b34..2336151e0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -58,12 +58,12 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS //#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE //#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -//#define FIX_1326_SPEEDUP_14 // +//#define FIX_1326_SPEEDUP_14 // Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -2201,7 +2201,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( Word16 exp_temp; tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); tmp2 = ISqrt32( tmp2, &exp_temp ); - gain_fx = Mpy_32_32(tmp2, Sqrt32(tmp1, &exp1)); + gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); q_gain = sub( 31, add( exp_temp, exp1 ) ); } #else @@ -2214,7 +2214,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( gain_fx = Sqrt32( tmp2, &exp2 ); q_gain = sub( 31, exp2 ); #endif - + // 1073741824 = 4 in Q28 IF( LT_16( q_gain, Q28 ) ) -- GitLab From 28e5f0861d369268d41334c1223c17b2ea83d6fd Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 15:33:23 +0100 Subject: [PATCH 207/358] added assert testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 2336151e0..cc6d977f0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -58,12 +58,12 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -//#define FIX_1326_SPEEDUP_14 // +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -->USE? (pipe coming) +#define FIX_1326_SPEEDUP_14 // test Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -3213,8 +3213,14 @@ static void eig2x2_fx( pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ + #ifdef FIX_1326_SPEEDUP_14 + static int tstcnt = 0; + #endif IF( L_and( c_re == 0, c_im == 0 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt ++; +#endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 pm_fx = 0.5 * sqrt(max(0, a_fx)) = 0.5 * max(0, (e1 - e2)) */ @@ -3232,6 +3238,9 @@ static void eig2x2_fx( q_crossSquare = sub( add( q_c, q_c ), 31 ); IF( EQ_32( e1, e2 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt++; +#endif /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ test(); @@ -3265,6 +3274,9 @@ static void eig2x2_fx( IF( GT_16( sub( q_c, q_e ), Q15 ) ) { +#ifdef FIX_1326_SPEEDUP_14 + tstcnt++; +#endif pm_fx = L_shr( L_max( 0, L_abs( L_sub( e1, e2 ) ) ), 1 ); q_tmp2 = q_e; move16(); @@ -3288,6 +3300,10 @@ static void eig2x2_fx( } } } +#ifdef FIX_1326_SPEEDUP_14 + if (tstcnt>10000) + assert(0); +#endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); q_tmp1 = q_e; @@ -4669,7 +4685,6 @@ static void formulate2x2MixingMatrix_fx( move32(); pop_wmops(); - push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" ); /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -4695,14 +4710,11 @@ static void formulate2x2MixingMatrix_fx( move32(); } } - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/ q_temp = sub( add( q_ky, q_GhatQ ), 31 ); - push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" ); /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/ push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx @@ -4980,7 +4992,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/ + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );*/ push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ -- GitLab From 5bc6b7e7231f8d5c414732810069176823c42576 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 5 Mar 2025 15:35:49 +0100 Subject: [PATCH 208/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index cc6d977f0..c5b3500b2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3213,13 +3213,13 @@ static void eig2x2_fx( pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ - #ifdef FIX_1326_SPEEDUP_14 +#ifdef FIX_1326_SPEEDUP_14 static int tstcnt = 0; - #endif +#endif IF( L_and( c_re == 0, c_im == 0 ) ) { #ifdef FIX_1326_SPEEDUP_14 - tstcnt ++; + tstcnt++; #endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 @@ -3301,8 +3301,8 @@ static void eig2x2_fx( } } #ifdef FIX_1326_SPEEDUP_14 - if (tstcnt>10000) - assert(0); + if ( tstcnt > 10000 ) + assert( 0 ); #endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); -- GitLab From 5a63dbac1775e86223f59bb6aadfec88bcb43757 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 09:52:48 +0100 Subject: [PATCH 209/358] deactivate SPeedup 14, activate Speedup 13 for testing --- .../ivas_dirac_dec_binaural_functions_fx.c | 75 +++++++++++++++---- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index c5b3500b2..ad9769583 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -49,7 +49,6 @@ // NULL: 179.292 -//#define FIX_1326_SPEEDUP_00 //make sqrt(1) a const - catch bitstreams //no occurence --> DONT USE //#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE @@ -58,12 +57,18 @@ //#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE //#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS --> USE? (pipe 48851 fails --> DONTUSEYET) -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS -->DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS -->USE? (pipe coming) -#define FIX_1326_SPEEDUP_14 // test +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) +//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) + + + + Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -943,9 +948,9 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); - push_wmops( "IDRBI cov matrices" ); + push_wmops( "IDRBI cov matrices (IDRBCM)" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops(); /*push_wmops( "IDRBI cov matrices" );*/ + pop_wmops(); /*push_wmops( "IDRBI cov matrices (IDRBCM)" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -1168,7 +1173,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ move16(); - + push_wmops( "IDRBCM inits" ); q_earlyPartEneCorrection = s_min( Q31, add( getScaleFactor32( hDiracDecBin->earlyPartEneCorrection_fx, nBins ), hDiracDecBin->q_earlyPartEneCorrection ) ); scale_sig32( hDiracDecBin->earlyPartEneCorrection_fx, nBins, sub( q_earlyPartEneCorrection, hDiracDecBin->q_earlyPartEneCorrection ) ); hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; @@ -1202,6 +1207,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ move16(); } + pop_wmops(); /*push_wmops( "IDRBCM inits" );*/ /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; @@ -1214,11 +1220,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { + push_wmops( "IDRBCM Determine EQ_low_rates" ); FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 move32(); } + pop_wmops(); /*push_wmops( "IDRBCM Determine EQ_low_rates" );*/ } ELSE { @@ -1237,6 +1245,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric exp = sub( 63, shl( q, 1 ) ); // exp for the energy (inRe_fx * inRe_fx + inIm_fx * inIm_fx) computed below + push_wmops( "IDRBCM input Matrix" ); /* Calculate input covariance matrix */ FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -1271,7 +1280,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); } } + pop_wmops(); /*push_wmops( "IDRBCM input Matrix" );*/ + push_wmops( "IDRBCM apply EQ_low" ); /* Apply EQ at low bit rates */ IF( applyLowBitRateEQ != 0 ) { @@ -1324,7 +1335,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } } + pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ + push_wmops( "IDRBCM target matrix" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1484,12 +1497,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 hrtfEneCenter_fx, hrtfEneSides_fx, hrtfEneRealized_fx; Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; - +#ifdef FIX_1326_SPEEDUP_15 + hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); //Q25 +#else hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 - +#endif /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. * spreadCoh = 0: Only panning @@ -1518,11 +1533,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); - +#ifdef FIX_1326_SPEEDUP_15 + hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 +#else hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 +#endif lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 @@ -1610,12 +1628,21 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); } +#ifdef FIX_1326_SPEEDUP_15 + hrtfEne_fx[0] = Madd_32_32( Mpy_32_32( lRealp_fx, lRealp_fx ), lImagp_fx, lImagp_fx ); // Q( 2*q_lr - 31 ) + hrtfEne_fx[1] = Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) + move32(); + move32(); + hrtfCrossRe_fx = Madd_32_32( Mpy_32_32( lRealp_fx, rRealp_fx ), lImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) + hrtfCrossIm_fx = Madd_32_32( Mpy_32_32( -lImagp_fx, rRealp_fx ), lRealp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) +#else hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) move32(); move32(); hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) +#endif /* Add direct part (1 or 2) covariance matrix */ dirEne_fx = Mpy_32_32( ratio_fx, meanEnePerCh_fx ); // Q(q_meanEnePerCh - 1) @@ -1690,7 +1717,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } ELSE { +#ifdef FIX_1326_SPEEDUP_15 + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( Madd_32_16( L_shl( surCoh_fx, 16 ), hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); +#else hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); +#endif } move32(); } @@ -1706,6 +1737,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } + pop_wmops();/*push_wmops( "IDRBCM target matrix" );*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -3435,10 +3467,25 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + +#ifdef FIX_1326_SPEEDUP_16 + + { + Word16 tmp2_exp; + Word32 eps_tmp; + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); + + //Add epsilon if relevant + eps_tmp = L_shl_sat( epsilon_mant, sub(epsilon_exp, tmp2_exp )); + tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); + + exp_tmp3 = add( tmp2_exp, 1 ); + } +#else 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 ); +#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -- GitLab From 31992274c6aa136f14ca37af5d9bdd9413f46f58 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 09:54:39 +0100 Subject: [PATCH 210/358] deactivate SPeedup 14, activate Speedup 13 for testing --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index ad9769583..620b4e323 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -61,7 +61,7 @@ //#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) //#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) //#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) -- GitLab From b2b27affb27707f75906b1bfbea775a8da70a0d5 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 10:09:06 +0100 Subject: [PATCH 211/358] apply clang format patch --- .../ivas_dirac_dec_binaural_functions_fx.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 620b4e323..7721c3eaa 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -67,8 +67,6 @@ //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) - - Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -1498,12 +1496,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; #ifdef FIX_1326_SPEEDUP_15 - hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); //Q25 + hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); // Q25 #else - hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 - L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 - L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 - Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 #endif /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. @@ -1536,15 +1534,15 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #ifdef FIX_1326_SPEEDUP_15 hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 #else - hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 - L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 - L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 - Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 #endif - lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 - lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 - rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 - rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ @@ -1737,7 +1735,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops();/*push_wmops( "IDRBCM target matrix" );*/ + pop_wmops(); /*push_wmops( "IDRBCM target matrix" );*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -3475,12 +3473,12 @@ static void eig2x2_fx( Word32 eps_tmp; tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); - //Add epsilon if relevant - eps_tmp = L_shl_sat( epsilon_mant, sub(epsilon_exp, tmp2_exp )); + // Add epsilon if relevant + eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, tmp2_exp ) ); tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); exp_tmp3 = add( tmp2_exp, 1 ); - } + } #else tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); q_tmp2 = sub( 31, q_tmp2 ); -- GitLab From 1461021e3412cc39bfa852758c76edeff3ba25b9 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 10:15:25 +0100 Subject: [PATCH 212/358] fix build warning --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7721c3eaa..4db8980e1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1916,7 +1916,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); Word32 tmp1, tmp2, res1, res2; Word16 q_tmp1, q_tmp2, q_realizedOutputEne, q_targetOutputEne, q_missingOutputEne, q_gain; +#ifdef FIX_1326_SPEEDUP_13 + Word16 exp1, q_processMtx_bin, q_processMtxDec_bin; +#else Word16 exp1, exp2, q_processMtx_bin, q_processMtxDec_bin; +#endif CrEneL_fx = 0; move32(); -- GitLab From 0df435dc0501754f7af9b1d8248813bae39ff4df Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Fri, 7 Mar 2025 11:08:02 +0100 Subject: [PATCH 213/358] ctivated speedup 15, 16 to test --- .../ivas_dirac_dec_binaural_functions_fx.c | 118 +----------------- 1 file changed, 6 insertions(+), 112 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 4db8980e1..45e1d2bed 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,18 +53,14 @@ //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_05 // div->sqrt =>isqrt // 3.5 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt // 3.0 WMOPS //Quite bad diffs --> DONT USE -//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt // 0 WMOPS --> DONT USE //#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE //#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET //#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_12 // tiny speedup // <.1 WMOPS --> DONTUSE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE? (pipe tbd) -//#define FIX_1326_SPEEDUP_14 // test wether any of these paths is realy necessary, then assert --> DONTUSE (pipes red, asserts!) -//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -3246,15 +3242,8 @@ static void eig2x2_fx( a_fx = (e1 + e2) * (e1 + e2) - 4.0f * ((e1 * e2) - crossSquare_fx) = (e1 - e2)^2 + 4 * crossSquare_fx pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ - -#ifdef FIX_1326_SPEEDUP_14 - static int tstcnt = 0; -#endif IF( L_and( c_re == 0, c_im == 0 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 pm_fx = 0.5 * sqrt(max(0, a_fx)) = 0.5 * max(0, (e1 - e2)) */ @@ -3272,9 +3261,6 @@ static void eig2x2_fx( q_crossSquare = sub( add( q_c, q_c ), 31 ); IF( EQ_32( e1, e2 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ test(); @@ -3308,9 +3294,6 @@ static void eig2x2_fx( IF( GT_16( sub( q_c, q_e ), Q15 ) ) { -#ifdef FIX_1326_SPEEDUP_14 - tstcnt++; -#endif pm_fx = L_shr( L_max( 0, L_abs( L_sub( e1, e2 ) ) ), 1 ); q_tmp2 = q_e; move16(); @@ -3334,10 +3317,6 @@ static void eig2x2_fx( } } } -#ifdef FIX_1326_SPEEDUP_14 - if ( tstcnt > 10000 ) - assert( 0 ); -#endif // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); q_tmp1 = q_e; @@ -4611,33 +4590,6 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE -#ifdef FIX_1326_SPEEDUP_05 - { - Word16 shift = norm_l( temp ); -#if 1 // oldcode - temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#else - - temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 30, q_ein ); - if ( temp == 0 ) - { - exp_temp = EPSILON_EXP; - move32(); - } - if ( temp == 0 ) - { - temp = EPSILON_MANT; - move32(); - } -#endif - temp = ISqrt32( temp, &exp_temp ); - shift = sub( 31, q_eout ); - Ghat_fx[0] = Mpy_32_32( Sqrt32( E_out1, &shift ), temp ); - move32(); - exp = add( shift, exp_temp ); - } -#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4648,7 +4600,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } -#endif + #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4677,39 +4629,6 @@ static void formulate2x2MixingMatrix_fx( #endif } ELSE -#ifdef FIX_1326_SPEEDUP_06 - { - Word16 shift = norm_l( temp ); -#if 0 // oldcode - temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#else - temp = L_add( L_shl( temp, sub( shift, 1 ) ), L_shl_sat( EPSILON_MANT, sub( sub( EPSILON_EXP, shift ), 1 ) ) ); - exp_temp = sub( 31 - 1, q_ein ); - if ( temp == 0 ) - { - exp_temp = add( 0, EPSILON_EXP ); - } - if ( temp == 0 ) - { - temp = L_add( 0, EPSILON_MANT ); - } -#endif -#if 1 // oldcode - new code introduces too much noise - push_wmops( "formulate2x2MixingMatrix Division" ); - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ - exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif -#else - temp = ISqrt32( temp, &exp_temp ); - shift = sub( 31, q_eout ); - Ghat_fx[1] = Mpy_32_32( temp, Sqrt32( E_out2, &shift ) ); - exp1 = add( shift, exp_temp ); -#endif - } -#else { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); @@ -4720,7 +4639,7 @@ static void formulate2x2MixingMatrix_fx( Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } -#endif + #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4845,30 +4764,6 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ -#ifdef FIX_1326_SPEEDUP_07 - IF( D_fx[0] == 0 ) - { - // temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - // exp = ONE_DIV_EPSILON_EXP; - div_fx[0] = L_add( 0, 2047986068 ); // Sqrt32( temp, &exp ); // Q = 31 - exp - exp = add( 0, 20 ); - } - ELSE - { -#if 1 // old code - push_wmops( "formulate2x2MixingMatrix Division" ); - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); - exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ - div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp - move32(); -#else - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32_2( D_fx[0], &exp ); - move32(); -#endif - } -#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4888,7 +4783,6 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#endif #ifdef FIX_1326_SPEEDUP_08 // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster -- GitLab From 69673ab7ad9c95dcf1627806e09aa357fdebbd90 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:26:44 +0100 Subject: [PATCH 214/358] add SPEEDUP 17, 18, inactive --- .../ivas_dirac_dec_binaural_functions_fx.c | 73 +++++++++++++++---- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 45e1d2bed..3a10590f6 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -49,19 +49,20 @@ // NULL: 179.292 -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE? (pipe tbd) -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .18 WMOPS --> USE? (pipe tbd) - +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? +//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -3343,6 +3344,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) + #ifdef FIX_1326_SPEEDUP_02 IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { @@ -3370,7 +3372,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 // 178.932 +#ifdef FIX_1326_SPEEDUP_03 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) @@ -3469,7 +3471,11 @@ static void eig2x2_fx( #endif #if 1 +#ifdef FIX_1326_SPEEDUP_17 + tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); +#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); +#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3557,7 +3563,11 @@ static void eig2x2_fx( #endif #if 1 +#ifdef FIX_1326_SPEEDUP_17 + tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); +#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); +#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3619,7 +3629,19 @@ static void eig2x2_fx( move16(); } } +#ifdef FIX_1326_SPEEDUP_18 + if( q_U_1 != 0 ) + { + *q_U = q_U_1; + move16(); + } + if (q_U_1 == 0) + { + *q_U = q_U_2; + move16(); + } +#else IF( q_U_1 != 0 ) { *q_U = q_U_1; @@ -3629,6 +3651,7 @@ static void eig2x2_fx( *q_U = q_U_2; } move16(); +#endif return; } @@ -4508,7 +4531,11 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, maxEne_fx, &exp ); +#else maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } @@ -4630,6 +4657,11 @@ static void formulate2x2MixingMatrix_fx( } ELSE { + if ( E_out2 == 0 ) + { + static int a = 0; + a++; + } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); @@ -4777,7 +4809,12 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); +#else + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); +#endif exp = sub( exp, sub( Q30, q_D ) ); pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } @@ -4811,7 +4848,11 @@ static void formulate2x2MixingMatrix_fx( ELSE { push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[1], &exp1 ); +#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } @@ -5021,7 +5062,11 @@ static void formulate2x2MixingMatrix_fx( Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); push_wmops( "formulate2x2MixingMatrix Division" ); +#ifdef FIX_1326_SPEEDUP_17 + temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, temp, &exp ); +#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); +#endif pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); -- GitLab From 3a0cffad0b3aa100c59fde2e9ad9b196ea356718 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:41:59 +0100 Subject: [PATCH 215/358] add modified version of division '1/x' --- lib_com/basop_util.c | 35 +++++++++++++++++++++++++++++++++++ lib_com/basop_util.h | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 609ca234d..0449ff125 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1066,6 +1066,41 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) return z; } +/*1bit HR in x > 0*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) +{ + Word32 z; + //Word16 sx; + Word16 sy; + Word32 sign; + + /* assert (x >= (Word32)0); */ + assert( y != (Word32) 0 ); + + sign = 0; + move16(); + + IF( y < 0 ) + { + y = L_negate( y ); + sign = L_xor( sign, 1 ); + } + + sy = norm_l( y ); + y = L_shl( y, sy ); + move16(); + *s = add( 0, sy ); + move16(); + + z = div_w( x, y ); + + if ( sign != 0 ) + { + z = L_negate( z ); + } + return z; + +} Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { Word16 z; diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index a6db7dc8d..697f0b9c6 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,6 +332,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ + Word32 y, /*!< i : Denominator*/ + + Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! -- GitLab From 3d2baa32087e1f1c306173c1f2e1c42abe211064 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:46:15 +0100 Subject: [PATCH 216/358] applied clang format patch --- lib_com/basop_util.c | 3 +-- lib_com/basop_util.h | 6 +++--- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 0449ff125..5eee369f8 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1070,7 +1070,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) { Word32 z; - //Word16 sx; + // Word16 sx; Word16 sy; Word32 sign; @@ -1099,7 +1099,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) z = L_negate( z ); } return z; - } Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index 697f0b9c6..1ef2cd8e7 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,10 +332,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ - Word32 y, /*!< i : Denominator*/ +Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ + Word32 y, /*!< i : Denominator*/ - Word16 *s ); /*!< o : Additional scalefactor difference*/ + Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 3a10590f6..399ac50ca 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3372,7 +3372,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 +#ifdef FIX_1326_SPEEDUP_03 tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) @@ -3630,13 +3630,13 @@ static void eig2x2_fx( } } #ifdef FIX_1326_SPEEDUP_18 - if( q_U_1 != 0 ) + if ( q_U_1 != 0 ) { *q_U = q_U_1; move16(); } - if (q_U_1 == 0) + if ( q_U_1 == 0 ) { *q_U = q_U_2; move16(); @@ -4812,7 +4812,7 @@ static void formulate2x2MixingMatrix_fx( #ifdef FIX_1326_SPEEDUP_17 temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); #else - + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); #endif exp = sub( exp, sub( Q30, q_D ) ); -- GitLab From a5afdebd29f50e791a8e28b08238d9b3e3a17288 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 08:47:08 +0100 Subject: [PATCH 217/358] activated SPEEDUP 17, 18, for test --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 399ac50ca..682a881cd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -61,8 +61,8 @@ //#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? -//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? +#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From aae527e7587b9c3d377db06797222a69456bfe09 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:35:17 +0100 Subject: [PATCH 218/358] Activate all SPEEDUP macros available and change division 1/x a bit --- lib_com/basop_util.c | 8 +++-- .../ivas_dirac_dec_binaural_functions_fx.c | 35 ++++++++++--------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 5eee369f8..60174c3c9 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1080,12 +1080,16 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) sign = 0; move16(); - IF( y < 0 ) + if( y < 0 ) { - y = L_negate( y ); sign = L_xor( sign, 1 ); } + if ( y < 0 ) + { + y = L_negate( y ); + } + sy = norm_l( y ); y = L_shl( y, sy ); move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 682a881cd..f3e6b54d6 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,23 +46,24 @@ #include "wmc_auto.h" // MHZ NUMBERS: -// NULL: 179.292 - - -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -//#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_17 // use 1/x // 1 WMOPS --> USE? -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE? +// NULL: 178.407 +// ALL: 169.499 + + +#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From 38525c07c62527406c0c04d66a1f95c757d4b736 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 10:33:50 +0100 Subject: [PATCH 219/358] deactivate 1/x macro, activate all others --- lib_com/basop_util.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 60174c3c9..273667255 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1080,7 +1080,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) sign = 0; move16(); - if( y < 0 ) + if ( y < 0 ) { sign = L_xor( sign, 1 ); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f3e6b54d6..333e7603a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -62,7 +62,7 @@ #define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE +//#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE #define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From 45c6f17c7b9c4fa732ce46c2742b0048e55a3d89 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:46:33 +0000 Subject: [PATCH 220/358] revert divison variation --- lib_com/basop_util.c | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 273667255..b7ee35ab3 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1010,7 +1010,6 @@ Word32 div_w( Word32 L_num, Word32 L_den ) } } - Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; @@ -1018,8 +1017,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) Word16 sy; Word32 sign; - // push_wmops( "BASOP_Util_Divide3232_Scale_cadence" ); - /* assert (x >= (Word32)0); */ assert( y != (Word32) 0 ); @@ -1041,7 +1038,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) IF( x == (Word32) 0 ) { *s = 0; - // pop_wmops(); return ( (Word32) 0 ); } @@ -1062,48 +1058,10 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { z = L_negate( z ); } - // pop_wmops(); - return z; -} - -/*1bit HR in x > 0*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, Word32 y, Word16 *s ) -{ - Word32 z; - // Word16 sx; - Word16 sy; - Word32 sign; - /* assert (x >= (Word32)0); */ - assert( y != (Word32) 0 ); - - sign = 0; - move16(); - - if ( y < 0 ) - { - sign = L_xor( sign, 1 ); - } - - if ( y < 0 ) - { - y = L_negate( y ); - } - - sy = norm_l( y ); - y = L_shl( y, sy ); - move16(); - *s = add( 0, sy ); - move16(); - - z = div_w( x, y ); - - if ( sign != 0 ) - { - z = L_negate( z ); - } return z; } + Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { Word16 z; -- GitLab From b372178a2c4a1c77cc6c3f08fc81a442ba894dae Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 09:47:44 +0000 Subject: [PATCH 221/358] more revert division variation --- lib_com/basop_util.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index 1ef2cd8e7..a6db7dc8d 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -332,10 +332,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word32 y, /*!< i : Denominator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ -Word32 BASOP_Util_Divide3232_Scale_cadence_1( Word32 x, /*!< i : Numerator*/ - Word32 y, /*!< i : Denominator*/ - - Word16 *s ); /*!< o : Additional scalefactor difference*/ /************************************************************************/ /*! -- GitLab From 6ba452cc2c2961151899e7a4b230ff5d0a18e621 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 11:51:31 +0100 Subject: [PATCH 222/358] cleanup useless speedup macros --- .../ivas_dirac_dec_binaural_functions_fx.c | 123 +++--------------- 1 file changed, 15 insertions(+), 108 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 333e7603a..8da4f82e7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -47,22 +47,16 @@ // MHZ NUMBERS: // NULL: 178.407 -// ALL: 169.499 +// ALL: 169.499 77 (170.650 wo 17) #define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE #define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_03 // speedup eig2x2_fx // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_09 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -#define FIX_1326_SPEEDUP_10 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET -#define FIX_1326_SPEEDUP_11 // tiny speedup // .1 WMOPS pipe 48851 fails --> DONTUSEYET #define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE -#define FIX_1326_SPEEDUP_15 // replace Ladd(Mpy) -> Madd // .1 WMOPS --> USE #define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_17 // use 1/x // 1.25WMOPS --> USE #define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -1333,7 +1327,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ - push_wmops( "IDRBCM target matrix" ); + push_wmops( "IDRBCM target matrix (IDRBCMtm)" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1359,6 +1353,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( q_meanEnePerCh ) q_meanEnePerCh = add( sub( q_earlyPartEneCorrection, subFrameTotalEne_e[bin] ), 1 ); // q_earlyPartEneCorrection + 31 - subFrameTotalEne_e[bin] - 31 + Q1(0.5f) /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + push_wmops( "IDRBCMtm LOOP1" ); FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { Word16 aziDeg, eleDeg; @@ -1437,6 +1432,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness_fx = 0; move32(); } + IF( isIsmDirection ) { /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ @@ -1446,7 +1442,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, ratio_fx ); /*Q30*/ } - IF( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -1493,14 +1488,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 hrtfEneCenter_fx, hrtfEneSides_fx, hrtfEneRealized_fx; Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; -#ifdef FIX_1326_SPEEDUP_15 - hrtfEneCenter_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ), lImagp_fx, lImagp_fx ), lRealp_fx, lRealp_fx ); // Q25 -#else + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 -#endif + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. * spreadCoh = 0: Only panning @@ -1529,14 +1522,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); -#ifdef FIX_1326_SPEEDUP_15 - hrtfEneSides_fx = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), rImagpTmp_fx, rImagpTmp_fx ), lImagpTmp_fx, lImagpTmp_fx ), lRealpTmp_fx, lRealpTmp_fx ); // Q25 -#else + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 -#endif + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 @@ -1624,21 +1615,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); } -#ifdef FIX_1326_SPEEDUP_15 - hrtfEne_fx[0] = Madd_32_32( Mpy_32_32( lRealp_fx, lRealp_fx ), lImagp_fx, lImagp_fx ); // Q( 2*q_lr - 31 ) - hrtfEne_fx[1] = Madd_32_32( Mpy_32_32( rRealp_fx, rRealp_fx ), rImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) - move32(); - move32(); - hrtfCrossRe_fx = Madd_32_32( Mpy_32_32( lRealp_fx, rRealp_fx ), lImagp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) - hrtfCrossIm_fx = Madd_32_32( Mpy_32_32( -lImagp_fx, rRealp_fx ), lRealp_fx, rImagp_fx ); // Q( 2*q_lr - 31 ) -#else hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) move32(); move32(); hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) -#endif /* Add direct part (1 or 2) covariance matrix */ dirEne_fx = Mpy_32_32( ratio_fx, meanEnePerCh_fx ); // Q(q_meanEnePerCh - 1) @@ -1655,6 +1637,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } + pop_wmops(); //push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 @@ -1713,11 +1696,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } ELSE { -#ifdef FIX_1326_SPEEDUP_15 - hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( Madd_32_16( L_shl( surCoh_fx, 16 ), hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); -#else hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); -#endif } move32(); } @@ -1733,7 +1712,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM target matrix" );*/ + pop_wmops(); /*push_wmops( "IDRBCM target matrix (IDRBCMtm)" );;*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -2183,14 +2162,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); -#ifdef FIX_1326_SPEEDUP_11 - { - Word16 shift1 = s_max( 0, sub( q_tmp2, q_CrEne ) ); - Word16 shift2 = s_max( 0, sub( q_CrEne, q_tmp2 ) ); - realizedOutputEne_fx = L_add( L_shr( tmp1, shift2 ), L_shr( tmp2, shift1 ) ); - q_realizedOutputEne = s_min( q_CrEne, q_tmp2 ); - } -#else + IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2203,7 +2175,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_realizedOutputEne = q_tmp2; move16(); } -#endif + exp = sub( get_min_scalefactor( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_fx[1][bin] ), 1 ); targetOutputEne_fx = L_add( L_shl( hDiracDecBin->ChEneOut_fx[0][bin], exp ), L_shl( hDiracDecBin->ChEneOut_fx[1][bin], exp ) ); q_targetOutputEne = add( hDiracDecBin->q_ChEneOut, exp ); @@ -3373,21 +3345,7 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ -#ifdef FIX_1326_SPEEDUP_03 - tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 - IF( LT_32( pm_fx, L_shl_sat( tmp1, sub( q_tmp1, q_tmp2 ) ) ) ) - { - Ure_fx[0][0] = ONE_IN_Q30; - move32(); - Ure_fx[1][1] = ONE_IN_Q30; - move32(); - *q_U = Q30; - move16(); - - return; - } -#else tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3418,7 +3376,6 @@ static void eig2x2_fx( return; } } -#endif q_U_1 = 0; q_U_2 = 0; @@ -3472,11 +3429,7 @@ static void eig2x2_fx( #endif #if 1 -#ifdef FIX_1326_SPEEDUP_17 - tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); -#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3564,11 +3517,7 @@ static void eig2x2_fx( #endif #if 1 -#ifdef FIX_1326_SPEEDUP_17 - tmp2 = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, tmp3, &exp ); -#else tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); -#endif exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -4531,13 +4480,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, maxEne_fx, &exp ); -#else maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4620,9 +4563,7 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp @@ -4664,9 +4605,7 @@ static void formulate2x2MixingMatrix_fx( a++; } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4797,6 +4736,7 @@ static void formulate2x2MixingMatrix_fx( #endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ + IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4804,20 +4744,15 @@ static void formulate2x2MixingMatrix_fx( exp = sub( exp, sub( Q30, 62 ) ); #else temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + move32(); exp = ONE_DIV_EPSILON_EXP; + move16(); #endif } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[0], &exp ); -#else - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); -#endif exp = sub( exp, sub( Q30, q_D ) ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); @@ -4848,13 +4783,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, D_fx[1], &exp1 ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ exp1 = sub( exp1, sub( Q30, q_D ) ); } div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 @@ -4869,17 +4798,6 @@ static void formulate2x2MixingMatrix_fx( // 1310720000 = 10,000.0f in Q17 -#ifdef FIX_1326_SPEEDUP_09 - { - Word16 shift1 = s_max( sub( Q17, q_div ), 0 ); - Word16 shift2 = s_max( sub( q_div, Q17 ), 0 ); - - div_fx[0] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[0], shift2 ) ); // q_div - move32(); - div_fx[1] = L_min( L_shr( 1310720000, shift1 ), L_shr( div_fx[1], shift2 ) ); // q_div - move32(); - } -#else IF( LT_16( q_div, Q17 ) ) { div_fx[0] = L_min( L_shr( 1310720000, sub( Q17, q_div ) ), div_fx[0] ); // q_div @@ -4896,7 +4814,6 @@ static void formulate2x2MixingMatrix_fx( q_div = Q17; move16(); } -#endif matrixMul_fx( Are_fx, Aim_fx, &q_A, Ure_fx, Uim_fx, &q_U, tmpRe_fx, tmpIm_fx, &q_temp ); @@ -4913,11 +4830,7 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpRe_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { -#ifdef FIX_1326_SPEEDUP_10 - hdrm_re[chA][chB] = W_norm( W_tmp ); -#else hdrm_re[chA][chB] = sub( W_norm( W_tmp ), 0 ); -#endif move16(); W_tmp = W_shl( W_tmp, hdrm_re[chA][chB] ); tmpRe_fx[chA][chB] = W_extract_h( W_tmp ); @@ -5062,13 +4975,7 @@ static void formulate2x2MixingMatrix_fx( { Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - push_wmops( "formulate2x2MixingMatrix Division" ); -#ifdef FIX_1326_SPEEDUP_17 - temp = BASOP_Util_Divide3232_Scale_cadence_1( ONE_IN_Q30, temp, &exp ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); -#endif - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Division" )*/ q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); -- GitLab From 2f4289477bb50734e7a76d280226c897c5027656 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 11:54:30 +0100 Subject: [PATCH 223/358] apply clang format patch --- .../ivas_dirac_dec_binaural_functions_fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 8da4f82e7..101f76a37 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1489,10 +1489,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; Word16 w1_fx, w2_fx, w3_fx, eq_fx; - hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 - L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 - L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 - Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. * The following formulas determine the gains for these sources. @@ -1523,10 +1523,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); - hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 - L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 - L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 - Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 @@ -1637,7 +1637,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } - pop_wmops(); //push_wmops( "IDRBCMtm LOOP1" ); + pop_wmops(); // push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 -- GitLab From deed66fec4fd1df35c794f25dbe636f224c31cdc Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 12:00:04 +0100 Subject: [PATCH 224/358] deactivate all speedups --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 101f76a37..4a55a37cc 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -50,14 +50,14 @@ // ALL: 169.499 77 (170.650 wo 17) -#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE +//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE + +//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; -- GitLab From 2f158f47a3bab10f597dc5dbb245e40676bbc61f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 12:16:25 +0000 Subject: [PATCH 225/358] cleaup a bit --- .../ivas_dirac_dec_binaural_functions_fx.c | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 4a55a37cc..ce36e0ae3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1432,7 +1432,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness_fx = 0; move32(); } - IF( isIsmDirection ) { /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ @@ -1442,6 +1441,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, ratio_fx ); /*Q30*/ } + IF( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -1527,11 +1527,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 - - lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 - lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 - rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 - rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ @@ -2162,7 +2161,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); tmp2 = L_add( L_shl( resultMtxRe_fx[0][0], exp ), L_shl( resultMtxRe_fx[1][1], exp ) ); q_tmp2 = add( q_res, exp ); - IF( LT_16( q_CrEne, q_tmp2 ) ) { realizedOutputEne_fx = L_add( tmp1, L_shr( tmp2, sub( q_tmp2, q_CrEne ) ) ); @@ -2198,6 +2196,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_missingOutputEne = q_targetOutputEne; move16(); } + tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); #ifdef FIX_1326_SPEEDUP_13 @@ -2258,7 +2257,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_processMtxDec_bin = q_processMtxDec[bin]; move16(); move16(); - /* Store processing matrices */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -3216,6 +3214,7 @@ static void eig2x2_fx( a_fx = (e1 + e2) * (e1 + e2) - 4.0f * ((e1 * e2) - crossSquare_fx) = (e1 - e2)^2 + 4 * crossSquare_fx pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ + IF( L_and( c_re == 0, c_im == 0 ) ) { /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 @@ -3345,7 +3344,6 @@ static void eig2x2_fx( #endif /* Numeric case, when input is near an identity matrix with a gain */ - tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 IF( LT_16( q_tmp1, q_tmp2 ) ) @@ -3425,6 +3423,7 @@ static void eig2x2_fx( #else 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 ); #endif @@ -3513,6 +3512,7 @@ static void eig2x2_fx( #else 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 ); #endif @@ -4563,13 +4563,13 @@ static void formulate2x2MixingMatrix_fx( ELSE { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif } - #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp #endif @@ -4599,19 +4599,14 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - if ( E_out2 == 0 ) - { - static int a = 0; - a++; - } temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); + temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); #ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif } - #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 #endif @@ -4796,7 +4791,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = L_shr( div_fx[1], sub( sub( 31, exp1 ), q_div ) ); // q_div move32(); - // 1310720000 = 10,000.0f in Q17 IF( LT_16( q_div, Q17 ) ) { -- GitLab From 58910c3860c2b7207f8c0564e876a9c0f0f13d8d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 13:54:05 +0100 Subject: [PATCH 226/358] activate the big chunks - SPEEDUP 8, 13 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index ce36e0ae3..f63f27eb0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -53,8 +53,8 @@ //#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE //#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE //#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE +#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE +#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE //#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE //#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE -- GitLab From bd0e99e7ebb01473578e95e36bfaca331d4e4fbe Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 14:32:17 +0100 Subject: [PATCH 227/358] activated spedups 1 , 2, 4, 16, 18 --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index f63f27eb0..7dee99218 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -50,14 +50,14 @@ // ALL: 169.499 77 (170.650 wo 17) -//#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -//#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -//#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE +#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE +#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE #define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE #define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE -//#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -//#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE +#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE +#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -4618,7 +4618,7 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); - pop_wmops(); + pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix RegSMInv" );*/ /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) -- GitLab From b3b061a24408282095e8ca07e2fd9bf23aba388d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 15:56:56 +0100 Subject: [PATCH 228/358] rename optimiztion macros, move macros to options.h --- .../ivas_dirac_dec_binaural_functions_fx.c | 140 +----------------- 1 file changed, 8 insertions(+), 132 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7dee99218..7f2c6b4d4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -46,18 +46,6 @@ #include "wmc_auto.h" // MHZ NUMBERS: -// NULL: 178.407 -// ALL: 169.499 77 (170.650 wo 17) - - -#define FIX_1326_SPEEDUP_01 // optimize matrixT1mul->eig2x2_fx // .4 WMOPS --> USE -#define FIX_1326_SPEEDUP_02 // speedup eig2x2_fx // .3 WMOPS --> USE -#define FIX_1326_SPEEDUP_04 // speedup eig2x2_fx // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_08 // "-" // 3.0 WMOPS //small diffs --> USE -#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt // 2.9 WMOPS --> USE - -#define FIX_1326_SPEEDUP_16 // tiny speedup like 04 // .2 WMOPS --> USE -#define FIX_1326_SPEEDUP_18 // structural speedup // 1 WMOPS --> USE Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; @@ -1892,11 +1880,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); Word32 tmp1, tmp2, res1, res2; Word16 q_tmp1, q_tmp2, q_realizedOutputEne, q_targetOutputEne, q_missingOutputEne, q_gain; -#ifdef FIX_1326_SPEEDUP_13 - Word16 exp1, q_processMtx_bin, q_processMtxDec_bin; -#else Word16 exp1, exp2, q_processMtx_bin, q_processMtxDec_bin; -#endif CrEneL_fx = 0; move32(); @@ -2199,13 +2183,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); -#ifdef FIX_1326_SPEEDUP_13 +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT { - Word16 exp_temp; - tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - tmp2 = ISqrt32( tmp2, &exp_temp ); + tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp2 ); + tmp2 = ISqrt32( tmp2, &exp2 ); gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); - q_gain = sub( 31, add( exp_temp, exp1 ) ); + q_gain = sub( 31, add( exp2, exp1 ) ); } #else { @@ -3317,7 +3300,7 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) -#ifdef FIX_1326_SPEEDUP_02 +#ifdef FIX_1326_SUBSTITUTE_CMPMANT32EXP IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3406,27 +3389,10 @@ static void eig2x2_fx( tmp2 = Mpy_32_32( s_fx, s_fx ); q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - -#ifdef FIX_1326_SPEEDUP_16 - - { - Word16 tmp2_exp; - Word32 eps_tmp; - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &tmp2_exp ); - - // Add epsilon if relevant - eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, tmp2_exp ) ); - tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); - - exp_tmp3 = add( tmp2_exp, 1 ); - } -#else 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 ); -#endif - #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); @@ -3499,22 +3465,10 @@ static void eig2x2_fx( q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); -#ifdef FIX_1326_SPEEDUP_04 - Word16 exp_tmp2; - Word32 eps_tmp; - - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &exp_tmp2 ); - eps_tmp = L_shl_sat( epsilon_mant, sub( epsilon_exp, exp_tmp2 ) ); - - tmp3 = L_add( L_shr( tmp2, 1 ), L_shr( eps_tmp, 1 ) ); // Add Epsilon if relevant - - exp_tmp3 = add( exp_tmp2, 1 ); -#else 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 ); -#endif #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); @@ -3815,7 +3769,6 @@ static void matrixMul_fx( return; } -#ifndef FIX_1326_SPEEDUP_01 static void matrixTransp1Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ Word32 Aim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -3929,7 +3882,6 @@ static void matrixTransp1Mul_fx( return; } -#endif /*FIX_1326_SPEEDUP_01*/ static void matrixTransp2Mul_fx( Word32 Are_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_A*/ @@ -4655,80 +4607,10 @@ static void formulate2x2MixingMatrix_fx( /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ push_wmops( "oPtoA MT1M" ); -#ifdef FIX_1326_SPEEDUP_01 - // matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); - - { - // Word16 chA, chB; - { - chA = 0, chB = 0; - tmpRe_fx[0][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][0], Are_fx[0][0] ), - Are_fx[1][0], Are_fx[1][0] ), - Aim_fx[0][0], Aim_fx[0][0] ), - Aim_fx[1][0], Aim_fx[1][0] ); - move32(); - } - { - // chA = 0, chB = 1; - tmpRe_fx[1][0] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][0] ), - Are_fx[1][1], Are_fx[1][0] ), - Aim_fx[0][1], Aim_fx[0][0] ), - Aim_fx[1][1], Aim_fx[1][0] ); - move32(); - tmpIm_fx[1][0] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Aim_fx[0][0] ), - Are_fx[1][1], Aim_fx[1][0] ), - Aim_fx[0][1], Are_fx[0][0] ), - Aim_fx[1][1], Are_fx[1][0] ); - move32(); - } - { - // chA = 1, chB = 0; - tmpRe_fx[1][1] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][1], Are_fx[0][1] ), - Are_fx[1][1], Are_fx[1][1] ), - Aim_fx[0][1], Aim_fx[0][1] ), - Aim_fx[1][1], Aim_fx[1][1] ); - move32(); - } - { - // chA = 1, chB = 1; - } - - q_temp = sub( add( q_A, q_A ), 31 ); - - move16(); - Word16 ZeroState = add( 1, 0 ); - if ( tmpRe_fx[0][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpRe_fx[1][1] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpRe_fx[1][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - if ( tmpIm_fx[1][0] != 0 ) - { - ZeroState = add( 0, 0 ); - } - - if ( sub( ZeroState, 1 ) == 0 ) - { - q_temp = Q31; - move16(); - } - } - - - eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#else matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); -#endif pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ @@ -4753,11 +4635,9 @@ static void formulate2x2MixingMatrix_fx( move32(); #ifdef FIX_1326_SPEEDUP_08 - // This is just a shortcut to already existing optimizations (FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC) - but makes everything even faster - { - div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 - exp1 = add( 0, 20 ); // move32(); - } + //Sqrt(1) + div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 + exp1 = add( 0, 20 ); IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt { @@ -4841,11 +4721,7 @@ static void formulate2x2MixingMatrix_fx( W_tmp = W_mult0_32_32( tmpIm_fx[chA][chB], div_fx[chB] ); IF( W_tmp != 0 ) { -#ifdef FIX_1326_SPEEDUP_10 - hdrm_im[chA][chB] = W_norm( W_tmp ); -#else hdrm_im[chA][chB] = sub( W_norm( W_tmp ), 0 ); -#endif move16(); W_tmp = W_shl( W_tmp, hdrm_im[chA][chB] ); tmpIm_fx[chA][chB] = W_extract_h( W_tmp ); -- GitLab From e97ec324fd308f6a492143ca03e7d28118b1eeb0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 15:06:07 +0000 Subject: [PATCH 229/358] fix: rename some mocros Cleanup: push/pop wmops --- .../ivas_dirac_dec_binaural_functions_fx.c | 67 ++----------------- 1 file changed, 6 insertions(+), 61 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 7f2c6b4d4..e8052b08c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -45,8 +45,6 @@ #include "wmc_auto.h" -// MHZ NUMBERS: - Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; /*------------------------------------------------------------------------- @@ -506,9 +504,8 @@ void ivas_dirac_dec_binaural_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - push_wmops( "IDR binaural internal (IDRBI)" ); ivas_dirac_dec_binaural_internal_fx( st_ivas, st_ivas->hCombinedOrientationData, output_fx_local, nchan_transport, subframe_idx ); - pop_wmops(); /*push_wmops( "IDR binaural internal (IDRBI)" );*/ + FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] += n_samples_sf; @@ -711,7 +708,6 @@ static void ivas_dirac_dec_binaural_internal_fx( } } /* CLDFB Analysis of input */ - push_wmops( "IDRBI CLDFB ANALYSYS" ); FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) @@ -861,7 +857,6 @@ static void ivas_dirac_dec_binaural_internal_fx( } } } - pop_wmops(); /*push_wmops( "IDRBI CLDFB ANALYSYS" );*/ test(); IF( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) @@ -926,9 +921,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } test(); - push_wmops( "IDRBI cov matrices (IDRBCM)" ); ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q_inp ); - pop_wmops(); /*push_wmops( "IDRBI cov matrices (IDRBCM)" );*/ IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { @@ -966,9 +959,7 @@ static void ivas_dirac_dec_binaural_internal_fx( move16(); } - push_wmops( "IDRBI proc matrices (IRDBI pm)" ); ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); - pop_wmops(); /*push_wmops( "IDRBI proc matrices (IRDBI pm)" );*/ q_inp = Q6; move16(); @@ -1014,10 +1005,8 @@ static void ivas_dirac_dec_binaural_internal_fx( hDiracDecBin->q_processMtxDecPrev = q_mat; move16(); - push_wmops( "IDRBI processOutput" ); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); - pop_wmops(); /*push_wmops( "IDRBI processOutput" ); - */ + hDiracDecBin->hDiffuseDist = NULL; hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); @@ -1151,7 +1140,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ move16(); - push_wmops( "IDRBCM inits" ); + q_earlyPartEneCorrection = s_min( Q31, add( getScaleFactor32( hDiracDecBin->earlyPartEneCorrection_fx, nBins ), hDiracDecBin->q_earlyPartEneCorrection ) ); scale_sig32( hDiracDecBin->earlyPartEneCorrection_fx, nBins, sub( q_earlyPartEneCorrection, hDiracDecBin->q_earlyPartEneCorrection ) ); hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; @@ -1185,7 +1174,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ move16(); } - pop_wmops(); /*push_wmops( "IDRBCM inits" );*/ /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; @@ -1198,13 +1186,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { - push_wmops( "IDRBCM Determine EQ_low_rates" ); FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM Determine EQ_low_rates" );*/ } ELSE { @@ -1223,7 +1209,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric exp = sub( 63, shl( q, 1 ) ); // exp for the energy (inRe_fx * inRe_fx + inIm_fx * inIm_fx) computed below - push_wmops( "IDRBCM input Matrix" ); /* Calculate input covariance matrix */ FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -1258,9 +1243,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); } } - pop_wmops(); /*push_wmops( "IDRBCM input Matrix" );*/ - push_wmops( "IDRBCM apply EQ_low" ); /* Apply EQ at low bit rates */ IF( applyLowBitRateEQ != 0 ) { @@ -1313,9 +1296,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } } - pop_wmops(); /*push_wmops( "IDRBCM apply EQ_low" );*/ - push_wmops( "IDRBCM target matrix (IDRBCMtm)" ); /* Determine target covariance matrix containing target binaural properties */ FOR( bin = 0; bin < nBins; bin++ ) { @@ -1341,7 +1322,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( q_meanEnePerCh ) q_meanEnePerCh = add( sub( q_earlyPartEneCorrection, subFrameTotalEne_e[bin] ), 1 ); // q_earlyPartEneCorrection + 31 - subFrameTotalEne_e[bin] - 31 + Q1(0.5f) /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - push_wmops( "IDRBCMtm LOOP1" ); FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { Word16 aziDeg, eleDeg; @@ -1624,7 +1604,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); move32(); } - pop_wmops(); // push_wmops( "IDRBCMtm LOOP1" ); /* Add diffuse / ambient part covariance matrix */ diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 @@ -1699,7 +1678,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); } - pop_wmops(); /*push_wmops( "IDRBCM target matrix (IDRBCMtm)" );;*/ test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ @@ -1865,7 +1843,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); } - push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" ); FOR( bin = 0; bin < nBins; bin++ ) { Word32 tmpMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain_fx; @@ -1889,7 +1866,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_CrEne = Q31; move16(); - push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" ); IF( GT_16( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ) { hDiracDecBin->ChEne_fx[1][bin] = L_shr( hDiracDecBin->ChEne_fx[1][bin], sub( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ); @@ -1959,9 +1935,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->q_ChCrossOut, prototypeMtx_fx, Mre_fx, Mim_fx, &q_M, hDiracDecBin->reqularizationFactor_fx ); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec A (formulate2x2MixingMatrix)" );*/ - push_wmops( "IDRBI pm LOOP1 sec B" ); IF( LT_16( hDiracDecBin->q_ChEne, hDiracDecBin->q_ChCross ) ) { CxRe_fx[0][0] = hDiracDecBin->ChEne_fx[0][bin]; @@ -2015,13 +1989,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( #endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec B" );*/ - /* When below the frequency limit where decorrelation is applied, we inject the decorrelated * residual (or missing) signal component. The procedure is active when there are not enough independent * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ - - push_wmops( "IDRBI pm LOOP1 sec C" ); IF( LT_16( bin, max_band_decorr ) ) { Word32 decorrelationReductionFactor_fx; @@ -2137,9 +2107,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_Mdec = Q31; move16(); } - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec C" );*/ - push_wmops( "IDRBI pm LOOP1 sec D" ); /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ tmp1 = L_add( CrEneL_fx, CrEneR_fx ); exp = sub( get_min_scalefactor( resultMtxRe_fx[0][0], resultMtxRe_fx[1][1] ), 2 ); @@ -2274,10 +2242,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); q_processMtxDec[bin] = sub( q_Mdec, 16 ); move16(); - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec D" );*/ - - push_wmops( "IDRBI pm LOOP1 sec E" ); IF( separateCenterChannelRendering ) { /* The rendering of the separate center channel in masa + mono mode. @@ -2367,10 +2332,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } - pop_wmops(); /*push_wmops( "IDRBI pm LOOP1 sec E" );*/ } - pop_wmops(); /*push_wmops( "IRDBI pm LOOP1 (IDRBI pm LOOP1)" );*/ - /* Aligning Q-factors of all bins in the processing matrices to a common Q-factor */ minimum_s( q_processMtx, nBins, &hDiracDecBin->q_processMtx ); minimum_s( q_processMtxPrev, nBins, &hDiracDecBin->q_processMtxPrev ); @@ -2390,7 +2352,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( minimum_s( q_processMtxDec, nBins, &hDiracDecBin->q_processMtxDec ); minimum_s( q_processMtxDecPrev, nBins, &hDiracDecBin->q_processMtxDecPrev ); - push_wmops( "IRDBI pm LOOP2" ); FOR( bin = 0; bin < nBins; bin++ ) { FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2430,7 +2391,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } } } - pop_wmops(); /*push_wmops( "IRDBI pm LOOP2" );*/ return; } @@ -3393,6 +3353,7 @@ static void eig2x2_fx( q_tmp2 = sub( 31, q_tmp2 ); tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); + #if 1 tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); @@ -3464,7 +3425,6 @@ static void eig2x2_fx( 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 ); @@ -3533,7 +3493,7 @@ static void eig2x2_fx( move16(); } } -#ifdef FIX_1326_SPEEDUP_18 +#ifdef FIX_1326_SPEEDUP_eig2x2_fx if ( q_U_1 != 0 ) { *q_U = q_U_1; @@ -4455,12 +4415,9 @@ static void formulate2x2MixingMatrix_fx( Cout_im = Mpy_32_32( Cout_im, maxEneDiv_fx ); q_cout = sub( add( q_cout, q_maxEneDiv ), 31 ); - push_wmops( "formulate2x2MixingMatrix cholesky" ); /* Cholesky decomposition of target / output covariance matrix */ chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix cholesky" );*/ - push_wmops( "formulate2x2MixingMatrix Eigendecomp" ); /* Eigendecomposition of input covariance matrix */ eig2x2_fx( E_in1, E_in2, q_ein, Cin_re, Cin_im, q_cin, Uxre_fx, Uxim_fx, &q_Ux, Sx_fx, &q_Sx ); @@ -4478,9 +4435,7 @@ static void formulate2x2MixingMatrix_fx( move32(); matrixDiagMul_fx( Uxre_fx, Uxim_fx, q_Ux, Sx_fx, q_Sx, Kxre_fx, Kxim_fx, &q_Kx ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Eigendecomp" );*/ - push_wmops( "formulate2x2MixingMatrix RegSMInv" ); /* Regularize the diagonal Sx for matrix inversion */ Sx_fx[0] = L_max( L_shr( Sx_fx[0], 1 ), Mpy_32_16_1( Sx_fx[1], regularizationFactor_fx ) ); Sx_fx[1] = L_max( L_shr( Sx_fx[1], 1 ), L_shl( Mpy_32_16_1( Sx_fx[0], regularizationFactor_fx ), 1 ) ); @@ -4570,7 +4525,6 @@ static void formulate2x2MixingMatrix_fx( move32(); Ghat_fx[1] = L_shr( Ghat_fx[1], sub( sub( 31, exp1 ), q_Ghat ) ); // q_Ghat move32(); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix RegSMInv" );*/ /* Matrix multiplication, tmp = Ky' * G_hat * Q */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4603,17 +4557,12 @@ static void formulate2x2MixingMatrix_fx( /* A = Ky' * G_hat * Q * Kx (see publication) */ matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A ); - push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx For matrix A that is P = A(A'A)^0.5 */ - push_wmops( "oPtoA MT1M" ); matrixTransp1Mul_fx( Are_fx, Aim_fx, q_A, Are_fx, Aim_fx, q_A, tmpRe_fx, tmpIm_fx, &q_temp ); eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); - pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/ - - IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4634,7 +4583,7 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#ifdef FIX_1326_SPEEDUP_08 +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT //Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 exp1 = add( 0, 20 ); @@ -4760,9 +4709,7 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );*/ - push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" ); /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ #if ( BINAURAL_CHANNELS != 2 ) FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -4916,8 +4863,6 @@ static void formulate2x2MixingMatrix_fx( 0 /*int Bscale*/, #endif Mre_fx, Mim_fx, q_M ); - pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" );*/ - return; } -- GitLab From 133ff3454de12dab5071edcad4ba1c5831b9e509 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 19 Mar 2025 16:44:16 +0100 Subject: [PATCH 230/358] apply clang format patch --- lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e8052b08c..be86281ef 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -4584,9 +4584,9 @@ static void formulate2x2MixingMatrix_fx( move32(); #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT - //Sqrt(1) + // Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 - exp1 = add( 0, 20 ); + exp1 = add( 0, 20 ); IF( D_fx[1] != 0 ) // This is the new code: replace div sqrt by isqrt { -- GitLab From 6a3d32f5fc301c4af2dc2d946263172e9cdd27d8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 07:55:08 +0000 Subject: [PATCH 231/358] revert:push_wmops: renamed label --- lib_dec/ivas_jbm_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index ce60c0d65..1918ce3f3 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1875,7 +1875,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - push_wmops( "ivas_dec_render (IDR)" ); + push_wmops( "ivas_dec_render" ); /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ -- GitLab From 008633965b65860ce39d557f082be18ff7424330 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 09:52:45 +0100 Subject: [PATCH 232/358] introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 --- .../ivas_dirac_dec_binaural_functions_fx.c | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index be86281ef..141fe8c4b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - +#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 #include #include "options.h" #include @@ -4563,6 +4563,28 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); + +#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 + IF( D_fx[0] == 0 ) + { +#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC + temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 + exp = sub( exp, sub( Q30, 62 ) ); +#else + temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ + move32(); + exp = ONE_DIV_EPSILON_EXP; + move16(); +#endif + div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp + move32(); + } + ELSE + { + exp = sub( 31, q_D ); + div_fx[0] = ISqrt32( D_fx[0], &exp ); + } +#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4582,6 +4604,7 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); +#endif /*FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2*/ #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) -- GitLab From 2f5ee23c86dd5b2145aca5febf5d7a65449ead0b Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 20 Mar 2025 10:40:35 +0100 Subject: [PATCH 233/358] Revert "introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2" This reverts commit 18d10e60341ba2cd76c8161c396c02a8e7293290. --- .../ivas_dirac_dec_binaural_functions_fx.c | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 141fe8c4b..be86281ef 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 + #include #include "options.h" #include @@ -4563,28 +4563,6 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); - -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2 - IF( D_fx[0] == 0 ) - { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 - exp = sub( exp, sub( Q30, 62 ) ); -#else - temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - move32(); - exp = ONE_DIV_EPSILON_EXP; - move16(); -#endif - div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp - move32(); - } - ELSE - { - exp = sub( 31, q_D ); - div_fx[0] = ISqrt32( D_fx[0], &exp ); - } -#else IF( D_fx[0] == 0 ) { #ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC @@ -4604,7 +4582,6 @@ static void formulate2x2MixingMatrix_fx( } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#endif /*FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2*/ #ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) -- GitLab From be7d8ed1ac65f84906e8710a18301a4f5212ec91 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 10:26:18 +0530 Subject: [PATCH 234/358] Scaling related fix in ivas_enc_fx --- lib_enc/ivas_enc_fx.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index e8e1bc59e..ff5f65b32 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -344,13 +344,22 @@ ivas_error ivas_enc_fx( { norm_data_in = s_min( norm_data_in, L_norm_arr( data_fx[i], input_frame ) ); } - norm_data_in = sub( norm_data_in, 7 ); /*guard bit is 4->to handle overflow in cldfbAnalysis*/ - FOR( i = 0; i < hEncoderConfig->nchan_ism + st_ivas->nchan_transport; i++ ) + IF( LT_16( norm_data_in, 31 ) ) + { + norm_data_in = sub( norm_data_in, 7 ); /*guard bit is 4->to handle overflow in cldfbAnalysis*/ + norm_data_in = s_min( norm_data_in, 20 ); // limit Q to 31 (11 + norm) + FOR( i = 0; i < hEncoderConfig->nchan_ism + st_ivas->nchan_transport; i++ ) + { + scale_sig32( data_fx[i], input_frame, norm_data_in ); /* st_ivas->q_data_fx + norm_data_in */ + } + st_ivas->q_data_fx = add( st_ivas->q_data_fx, norm_data_in ); + move16(); + } + ELSE { - scale_sig32( data_fx[i], input_frame, norm_data_in ); /* st_ivas->q_data_fx + norm_data_in */ + st_ivas->q_data_fx = 31; + move16(); } - st_ivas->q_data_fx = add( st_ivas->q_data_fx, norm_data_in ); - move16(); } /* Estimate MASA parameters for the objects */ -- GitLab From ee02c290eea286b0afbbe5283ef69ee93a229428 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 16:08:21 +0530 Subject: [PATCH 235/358] Cleanup of pre-processor macros in the main branch --- apps/renderer.c | 4 - lib_com/basop32.c | 4 - lib_com/bits_alloc_fx.c | 62 -- lib_com/bitstream_fx.c | 2 - lib_com/cldfb.c | 6 - lib_com/cnst.h | 2 - lib_com/disclaimer.c | 4 - lib_com/edct_fx.c | 2 - lib_com/fft_fx.c | 26 - lib_com/gs_bitallocation_fx.c | 2 - lib_com/gs_inact_switching_fx.c | 9 - lib_com/ivas_dirac_com_fx.c | 68 -- lib_com/ivas_prot_fx.h | 28 - lib_com/ivas_qmetadata_com_fx.c | 68 -- lib_com/ivas_spar_com_fx.c | 18 - lib_com/ivas_tools_fx.c | 221 ------- lib_com/lerp.c | 4 - lib_com/low_rate_band_att_fx.c | 4 - lib_com/lsf_tools_fx.c | 2 - lib_com/mslvq_com_fx.c | 8 - lib_com/options.h | 71 --- lib_com/prot_fx.h | 15 - lib_com/rom_com.c | 12 - lib_com/swb_bwe_com_fx.c | 16 - lib_com/swb_bwe_com_lr_fx.c | 4 - lib_com/swb_tbe_com_fx.c | 10 - lib_com/tcq_position_arith_fx.c | 8 - lib_com/tcx_mdct_fx.c | 6 - lib_com/tools.c | 45 -- lib_com/tools_fx.c | 59 -- lib_com/trans_direct_fx.c | 2 - lib_com/trans_inv_fx.c | 6 - lib_dec/FEC_HQ_phase_ecu_fx.c | 28 - lib_dec/FEC_fx.c | 8 - lib_dec/TonalComponentDetection_fx.c | 8 - lib_dec/acelp_core_dec_fx.c | 10 - lib_dec/acelp_core_dec_ivas_fx.c | 166 ----- lib_dec/acelp_core_switch_dec_fx.c | 12 - lib_dec/core_switching_dec_fx.c | 27 - lib_dec/dec_gen_voic_fx.c | 4 - lib_dec/dec_tcx_fx.c | 34 - lib_dec/decision_matrix_dec_fx.c | 2 - lib_dec/fd_cng_dec_fx.c | 14 - lib_dec/gs_dec_fx.c | 16 - lib_dec/hq_core_dec_fx.c | 5 - lib_dec/hq_hr_dec_fx.c | 10 - lib_dec/igf_dec_fx.c | 45 -- lib_dec/init_dec_fx.c | 6 - lib_dec/ivas_binRenderer_internal_fx.c | 70 --- lib_dec/ivas_core_dec_fx.c | 75 --- lib_dec/ivas_cpe_dec_fx.c | 8 - lib_dec/ivas_dirac_dec_fx.c | 20 - lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 144 ----- lib_dec/ivas_init_dec.c | 2 - lib_dec/ivas_ism_param_dec_fx.c | 6 - lib_dec/ivas_jbm_dec_fx.c | 97 --- lib_dec/ivas_mc_param_dec_fx.c | 69 -- lib_dec/ivas_mc_paramupmix_dec_fx.c | 14 - lib_dec/ivas_mct_dec_fx.c | 28 - lib_dec/ivas_mct_dec_mct_fx_fx.c | 24 - lib_dec/ivas_mdct_core_dec_fx.c | 33 - lib_dec/ivas_omasa_dec_fx.c | 8 - lib_dec/ivas_osba_dec_fx.c | 12 - lib_dec/ivas_out_setup_conversion_fx.c | 2 - lib_dec/ivas_post_proc_fx.c | 24 - lib_dec/ivas_qmetadata_dec_fx.c | 22 - lib_dec/ivas_sba_dec_fx.c | 22 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 20 - lib_dec/ivas_spar_decoder_fx.c | 153 ----- lib_dec/ivas_stat_dec.h | 2 - lib_dec/ivas_stereo_cng_dec.c | 4 - lib_dec/ivas_stereo_dft_dec_fx.c | 42 -- lib_dec/ivas_stereo_ica_dec_fx.c | 5 - lib_dec/ivas_stereo_icbwe_dec_fx.c | 14 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 5 - lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 5 - lib_dec/ivas_stereo_switching_dec_fx.c | 10 - lib_dec/ivas_svd_dec_fx.c | 592 ------------------ lib_dec/ivas_tcx_core_dec_fx.c | 18 - lib_dec/ivas_td_low_rate_dec_fx.c | 5 - lib_dec/jbm_pcmdsp_apa.c | 2 - lib_dec/lead_deindexing_fx.c | 4 - lib_dec/lib_dec_fx.c | 82 --- lib_dec/stat_dec.h | 9 - lib_dec/swb_tbe_dec_fx.c | 6 - lib_dec/tonalMDCTconcealment_fx.c | 20 - lib_dec/transition_dec_fx.c | 4 - lib_dec/waveadjust_fec_dec_fx.c | 16 - lib_enc/acelp_core_enc_fx.c | 40 -- lib_enc/acelp_core_switch_enc_fx.c | 8 - lib_enc/bass_psfilter_enc_fx.c | 4 - lib_enc/cng_enc_fx.c | 2 - lib_enc/cod_ace_fx.c | 43 -- lib_enc/cod_tcx_fx.c | 11 - lib_enc/cod_uv_fx.c | 18 - lib_enc/core_enc_init_fx.c | 8 - lib_enc/core_enc_ol_fx.c | 2 - lib_enc/core_enc_reconf_fx.c | 2 - lib_enc/core_enc_switch_fx.c | 4 - lib_enc/core_switching_enc_fx.c | 2 - lib_enc/decision_matrix_enc_fx.c | 2 - lib_enc/dtx_fx.c | 25 - lib_enc/enc_acelp_fx.c | 6 - lib_enc/enc_acelpx_fx.c | 4 - lib_enc/enc_gen_voic_fx.c | 4 - lib_enc/enc_pit_exc_fx.c | 12 - lib_enc/enc_tran_fx.c | 2 - lib_enc/enc_uv_fx.c | 4 - lib_enc/energy_fx.c | 4 - lib_enc/ext_sig_ana_fx.c | 18 - lib_enc/find_tilt_fx.c | 4 - lib_enc/gaus_enc_fx.c | 5 - lib_enc/hq_classifier_enc_fx.c | 4 - lib_enc/hq_core_enc_fx.c | 6 - lib_enc/igf_enc.c | 35 -- lib_enc/init_enc_fx.c | 14 - lib_enc/inov_enc_fx.c | 2 - lib_enc/ivas_core_enc_fx.c | 13 - lib_enc/ivas_core_pre_proc_front_fx.c | 32 - lib_enc/ivas_core_pre_proc_fx.c | 6 - lib_enc/ivas_cpe_enc_fx.c | 44 -- lib_enc/ivas_dirac_enc_fx.c | 66 -- lib_enc/ivas_front_vad_fx.c | 4 - lib_enc/ivas_ism_dtx_enc_fx.c | 4 - lib_enc/ivas_ism_enc_fx.c | 10 - lib_enc/ivas_ism_metadata_enc_fx.c | 6 - lib_enc/ivas_masa_enc_fx.c | 4 - lib_enc/ivas_mc_param_enc_fx.c | 8 - lib_enc/ivas_mc_paramupmix_enc_fx.c | 6 - lib_enc/ivas_mcmasa_enc_fx.c | 4 - lib_enc/ivas_mct_core_enc_fx.c | 11 - lib_enc/ivas_mct_enc_mct_fx.c | 8 - lib_enc/ivas_mdct_core_enc_fx.c | 29 - lib_enc/ivas_omasa_enc_fx.c | 4 - lib_enc/ivas_osba_enc_fx.c | 22 - lib_enc/ivas_qmetadata_enc_fx.c | 17 - lib_enc/ivas_sce_enc_fx.c | 6 - lib_enc/ivas_sns_enc_fx.c | 5 - lib_enc/ivas_stat_enc.h | 12 - lib_enc/ivas_stereo_classifier_fx.c | 4 - lib_enc/ivas_stereo_dft_enc_fx.c | 12 - lib_enc/ivas_stereo_dft_enc_itd_fx.c | 51 -- lib_enc/ivas_stereo_dmx_evs_fx.c | 131 ---- lib_enc/ivas_stereo_ica_enc_fx.c | 22 - lib_enc/ivas_stereo_icbwe_enc_fx.c | 10 - lib_enc/ivas_stereo_mdct_core_enc_fx.c | 10 - lib_enc/ivas_stereo_mdct_igf_enc_fx.c | 2 - lib_enc/ivas_stereo_switching_enc_fx.c | 8 - lib_enc/ivas_stereo_td_analysis_fx.c | 29 - lib_enc/ivas_stereo_td_enc_fx.c | 2 - lib_enc/ivas_tcx_core_enc_fx.c | 20 - lib_enc/ivas_td_low_rate_enc_fx.c | 38 -- lib_enc/lib_enc.c | 4 - lib_enc/nois_est_fx.c | 2 - lib_enc/pit_enc_fx.c | 2 - lib_enc/pre_proc_fx.c | 4 - lib_enc/prot_fx_enc.h | 8 - lib_enc/spec_flatness_fx.c | 4 - lib_enc/speech_music_classif_fx.c | 47 -- lib_enc/stat_enc.h | 5 - lib_enc/swb_bwe_enc_fx.c | 21 - lib_enc/swb_pre_proc_fx.c | 4 - lib_enc/swb_tbe_enc_fx.c | 4 - lib_enc/tcx_ltp_enc_fx.c | 4 - lib_enc/tcx_utils_enc_fx.c | 6 - lib_enc/tns_base_enc_fx.c | 4 - lib_enc/transient_detection_fx.c | 9 - lib_enc/transition_enc_fx.c | 16 - .../ivas_dirac_dec_binaural_functions_fx.c | 426 ------------- lib_rend/ivas_dirac_decorr_dec_fx.c | 115 ---- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 34 - lib_rend/ivas_dirac_rend_fx.c | 30 - lib_rend/ivas_mcmasa_ana_fx.c | 2 - lib_rend/ivas_objectRenderer_hrFilt_fx.c | 2 - lib_rend/ivas_objectRenderer_sources_fx.c | 2 - lib_rend/ivas_output_init_fx.c | 4 - lib_rend/ivas_prot_rend_fx.h | 2 - lib_rend/ivas_reverb_fx.c | 9 - lib_rend/ivas_rotation_fx.c | 2 - lib_rend/ivas_stat_rend.h | 4 - lib_rend/lib_rend.c | 2 - lib_rend/lib_rend.h | 2 - lib_util/hrtf_file_reader.c | 4 - 183 files changed, 4630 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index ceb1a448e..47548d438 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -699,10 +699,8 @@ int main( lfeRoutingConfigs[i] = NULL; } -#ifdef FIX_DISCLAIMER IVAS_REND_PrintDisclaimer(); -#endif CmdlnArgs args = parseCmdlnArgs( argc, argv ); if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) || @@ -864,7 +862,6 @@ int main( exit( -1 ); } -#ifdef FIX_DISCLAIMER fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); fprintf( stdout, "Output audio file: %s\n\n", args.outputFilePath ); @@ -907,7 +904,6 @@ int main( exit( -1 ); } -#endif /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { diff --git a/lib_com/basop32.c b/lib_com/basop32.c index 7fab24660..20dbe663e 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -2563,10 +2563,8 @@ Word16 shr_ro( Word16 var1, Word16 var2, Flag *Overflow ) { var_out = shr_o( var1, var2, Overflow ); -#ifdef FIX_1049_SHR_RO_COMPLEXITY #ifdef WMOPS multiCounter[currCounter].shr--; -#endif #endif if ( var2 > 0 ) { @@ -2577,13 +2575,11 @@ Word16 shr_ro( Word16 var1, Word16 var2, Flag *Overflow ) } } -#ifdef FIX_1049_SHR_RO_COMPLEXITY #ifdef WMOPS multiCounter[currCounter].shr_r++; #endif BASOP_CHECK(); -#endif return ( var_out ); } diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 88b276126..cb71f0f28 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -773,9 +773,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signalling_bits, /* i : number of signalling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -795,9 +793,7 @@ ivas_error config_acelp1( Word16 flag_hardcoded, coder_type_sw, fix_first; Word32 core_brate; #ifdef DEBUGGING -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) active_cnt; -#endif #endif ivas_error error; @@ -1078,13 +1074,9 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) || ( coder_type == INACTIVE && GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx( core_brate, coder_type, -1, -1 )]; move16(); @@ -1205,11 +1197,7 @@ ivas_error config_acelp1( { test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; move16(); @@ -1427,14 +1415,10 @@ ivas_error config_acelp1( acelp_cfg->fixed_cdk_index[3] = -1; move16(); } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || /* @12.8kHz core except of GSC */ ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || EQ_16( core, HQ_CORE ) /* ACELP -> HQ switching in EVS */ ) -#else - ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) || coder_type != INACTIVE ) ) || EQ_16( core, HQ_CORE ) ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ FOR( i = 0; i < nb_subfr; i++ ) @@ -1498,13 +1482,9 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( flag_hardcoded /* EVS */ || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( flag_hardcoded || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -1613,12 +1593,8 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -1658,13 +1634,9 @@ ivas_error config_acelp1( } } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) || ( coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { Word32 Local_BR, Pitch_BR; Word16 Pitch_CT; @@ -1805,12 +1777,8 @@ ivas_error config_acelp1( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* IVAS GSC @16kHz */ -#else - IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; move16(); @@ -1930,9 +1898,7 @@ ivas_error config_acelp1_IVAS( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signaling_bits, /* i : number of signaling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -2214,12 +2180,8 @@ ivas_error config_acelp1_IVAS( test(); test(); /* gain Q bit-budget - part 1: 'Es_pred' of memory-less gain Q */ -#ifdef NONBE_FIX_GSC_BSTR IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && coder_type != INACTIVE && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - IF( ( NE_16( coder_type, UNVOICED ) && NE_16( coder_type, AUDIO ) && ( coder_type != INACTIVE ) && !( LE_32( core_brate, ACELP_8k00 ) && NE_16( coder_type, TRANSITION ) ) ) || ( ( coder_type == INACTIVE ) && GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX( core_brate, coder_type, -1, -1 )]; move16(); @@ -2344,11 +2306,7 @@ ivas_error config_acelp1_IVAS( { test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - IF( coder_type == INACTIVE && EQ_16( L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; move16(); @@ -2564,13 +2522,9 @@ ivas_error config_acelp1_IVAS( acelp_cfg->fixed_cdk_index[3] = -1; move16(); } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) /* @12.8kHz core except of GSC */ || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || EQ_16( core, HQ_CORE ) /* ACELP -> HQ switching in EVS */ ) -#else - ELSE IF( ( coder_type != INACTIVE && EQ_16( nb_subfr, NB_SUBFR ) && NE_16( coder_type, AUDIO ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) || coder_type != INACTIVE ) ) || EQ_16( core, HQ_CORE ) ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ FOR( i = 0; i < nb_subfr; i++ ) @@ -2634,13 +2588,9 @@ ivas_error config_acelp1_IVAS( test(); test(); /* algebraic codebook bit-budget */ -#ifdef NONBE_FIX_GSC_BSTR IF( flag_hardcoded /* EVS */ || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( flag_hardcoded || ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -2741,12 +2691,8 @@ ivas_error config_acelp1_IVAS( test(); test(); /* AVQ codebook */ -#ifdef NONBE_FIX_GSC_BSTR IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - IF( ( GE_32( core_brate_inp, MIN_BRATE_AVQ_EXC ) && coder_type != INACTIVE ) || ( GT_32( total_brate, MAX_GSC_INACTIVE_BRATE ) && coder_type == INACTIVE ) ) -#endif { FOR( i = 0; i < nb_subfr; i++ ) { @@ -2784,13 +2730,9 @@ ivas_error config_acelp1_IVAS( } } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - ELSE IF( ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) && EQ_16( element_mode, IVAS_CPE_TD ) ) || ( ( coder_type == INACTIVE || EQ_16( coder_type, AUDIO ) ) && EQ_16( nb_subfr, NB_SUBFR ) ) || ( coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { Word32 Local_BR, Pitch_BR; Word16 Pitch_CT; @@ -2931,12 +2873,8 @@ ivas_error config_acelp1_IVAS( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* IVAS GSC @16kHz */ -#else - IF( ( EQ_16( L_frame, L_FRAME16k ) && coder_type == INACTIVE && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) || ( GSC_IVAS_mode > 0 && EQ_16( L_frame, L_FRAME16k ) ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; move16(); diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 712a6905e..e144c2cc9 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -526,10 +526,8 @@ void reset_indices_enc_fx( { Word16 i; -#ifdef MSAN_FIX hBstr->nb_ind_tot = 0; move16(); -#endif hBstr->nb_bits_tot = 0; move16(); hBstr->next_ind_fx = 0; diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 48fe4d9bc..408580169 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1101,9 +1101,7 @@ void cldfbSynthesis_ivas_fx( Word32 **imagBuffer_fx, /* i : imag values Qx*/ Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ const Word16 samplesToProcess, /* i : number of processed samples */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE const Word16 shift, /* i : scale for state buffer */ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) { @@ -1269,10 +1267,8 @@ void cldfbSynthesis_ivas_fx( } /* synthesis prototype filter */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( 0 == shift ) { -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = 0; i < L2; i++ ) { 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 @@ -1292,7 +1288,6 @@ void cldfbSynthesis_ivas_fx( synthesisBuffer_fx[4 * L2 + i] = accu4; move32(); } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE } ELSE { @@ -1318,7 +1313,6 @@ void cldfbSynthesis_ivas_fx( move32(); } } -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = 0; i < M1; i++ ) { diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 4e14b310d..379dd7c85 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -935,9 +935,7 @@ typedef enum #define GAIN_PRED_ORDER 4 /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */ #define MEAN_ENER 30 /* Gain quantization - average innovation energy */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR 5 /* DTX - lp_noise threshold for DTX at higher bitrates */ -#endif #define DTX_HIST_SIZE 8 /* CNG & DTX - number of last signal frames used for CNG averaging */ #define CNG_ISF_FACT 0.9f /* CNG & DTX - CNG spectral envelope smoothing factor */ diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index 1a01c2c32..3b1677365 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -44,11 +44,7 @@ int16_t print_disclaimer( FILE *fPtr ) { fprintf( fPtr, "\n==================================================================================================\n" ); -#ifdef FIX_DISCLAIMER fprintf( fPtr, " IVAS Codec BASOP Baseline\n" ); -#else - fprintf( fPtr, " IVAS Codec Baseline\n" ); -#endif fprintf( fPtr, " \n" ); fprintf( fPtr, " Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,\n" ); fprintf( fPtr, " Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0\n" ); diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index b1e2a7dd9..1b303d285 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -395,9 +395,7 @@ void edct_16fx( Word16 Len2, i2; const Word16 *px, *pt; Word16 *py; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow; Overflow = 0; diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 7b63e9c67..31b11a9ea 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7596,12 +7596,6 @@ Word16 L_norm_arr( const Word32 *arr, Word16 size ) Word16 q = 31; move16(); FOR( Word16 i = 0; i < size; i++ ) -#ifndef FIX_1103_OPT_L_NORM_ARR - IF( arr[i] != 0 ) - { - q = s_min( q, norm_l( arr[i] ) ); - } -#else { Word16 q_tst; @@ -7612,7 +7606,6 @@ Word16 L_norm_arr( const Word32 *arr, Word16 size ) } } -#endif return q; } @@ -7658,24 +7651,6 @@ Word16 W_norm_arr( Word64 *arr, Word16 size ) Word16 get_min_scalefactor( Word32 x, Word32 y ) { -#ifndef FIX_1104_OPT_GETMINSCALEFAC - Word16 scf = Q31; - move16(); - test(); - IF( x == 0 && y == 0 ) - { - return 0; - } - IF( x != 0 ) - { - scf = s_min( scf, norm_l( x ) ); - } - IF( y != 0 ) - { - scf = s_min( scf, norm_l( y ) ); - } - return scf; -#else Word16 scf_y; Word16 scf = Q31; move16(); @@ -7699,7 +7674,6 @@ Word16 get_min_scalefactor( Word32 x, Word32 y ) } return scf; -#endif } diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 87ba794d4..0ce59482f 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -75,10 +75,8 @@ void bands_and_bit_alloc_fx( Word16 SWB_bit_budget; Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; Word16 w_sum_bit; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) GSC_IVAS_mode; (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index c0feb91f5..421b2a705 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -162,13 +162,8 @@ void Inac_switch_ematch_ivas_fx( Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ const Word16 coder_type, /* i : Coding mode */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 L_frame, /* i : Frame lenght */ -#ifndef NONBE_FIX_GSC_BSTR - const Word32 total_brate, /* i : total bit rate */ -#endif const Word16 Q_exc, /* i : input and output format of exc2 */ const Word16 bfi, /* i : frame lost indicator */ const Word16 last_core, /* i : Last core used */ @@ -224,11 +219,7 @@ void Inac_switch_ematch_ivas_fx( move16(); } } -#ifdef NONBE_FIX_GSC_BSTR ELSE IF( ( coder_type == INACTIVE ) && inactive_coder_type_flag ) -#else - ELSE IF( ( coder_type == INACTIVE ) && LE_32( total_brate, MAX_GSC_INACTIVE_BRATE ) ) -#endif { /* Find spectrum and energy per band for inactive frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 146587791..7d481d181 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -609,10 +609,8 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_y, /* o: Q30*/ Word32 *direction_vector_z, /* o: Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 *i_e_band -#endif ) { Word16 i; @@ -631,7 +629,6 @@ void computeDirectionVectors_fixed( scaled_x = L_shl( *intensity_real_x, norm_x ); scaled_y = L_shl( *intensity_real_y, norm_y ); scaled_z = L_shl( *intensity_real_z, norm_z ); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC IF( i_e_band != NULL ) { e_x = sub( Q31, add( i_e_band[i - enc_param_start_band], norm_x ) ); @@ -644,12 +641,6 @@ void computeDirectionVectors_fixed( e_y = sub( i_e, norm_y ); e_z = sub( i_e, norm_z ); } -#else - - e_x = sub( i_e, norm_x ); - e_y = sub( i_e, norm_y ); - e_z = sub( i_e, norm_z ); -#endif temp1 = BASOP_Util_Add_Mant32Exp( Mult_32_32( scaled_x, scaled_x ), shl( e_x, 1 ), Mult_32_32( scaled_y, scaled_y ), shl( e_y, 1 ), &exp1 ); intensityNorm = BASOP_Util_Add_Mant32Exp( temp1, exp1, Mult_32_32( scaled_z, scaled_z ), shl( e_z, 1 ), &intensityNorm_e ); @@ -966,17 +957,12 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv = L_add( 0, 0 ); Word16 shift_qtotal; if ( shift_q < 0 ) { -#ifdef FIX_USAN_ISSUES shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); -#else - shiftEquiv = L_lshl( 0x80000000, shift_q ); -#endif } if ( shift_q >= 0 ) { @@ -990,27 +976,6 @@ void computeDiffuseness_fixed( energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); move32(); } -#else - Word16 shift_q = sub( q_tmp, q_ene ); - IF( shift_q < 0 ) - { - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp_c[k], min_q_shift1 ); - energy_slow[k] = L_add( L_shl( energy_slow[k], shift_q ), tmp ); - move32(); - } - } - ELSE - { - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp_c[k], min_q_shift1 ); - energy_slow[k] = L_add( energy_slow[k], L_shr( tmp, shift_q ) ); - move32(); - } - } -#endif q_ene = s_min( q_ene, q_tmp ); @@ -1019,14 +984,9 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS if ( shift_q < 0 ) { -#ifdef FIX_USAN_ISSUES shiftEquiv = L_lshl( (Word32) 0x80000000, shift_q ); -#else - shiftEquiv = L_lshl( 0x80000000, shift_q ); -#endif } if ( shift_q >= 0 ) { @@ -1044,34 +1004,6 @@ void computeDiffuseness_fixed( move32(); } } -#else - IF( shift_q > 0 ) - { - FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) - { - p_tmp = buffer_intensity[j][i]; - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp[k], min_q_shift2 ); - intensity_slow[j * num_freq_bands + k] = L_add( intensity_slow[j * num_freq_bands + k], L_shr( tmp, shift_q ) ); - move32(); - } - } - } - ELSE - { - FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) - { - p_tmp = buffer_intensity[j][i]; - FOR( k = 0; k < num_freq_bands; k++ ) - { - tmp = L_shl( p_tmp[k], min_q_shift2 ); - intensity_slow[j * num_freq_bands + k] = L_add( L_shl( intensity_slow[j * num_freq_bands + k], shift_q ), tmp ); - move32(); - } - } - } -#endif q_intensity = s_min( q_intensity, q_tmp ); } diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index ab043fc0f..fab166b6d 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1309,7 +1309,6 @@ Word16 matrix_diag_product_fx( Word32 *Z, /* o : resulting matrix after the matrix multiplication */ Word16 *Z_e ); -#ifdef OPT_BASOP_ADD_v1 Word16 matrix_diag_product_fx_2( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ const Word16 X_e, @@ -1321,7 +1320,6 @@ Word16 matrix_diag_product_fx_2( const Word16 entriesY, /* i : number of entries in the diagonal Q0*/ Word32 *Z, /* o : resulting matrix after the matrix multiplication Q31 - Z_e*/ Word16 *Z_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 matrix_diag_product_fx_1( const Word32 *X, /* i : left hand matrix */ @@ -3238,10 +3236,8 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_y, /*Q30*/ Word32 *direction_vector_z, /*Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 *i_e_band -#endif ); @@ -3787,10 +3783,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal */ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); ivas_error ivas_osba_ism_metadata_dec_fx( @@ -4706,21 +4698,11 @@ Word32 dot_product_cholesky_fx( const Word16 N /* i : vector & matrix size */ ); -#ifndef DOT_PROD_CHOLESKY_64BIT -Word32 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N, /* i : vector & matrix size */ - const Word16 exp_x, - const Word16 exp_A, - Word16 *exp_sum ); -#else Word64 dot_product_cholesky_fixed( const Word32 *x, /* i : vector x */ const Word32 *A, /* i : Cholesky matrix A */ const Word16 N /* i : vector & matrix size */ ); -#endif void v_mult_mat_fx( Word32 *y_fx, /* o : the product x*A */ @@ -5347,20 +5329,12 @@ ivas_error ivas_sba_dec_render_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); void ivas_spar_dec_upmixer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Word32 *output_fx[], /* o : output audio channels */ const Word16 nchan_internal /* i : number of internal channels */ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ); ivas_error ivas_spar_md_enc_open_fx( @@ -5967,9 +5941,7 @@ ivas_error pre_proc_front_ivas_fx( const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index c9ad84097..ee11f2b02 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -152,10 +152,8 @@ ivas_error ivas_qmetadata_allocate_memory_fx( { set32_fx( hQMetaData->q_direction[dir].band_data[j].elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); set32_fx( hQMetaData->q_direction[dir].band_data[j].azimuth_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef MSAN_FIX set32_fx( hQMetaData->q_direction[dir].band_data[j].q_elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); set32_fx( hQMetaData->q_direction[dir].band_data[j].q_azimuth_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif set32_fx( hQMetaData->q_direction[dir].band_data[j].energy_ratio_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } } @@ -315,14 +313,8 @@ ivas_error only_reduce_bits_direction_fx( Word16 *bits_dir0; Word16 bits_sph_idx_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef FIX_QMETADATA_PENALTY Word32 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 tmp; -#else - Word16 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; - Word16 shift, tmp, tmp_e, flag; - Word32 tmp_32; -#endif FOR( j = 0; j < coding_subbands; j++ ) { FOR( k = 0; k < no_subframes; k++ ) @@ -407,7 +399,6 @@ ivas_error only_reduce_bits_direction_fx( } ELSE { -#ifdef FIX_QMETADATA_PENALTY Word16 m, sorted, index1, index2; @@ -457,65 +448,6 @@ ivas_error only_reduce_bits_direction_fx( } -#else - FOR( j = 0; j < coding_subbands; j++ ) - { - penalty[j] = 0; - move16(); - tmp_32 = 0; - move32(); - shift = find_guarded_bits_fx( no_subframes ); - - flag = 1; - move16(); - // This change was done due to loss of precision from BASOP_Util_Divide3232_Scale which was leading to penalty getting calculated wrongly - // and hence ind_order being sorted incorrectly which might cause infinite loop. - FOR( k = 0; k < no_subframes - 1; k++ ) - { - IF( NE_16( bits_sph_idx_orig[j][k], bits_sph_idx_orig[j][k + 1] ) ) - { - flag = 0; - move16(); - } - } - - IF( flag ) - { - tmp = 0; - move16(); - FOR( k = 0; k < no_subframes; k++ ) - { - IF( bits_sph_idx_orig[j][k] > 0 ) - { - tmp = add( tmp, sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ); - } - } - - tmp = BASOP_Util_Divide1616_Scale( tmp, bits_sph_idx_orig[j][0], &tmp_e ); - - tmp_32 = L_shl( tmp, tmp_e ); /* Q15 */ - - penalty[j] = extract_l( L_shr( tmp_32, shift ) ); /* Q15 - shift */ - move16(); - // Division by no_subframes for penalty[j] not required - } - ELSE - { - FOR( k = 0; k < no_subframes; k++ ) - { - IF( bits_sph_idx_orig[j][k] > 0 ) - { - tmp = BASOP_Util_Divide3232_Scale( extract_l( L_sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ), bits_sph_idx_orig[j][k], &tmp_e ); - tmp_32 = L_add( tmp_32, L_shl( tmp, tmp_e ) ); - } - } - penalty[j] = extract_l( L_shr( tmp_32, shift ) ); /* Q15 - shift */ - move16(); - // Division by no_subframes for penalty[j] not required - } - } - sort_desc_ind_16_fx( penalty, coding_subbands, ind_order ); -#endif } *reduce_bits_out = negate( reduce_bits ); diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 929eaa2c5..9f6d8b422 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -2631,11 +2631,7 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( test(); IF( W_norm( re ) == 0 || W_norm( recon_uu_re[i][j] ) == 0 ) { -#ifdef FIX_ISSUE_1122 recon_uu_re[i][j] = L_shr( recon_uu_re[i][j], 1 ); // q_recon_uu_re[i][j] - 1 -#else - re1[m] = L_shr( re1[m], 1 ); // q_recon_uu_re[i][j]-1 -#endif move32(); q_recon_uu_re[i][j] = sub( q_recon_uu_re[i][j], 1 ); move16(); @@ -3834,11 +3830,7 @@ void ivas_compute_spar_params_fx( } ELSE { -#ifdef FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i] = L_shr_r( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i], sub( tmp, 22 ) ); // q22 -#else - hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i] = L_shr( hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].pred_re_fx[i], sub( tmp, 22 ) ); // q22 -#endif move32(); } } @@ -3865,7 +3857,6 @@ void ivas_compute_spar_params_fx( Word16 q_tmp = hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].q_C_re_fx; IF( NE_16( ndm, 1 ) ) { -#ifdef MSAN_FIX FOR( i = 0; i < ( num_ch - ndm ); i++ ) { FOR( j = 0; j < sub( ndm, 1 ); j++ ) @@ -3874,15 +3865,6 @@ void ivas_compute_spar_params_fx( move32(); } } -#else - for ( i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++ ) - { - for ( j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++ ) - { - hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub( q_tmp, 22 ) ); - } - } -#endif hSparMd->band_coeffs[b + ( i_ts * IVAS_MAX_NUM_BANDS )].q_C_re_fx = Q22; move16(); } diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index 04d6f7bf5..ca8dec276 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -306,12 +306,6 @@ void v_add_inc_fx( const Word16 N /* i : Vector length Q0*/ ) { -#ifndef FIX_1107_VADDINC - Word16 i; - Word16 ix1 = 0; - Word16 ix2 = 0; - Word16 iy = 0; -#else Word16 i, ix1, ix2, iy; /* The use of this function is currently always for the interleaved input format, */ @@ -334,7 +328,6 @@ void v_add_inc_fx( ix1 = 0; ix2 = 0; iy = 0; -#endif move16(); move16(); move16(); @@ -604,44 +597,6 @@ void v_sub32_fx( * Therefore, S=A*A' where A is upper triangular matrix of size (m*m+m)/2 (zeros ommitted, column-wise) *---------------------------------------------------------------------*/ -#ifndef DOT_PROD_CHOLESKY_64BIT -/*! r: the dot product x'*A*A'*x */ -Word32 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x Q31 - exp_x*/ - const Word32 *A, /* i : Cholesky matrix A Q31 - exp_A*/ - const Word16 N, /* i : vector & matrix size Q0*/ - const Word16 exp_x, - const Word16 exp_A, - Word16 *exp_sum ) -{ - Word16 i, j; - Word32 suma, tmp_sum, mul; - const Word32 *pt_x, *pt_A; - Word16 mul_exp, tmp_sum_exp; - mul_exp = add( exp_x, exp_A ); - pt_A = A; - suma = 0; - move32(); - FOR( i = 0; i < N; i++ ) - { - tmp_sum = 0; - move32(); - tmp_sum_exp = 0; - move16(); - pt_x = x; - - FOR( j = 0; j <= i; j++ ) - { - mul = Mpy_32_32( *pt_x++, *pt_A++ ); /*Q31 - (exp_x + exp_A)*/ - tmp_sum = BASOP_Util_Add_Mant32Exp( tmp_sum, tmp_sum_exp, mul, mul_exp, &tmp_sum_exp ); // exp_x+exp_A - } - - suma = BASOP_Util_Add_Mant32Exp( suma, *exp_sum, Mpy_32_32( tmp_sum, tmp_sum ), shl( tmp_sum_exp, 1 ), exp_sum ); /*Q31 - exp_sum*/ - } - - return suma; -} -#else /*! r: the dot product x'*A*A'*x */ Word64 dot_product_cholesky_fixed( const Word32 *x, /* i : vector x Q31 - exp_x*/ @@ -677,7 +632,6 @@ Word64 dot_product_cholesky_fixed( return suma; } -#endif void v_mult_mat_fixed( Word32 *y, /* o : the product x*A Qx - guardbits*/ @@ -978,9 +932,6 @@ Word16 matrix_product_mant_exp_fx( Word16 out_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word16 *Zp_fx_e = out_e; Word16 row, col; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word64 temp; Word16 temp_e; Word16 prod_e = add( X_fx_e, Y_fx_e ); @@ -1007,13 +958,7 @@ Word16 matrix_product_mant_exp_fx( FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = k + i * rowsX; - y_idx = k + j * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1051,13 +996,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = i + k * rowsX; - y_idx = j + k * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1095,13 +1034,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = k + i * rowsX; - y_idx = j + k * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1140,13 +1073,7 @@ Word16 matrix_product_mant_exp_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 temp = W_mac_32_32( temp, X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ); // X_fx_e + Y_fx_e -#else /* OPT_BASOP_ADD_v1 */ - x_idx = i + k * rowsX; - y_idx = k + j * rowsY; - temp = W_mac_32_32( temp, X_fx[x_idx], Y_fx[y_idx] ); // X_fx_e + Y_fx_e -#endif /* OPT_BASOP_ADD_v1 */ } /* Maximize accumulated value to 32-bit */ temp_e = W_norm( temp ); @@ -1204,9 +1131,6 @@ Word16 matrix_product_fx( ) { Word16 i, j, k; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word32 *Zp_fx = Z_fx; /* Processing */ @@ -1227,13 +1151,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp_fx++; @@ -1254,13 +1172,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp_fx++; @@ -1281,13 +1193,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = Madd_32_32( *Zp_fx, X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } @@ -1310,13 +1216,7 @@ Word16 matrix_product_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); /*Qx + Qy - 31*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ -#endif /* OPT_BASOP_ADD_v1 */ // TODO: overflow of Z_fx to be checked move32(); } @@ -1341,9 +1241,6 @@ Word16 matrix_product_q30_fx( ) { Word16 i, j, k; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ Word32 *Zp_fx = Z_fx; Word64 W_tmp; @@ -1366,14 +1263,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1397,14 +1287,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1428,11 +1311,6 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifndef OPT_BASOP_ADD_v1 - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ -#endif /* OPT_BASOP_ADD_v1 */ W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 } @@ -1459,14 +1337,7 @@ Word16 matrix_product_q30_fx( move64(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); // Q56 -#else /* OPT_BASOP_ADD_v1 */ - //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); // Q56 -#endif /* OPT_BASOP_ADD_v1 */ } W_tmp = W_shl( W_tmp, 6 ); /*Q62*/ ( *Zp_fx ) = W_round64_L( W_tmp ); /*Q30*/ @@ -1499,9 +1370,6 @@ Word16 matrix_product_mant_exp( Word16 *Zp_e = Z_e; Word32 L_tmp; Word16 tmp_e; -#ifndef OPT_BASOP_ADD_v1 - Word16 x_idx, y_idx; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ test(); @@ -1523,16 +1391,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[k + i * rowsX], Y_e[k + j * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - //( *Zp ) += X[k + i * rowsX] * Y[k + j * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1560,16 +1420,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[i + k * rowsX], Y_e[j + k * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[j + k * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); ( *Zp_e ) = tmp_e; @@ -1596,16 +1448,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[k + i * rowsX], Y_e[j + k * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[k + i * rowsX] * Y_fx[j + k * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1635,16 +1479,8 @@ Word16 matrix_product_mant_exp( move16(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ tmp_e = add( X_e[i + k * rowsX], Y_e[k + j * rowsY] ); -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[k + j * rowsY]; - L_tmp = Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Q31 - (X_e + Y_e)*/ - tmp_e = add( X_e[x_idx], Y_e[y_idx] ); -#endif /* OPT_BASOP_ADD_v1 */ ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e ); move32(); @@ -1675,9 +1511,6 @@ Word16 matrix_diag_product_fx( { Word16 i, j; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1690,12 +1523,7 @@ Word16 matrix_diag_product_fx( { FOR( i = 0; i < colsX; ++i ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[j + i * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( j, imult1616( i, rowsX ) ); - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; } @@ -1726,7 +1554,6 @@ Word16 matrix_diag_product_fx( return EXIT_SUCCESS; } -#ifdef OPT_BASOP_ADD_v1 Word16 matrix_diag_product_fx_2( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ const Word16 X_e, @@ -1818,7 +1645,6 @@ Word16 matrix_diag_product_fx_2( return EXIT_SUCCESS; } -#endif /* OPT_BASOP_ADD_v1 */ Word16 matrix_diag_product_fx_1( const Word32 *X, /* i : left hand matrix Q31 - X_e*/ @@ -1835,9 +1661,6 @@ Word16 matrix_diag_product_fx_1( Word16 i, j; Word32 *Zp = Z; Word16 *Z_ep = Z_e; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1850,19 +1673,10 @@ Word16 matrix_diag_product_fx_1( { FOR( i = 0; i < colsX; ++i ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[j + i * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( j, imult1616( i, rowsX ) ); /*Q0*/ - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; -#ifdef OPT_BASOP_ADD_v1 *( Z_ep ) = add( X_e[j + i * rowsX], Y_e[j] ); -#else /* OPT_BASOP_ADD_v1 */ - *( Z_ep ) = add( X_e[tmp], Y_e[j] ); -#endif /* OPT_BASOP_ADD_v1 */ move16(); Z_ep++; } @@ -1908,9 +1722,6 @@ Word16 diag_matrix_product_fx( { Word16 i, j; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 tmp; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ IF( EQ_16( transpX, 1 ) ) /* We use X transpose */ @@ -1923,12 +1734,7 @@ Word16 diag_matrix_product_fx( { FOR( j = 0; j < entriesY; ++j ) { -#ifdef OPT_BASOP_ADD_v1 *( Zp ) = Mpy_32_32( X[i + j * rowsX], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - tmp = add( i, imult1616( j, rowsX ) ); /*Q0*/ - *( Zp ) = Mpy_32_32( X[tmp], Y[j] ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); Zp++; } @@ -1974,9 +1780,6 @@ Word16 matrix_product_diag_fx( { Word16 j, k; Word32 *Zp = Z; -#ifndef OPT_BASOP_ADD_v1 - Word16 y_idx, x_idx; -#endif /* OPT_BASOP_ADD_v1 */ /* Processing */ test(); @@ -1995,13 +1798,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < rowsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[k + j * rowsX], Y[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( j, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; @@ -2019,13 +1816,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[j + k * rowsX], Y[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( j, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; @@ -2045,13 +1836,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[k + j * rowsX], Y[j + k * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( k, imult1616( j, rowsX ) ); /*Q0*/ - y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } @@ -2071,13 +1856,7 @@ Word16 matrix_product_diag_fx( move32(); FOR( k = 0; k < colsX; ++k ) { -#ifdef OPT_BASOP_ADD_v1 ( *Zp ) = Madd_32_32( ( *Zp ), X[j + k * rowsX], Y[k + j * rowsY] ); /*Q31 - (X_e + Y_e)*/ -#else /* OPT_BASOP_ADD_v1 */ - x_idx = add( j, imult1616( k, rowsX ) ); /*Q0*/ - y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ - ( *Zp ) = L_add( ( *Zp ), Mpy_32_32( X[x_idx], Y[y_idx] ) ); /*Q31 - (X_e + Y_e)*/ -#endif /* OPT_BASOP_ADD_v1 */ move32(); } Zp++; diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 4e306b936..6f148057f 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -356,10 +356,6 @@ void L_lerp_fx( Word32 *f /*q*/, Word32 *f_out /*q*/, Word16 bufferNewSize /*Q0* f[ind] = L_shr( f[ind], guard_bits ); /*Q(guard_bits)*/ move32(); } -#ifndef MSAN_FIX - FOR( Word16 ind = 0; ind < bufferNewSize; ind++ ) - f_out[ind] = L_shr( f_out[ind], guard_bits ); -#endif } IF( GT_32( L_mult0( 128, bufferNewSize ), L_mult0( bufferOldSize, 507 ) ) ) diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 9958b9d5f..e51d2807b 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -75,15 +75,11 @@ void ivas_fine_gain_pred_fx( L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */ exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) ); L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */ -#ifndef FIX_ISSUE_987 - Mpy_32_16_ss( L_tmp, ivas_fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#else Word16 norm = norm_s( bw ); Word16 tmp1, tmp_exp = sub( 15, norm ); tmp1 = Sqrt16( shl( bw, norm ), &tmp_exp ); tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) ); Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */ -#endif gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */ test(); diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 08e74b9b7..54f0ae3ed 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -604,7 +604,6 @@ Word16 lpc2lsp_fx( return ( 1 ); } -#ifdef FIX_ISSUE_1165 /*===================================================================*/ /* FUNCTION : lpc2lsp_ivas_fx () */ /*-------------------------------------------------------------------*/ @@ -749,7 +748,6 @@ Word16 lpc2lsp_ivas_fx( return ( 1 ); } -#endif /*===================================================================*/ /* FUNCTION : lsp2lpc_fx () */ diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 10e560433..cf2ad8a8a 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -461,12 +461,10 @@ static Word16 decode_indexes_ivas_fx( IF( index[i] < 0 ) { set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); scales_mslvq[1] = 0; move16(); -#endif index[i] = 0; return 1; } @@ -491,10 +489,8 @@ static Word16 decode_indexes_ivas_fx( FOR( i = 0; i < LATTICE_DIM; i++ ) { x_lvq[i] = 0; -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); -#endif } } ELSE @@ -503,12 +499,10 @@ static Word16 decode_indexes_ivas_fx( { /* safety check in case of bit errors */ set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); -#ifdef MSAN_FIX scales_mslvq[0] = 0; move16(); scales_mslvq[1] = 0; move16(); -#endif return 1; } @@ -549,10 +543,8 @@ static Word16 decode_indexes_ivas_fx( x_lvq[i] = 0; move16(); } -#ifdef MSAN_FIX scales_mslvq[1] = 0; move16(); -#endif } ELSE { diff --git a/lib_com/options.h b/lib_com/options.h index dab0c796c..16c9498d6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -67,77 +67,6 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif -#define IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */ -#define MSAN_FIX -#define FIX_TMP_714 -#define BASOP_NOGLOB_TMP_715 -#define EVS_FUNC_MODIFIED -#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ -#define MOD_BIT_ALLOC_ROM_TABLE /* Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/ -#define SIMPLIFY_CODE_BE // Simplify synthesis loop -#define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ -#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ -#define FIX_1013_CRASH_HQ_CORE_DEC /* Ittiam: Saturation added on the lines of EVS */ -#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/ -#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ -#define FIX_ISSUE_1062_AND_1068_TON_ENE_EST_FX -#define FIX_ISSUE_987 -#define FIX_1054_IF_ELSE_CMPLX /* VA: Fix 1054 incorrect counting of complexity when ELSE-IF sequence is encoutered in two functions */ -#define FIX_1052_COPY_CMPLX_DISCREPANCY /* VA: modify IF-ELSE statements used in Copy*() functions to avoid dependency on x[] and y[] in RAM */ -#define FIX_1049_SHR_RO_COMPLEXITY /* VA: fix for issue 1049: incorrect counting of complexity in the shr_ro() function */ -#define NONBE_IMPROVE_DIRAC_INTENSITY_PREC -#define FIX_1103_OPT_L_NORM_ARR /* FhG: Optimize L_norm_arr(), avoid IF */ -#define FIX_1105_OPT_MINIMUM_SL /* FhG: Optimize minimum_s(), minimum_l(), avoid IF */ -#define FIX_1104_OPT_GETMINSCALEFAC /* FhG: Optimize get_min_scalefactor(), avoid IF */ -#define FIX_1106_SIMPLIFY_SET32FX /* FhG: simplify set32_fx() */ -#define FIX_1107_VADDINC /* FhG: Optimize v_add_inc_fx() for most frequent case */ -#define FIX_1009_OPT_PARAMMC_RENDER /* FhG: Optimize ivas_param_mc_dec_render_fx() */ -#define FIX_1109_OPTIM_MCT_STEREO_IGF_DEC /* FhG: optimize mctStereoIGF_dec_fx() */ -#define FIX_1110_OPTIM_DIRAC_DECORR_PROC /* FhG: optimize ivas_dirac_dec_decorr_process() */ -#define FIX_1127_IMPROVE_SBA_MLD /* Ittiam: Avoid saturation for DiRAC reference power */ -#define FIX_1100_REMOVE_LPC_RESCALING /* VA: Remove the rescaling of LPC coefficient to Q12 as residu and syn-filt are already taking care of it*/ -#define FIX_1133_IMPROVE_MC_MLD /* Ittiam: Correcting wrong updation of exponents in ivas_mc_paramupmix_param_est_enc_fx() */ -#define FIX_ISSUE_1122 /* Ittiam: Fix issue 1122: corrected incorrect scaling of a buffer leading to incorrect metadata bits */ -#define FIX_ISSUE_1125 /* Ittiam: Fix issue 1125: interfering talker flag not triggered on short test vector */ -#define FIX_1132_STACK_CORRUPTION /* Stack corruption issue due of extending index access*/ -#define FIX_ISSUE_1092 /* Ittiam: Fix for Issue 1092: BASOP asserts in stereo fx encoder for selection test inputs*/ -#define FIX_ISSUE_1135 /* Ittiam: Fix for Issue 1135: downmixing difference between float and fixed-point (DFT - stereo) */ -#define FIX_ISSUE_1148 -#define FIX_ISSUE_1147 /* Ittiam: Fix for issue 1147: Added saturation in DetectTnsFilt_fx.*/ -#define FIX_ISSUE_1150 /* Ittiam: Fix for Issue 1150: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from tcx_ltp_find_gain function*/ -#define FIX_ISSUE_1151 /* Ittiam: Fix for Issue 1151: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from sp_mus_classif_gmm_fx function*/ -#define FIX_ISSUE_1153 /* Ittiam: Fix for Issue 1153: Assertion error observed in stereo_dmx_evs_enc_fx from calc_poc_fx function*/ -#define FIX_ISSUE_1154 /* Ittiam: Fix for Issue 1154: Encoder crash for ParamMC 7.1 at 96kbps in ivas_param_mc_param_est_enc_fx() */ -#define FIX_ISSUE_1157 /* Ittiam: Fix for Issue 1157: Encoder crash for Stereo at 48/64kbps DTX on/off in kernel_switch_trafo_fx() */ -#define FIX_ISSUE_1152 /* Ittiam: Fix for issue 1152: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from find_tilt_fx function*/ -#define FIX_ISSUE_1156 /* Ittiam: Fix for Issue 1156: Encoder crash for Stereo at 32kbps in SWB_BWE_encoding_ivas_fx() */ -#define FIX_DISCLAIMER /* VA: Add disclaimer for external renderer + Add info about IVAS reference version (FLP issue 1225) */ -#define FIX_ISSUE_1167 /* Ittiam: Fix for Issue 1167: Encoder crash for OSBA ISM3SBA1 at 13.2 and 16.4 kbps in gauss_L2_ivas_fx() */ -#define FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC /* FhG: Reduce workload of binaural rendering: replace 1./tmp & sqrt by Isqrt32 */ -#define FIX_1113_OPT_DIRAC_BIN_REND /* FhG: Various optimizations to ivas_dirac_dec_binaual_functions.c */ -#define FIX_ISSUE_1187 /* Ittiam: Fix for issue 1187: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from bass_pf_enc_fx function*/ -#define FIX_ISSUE_1186 /* Ittiam: Fix for Issue 1186: Energy/scaling issue for ISM-1 at all bitrates */ -#define FIX_ISSUE_1165 /* Ittiam: Fix for issue 1165: Assertion in lpc2lsp_fx for OMASA LTV input */ -#define FIX_ISSUE_1185 /* Ittiam: Fix for issue 1185: Assertion in ivas_dirac_dec_binaural_internal_fx() for crash in decoder in fft30_with_cmplx_data()*/ -#define FIX_ISSUE_1209 /* Ittiam: Fix for issue 1209: Assertion exit in BASOP encoder (stereo_dmx_evs)*/ -#define FIX_ISSUE_1218 /* Ittiam: Fix for issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps*/ -#define FIX_ISSUE_1290 /* Ittiam: Fix for issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps*/ -#define IVAS_ISSUE_1188_EVS_CRASH /* Ittiam: Fix for issue 1188: Issue due to ASAN */ -#define FIX_ISSUE_1155 /* Ittiam: Fix for issue 1155: Encoder crash for Stereo at 32kbps in PostShortTerm_ivas_enc_fx()*/ -#define FIX_1010_OPT_DIV /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_SINGLE_RESCALE /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_GIVENS /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_GIVENS_INV /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_NORM_NOSAT /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1010_OPT_SEC_SINGLE_RESCALE /* FhG: SVD complexity optimizations (non-be) */ -#define FIX_1072_SPEEDUP_matrixTransp2Mul_fx /* FhG: complexity optimization (non-be) */ -#define FIX_1072_REDUCE_DIVS /* FhG: complexity optimization (non-be) */ -#define FIX_ISSUE_1230 /* Ittiam: Fix for issue 1230: Basop Enc audible differences and distortion @16kbps */ -#define NONBE_1211_DTX_BR_SWITCHING /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */ -#define FIX_1189_GSC_IVAS_OMASA /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */ -#define NONBE_1273_ISM_METADATA_COUNTER /* VA: BASOP issue 1265, FLP issue 1273: fix counter overflow in ISM metadata encoder */ -#define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF /* FhG: fix for issue 1101: complexity of spar dec upmixer */ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ #define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS /* FhG: Defines 1.0f-weight variables, uses Madd operation instead of L_add_sat */ #define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS /* FhG: Splits single loop with IF-statements into two low-complex loops */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 70b70859c..71c1590c2 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -881,13 +881,11 @@ Word16 lpc2lsp_fx( Word16 *old_freq, Word16 order ); -#ifdef FIX_ISSUE_1165 Word16 lpc2lsp_ivas_fx( Word32 *a, Word16 *freq, Word16 *old_freq, Word16 order ); -#endif void lsp2lpc_fx( Word16 *a, @@ -4864,9 +4862,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signalling_bits, /* i : number of signalling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -5854,13 +5850,8 @@ void Inac_switch_ematch_ivas_fx( Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ const Word16 coder_type, /* i : Coding mode */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 L_frame, /* i : Frame lenght */ -#ifndef NONBE_FIX_GSC_BSTR - const Word32 core_brate, /* i : Core bit rate */ -#endif const Word16 Q_exc, /* i : input and output format of exc2 */ const Word16 bfi, /* i : frame lost indicator */ const Word16 last_core, /* i : Last core used */ @@ -9753,9 +9744,7 @@ void cldfbSynthesis_ivas_fx( Word32 **imagBuffer_fx, /* i : imag values Qx*/ Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ const Word16 samplesToProcess, /* i : number of processed samples */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE const Word16 shift, /* i : scale for state buffer */ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); @@ -10995,9 +10984,7 @@ ivas_error config_acelp1_IVAS( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const Word16 signaling_bits, /* i : number of signaling bits */ const Word16 coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const Word16 tc_subfr, /* i : TC subfr ID */ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -11064,9 +11051,7 @@ void calculate_hangover_attenuation_gain_ivas_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR const Word32 igf_brate, /* i : IGF configuration bitrate */ -#endif const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index e6f392ff0..551a84feb 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -16790,7 +16790,6 @@ const Word16 GSC_freq_bits[] = 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_22k60*/ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4 /* ACELP_24k40*/ }; // Q0 -#ifdef MOD_BIT_ALLOC_ROM_TABLE const Word32 GSC_freq_bits_fx[] =/*Q18*/ { 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_5k00*/ @@ -16823,17 +16822,6 @@ const Word32 GSC_freq_bits_fx_Q18[] =/*Q18*/ 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, }; -#else -const Word32 GSC_freq_bits_fx[] = -{ - 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/ - 5505024, 19660800, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_11k60*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k15*/ - 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/ - 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ -}; -#endif const Word16 Compl_GSC_freq_bits[] = { 5, 10, 10, 10 /* bitrate > ACELP_16k40 && FS = 16kHz */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index eda099cd9..228d43247 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2533,11 +2533,7 @@ void hq_generic_decoding_fx( IF( L_tmp != 0 ) { exp = norm_l( L_tmp ); -#ifdef EVS_FUNC_MODIFIED frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#else - frac = round_fx( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#endif tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ @@ -2868,11 +2864,7 @@ void hq_generic_decoding_fx( tmp4_fx = mult_r( tmp3_fx, 1638 /* 0.05 in Q15 */ ); WHILE( tmp3_fx > 1024 /* 1 in Q10*/ ) { -#ifdef EVS_FUNC_MODIFIED L_tmp1 = L_shl( Mult_32_16( *pit1_fx, tmp3_fx ), 5 ); /*15 + 5 + 10 -15 */ -#else - L_tmp1 = Mult_32_16( L_shl( *pit1_fx, 5 ), tmp3_fx ); /*15 + 5 + 10 -15 */ -#endif *pit1_fx-- = L_tmp1; move32(); tmp3_fx = sub( tmp3_fx, tmp4_fx ); @@ -3089,11 +3081,7 @@ void hq_generic_decoding_ivas_fx( IF( L_tmp != 0 ) { exp = norm_l( L_tmp ); -#ifdef EVS_FUNC_MODIFIED frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#else - frac = round_fx( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ -#endif tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ @@ -3424,11 +3412,7 @@ void hq_generic_decoding_ivas_fx( tmp4_fx = mult_r( tmp3_fx, 1638 /* 0.05 in Q15 */ ); WHILE( tmp3_fx > 1024 /* 1 in Q10*/ ) { -#ifdef EVS_FUNC_MODIFIED L_tmp1 = L_shl( Mult_32_16( *pit1_fx, tmp3_fx ), 5 ); /*15 + 5 + 10 -15 */ -#else - L_tmp1 = Mult_32_16( L_shl( *pit1_fx, 5 ), tmp3_fx ); /*15 + 5 + 10 -15 */ -#endif *pit1_fx-- = L_tmp1; move32(); tmp3_fx = sub( tmp3_fx, tmp4_fx ); diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index d0b8d0100..8fd876f1c 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2366,11 +2366,7 @@ void ton_ene_est_fx( exp_normn = norm_s( peak_fx[k] ); fac_fx = div_s( shl( temp2_fx, exp_normd ), shl( peak_fx[k], exp_normn ) ); -#ifdef FIX_ISSUE_1062_AND_1068_TON_ENE_EST_FX fac_fx = shl_sat( fac_fx, sub( add( Qss, exp_normn ), add( Qtemp2, exp_normd ) ) ); /* Qtemp2+exp_normd-(Qss+exp_normn)+15 -> 15*/ -#else - fac_fx = shl( fac_fx, sub( add( Qss, exp_normn ), add( Qtemp2, exp_normd ) ) ); /* Qtemp2+exp_normd-(Qss+exp_normn)+15 -> 15*/ -#endif } ni_gain_fx[k] = mult_r( avg_pe_fx[k], fac_fx ); /* Qavg_pe[k] */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 04b6ba187..2a2841966 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -1036,11 +1036,7 @@ static void filt_mu_fx( FOR( n = 0; n < SubFrameLength; n++ ) { temp = mult_r( mu, ( *ptrs++ ) ); -#ifdef FIX_ISSUE_1155 temp = add_sat( temp, *ptrs ); /*Q12 */ -#else - temp = add( temp, *ptrs ); /*Q12 */ -#endif sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); move16(); /*Q12 */ } @@ -5087,7 +5083,6 @@ void GenSHBSynth_fx32( Word32 speech_buf_32k[L_FRAME32k]; Word16 i; -#ifdef FIX_881_HILBERT_FILTER Word16 shift = 0; Word32 maxm32, input_synspeech_temp[L_FRAME16k]; move16(); @@ -5123,9 +5118,6 @@ void GenSHBSynth_fx32( } Interpolate_allpass_steep_fx32( input_synspeech_temp, state_lsyn_filt_shb_local, L_FRAME16k, speech_buf_32k ); -#else - Interpolate_allpass_steep_fx32( input_synspeech, state_lsyn_filt_shb_local, L_FRAME16k, speech_buf_32k ); -#endif IF( EQ_16( L_frame, L_FRAME ) ) { @@ -5148,14 +5140,12 @@ void GenSHBSynth_fx32( } } -#ifdef FIX_881_HILBERT_FILTER IF( maxm32 != 0 ) { Scale_sig32( shb_syn_speech_32k, L_FRAME32k, negate( shift ) ); Scale_sig32( state_lsyn_filt_shb_local, 2 * ALLPASSSECTIONS_STEEP, negate( shift ) ); Scale_sig32( Hilbert_Mem, HILBERT_MEM_SIZE, negate( shift ) ); } -#endif return; } diff --git a/lib_com/tcq_position_arith_fx.c b/lib_com/tcq_position_arith_fx.c index 0466dc133..3abd527ca 100644 --- a/lib_com/tcq_position_arith_fx.c +++ b/lib_com/tcq_position_arith_fx.c @@ -1983,11 +1983,7 @@ Word32 encode_magnitude_tcq_fx( move16(); bits_fx = L_deposit_l( 0 ); -#ifdef IVAS_ISSUE_1188_EVS_CRASH tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - ( nzpos - 1 )] ) ); -#else - tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - nzpos - 1] ) ); -#endif *est_frame_bits_fx = L_add( *est_frame_bits_fx, tcq_bits_fx ); move32(); @@ -2470,11 +2466,7 @@ void decode_mangitude_tcq_fx( move16(); bits_fx = L_deposit_l( 0 ); -#ifdef IVAS_ISSUE_1188_EVS_CRASH tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - ( nzpos - 1 )] ) ); -#else - tcq_bits_fx = L_sub( table_logcum_fx[npulses], L_add( table_logcum_fx[nzpos], table_logcum_fx[npulses - nzpos - 1] ) ); -#endif IF( EQ_16( nzpos, npulses ) ) { diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c index 1fc57871d..b2cee32e6 100644 --- a/lib_com/tcx_mdct_fx.c +++ b/lib_com/tcx_mdct_fx.c @@ -106,9 +106,7 @@ void TCX_MDCT( Word16 i; Word16 factor, neg_factor; Word16 factor_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -164,9 +162,7 @@ void TCX_MDST( Word16 i; Word16 factor, neg_factor; Word16 factor_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -226,9 +222,7 @@ void TCX_MDCT_Inverse( Word16 L2 = l, R2 = r; Word32 tmp_buf[N_MAX + L_MDCT_OVLP_MAX / 2]; Word16 fac_e; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) element_mode; -#endif L2 = shr( l, 1 ); R2 = shr( r, 1 ); diff --git a/lib_com/tools.c b/lib_com/tools.c index e4ccd9955..b1a9f4d13 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -628,45 +628,23 @@ Word16 minimum_s( Word16 *min_val /* o : minimum value in the input vector */ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL Word16 i, ind; -#else - Word16 i, ind, tmp; -#endif ind = 0; move16(); -#ifndef FIX_1105_OPT_MINIMUM_SL - tmp = vec[0]; - move16(); -#endif FOR( i = 1; i < lvec; i++ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL if ( LT_16( vec[i], vec[ind] ) ) { ind = i; move16(); } -#else - IF( LT_16( vec[i], tmp ) ) - { - ind = i; - move16(); - tmp = vec[i]; - move16(); - } -#endif } if ( min_val != NULL ) { -#ifdef FIX_1105_OPT_MINIMUM_SL *min_val = vec[ind]; -#else - *min_val = tmp; -#endif move16(); } @@ -687,45 +665,22 @@ Word16 minimum_l( ) { Word16 i, ind; -#ifndef FIX_1105_OPT_MINIMUM_SL - Word32 tmp; -#endif ind = 0; -#ifndef FIX_1105_OPT_MINIMUM_SL - tmp = vec[0]; -#endif move16(); -#ifndef FIX_1105_OPT_MINIMUM_SL - move32(); -#endif FOR( i = 1; i < lvec; i++ ) { -#ifdef FIX_1105_OPT_MINIMUM_SL if ( LT_32( vec[i], vec[ind] ) ) { ind = i; move16(); } -#else - IF( LT_32( vec[i], tmp ) ) - { - ind = i; - tmp = vec[i]; - move16(); - move32(); - } -#endif } if ( min_val != NULL ) { -#ifdef FIX_1105_OPT_MINIMUM_SL *min_val = vec[ind]; -#else - *min_val = tmp; -#endif move32(); } diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index fad2d64a8..d403c583d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -483,16 +483,10 @@ void Copy( move16(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; @@ -500,9 +494,6 @@ void Copy( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } /*-------------------------------------------------------------------* * Copy64: @@ -524,16 +515,10 @@ void Copy64( move64(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; @@ -541,9 +526,6 @@ void Copy64( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } void set64_fx( @@ -580,16 +562,10 @@ void Copy_pword( move16(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY /* Location of x and y may differ depending on platform/memory allocation. Since IF and ELSE has different complexity count, the early return is used instead of ELSE to ensure the same complexity number regardless of x and y memory addresses. */ return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i].v.im = x[i].v.im; @@ -599,9 +575,6 @@ void Copy_pword( } return; -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } /*-------------------------------------------------------------------* * Copy32: @@ -623,23 +596,14 @@ void Copy32( move32(); } -#ifdef FIX_1052_COPY_CMPLX_DISCREPANCY return; -#endif } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - ELSE - { -#endif FOR( i = L - 1; i >= 0; i-- ) { y[i] = x[i]; move32(); } -#ifndef FIX_1052_COPY_CMPLX_DISCREPANCY - } -#endif } void set8_fx( @@ -688,7 +652,6 @@ void set32_fx( const Word16 N /* i : Lenght of the vector */ ) { -#ifdef FIX_1106_SIMPLIFY_SET32FX Word16 i; FOR( i = 0; i < N; i++ ) @@ -696,26 +659,6 @@ void set32_fx( y[i] = a; move32(); } -#else - Word16 i, tmp; - tmp = extract_l( a ); - IF( EQ_32( L_deposit_l( tmp ), a ) ) - { - FOR( i = 0; i < N; i++ ) - { - y[i] = L_deposit_l( tmp ); - move32(); - } - } - ELSE - { - FOR( i = 0; i < N; i++ ) - { - y[i] = a; - move32(); - } - } -#endif return; } @@ -801,7 +744,6 @@ void Copy_Scale_sig_16_32_DEPREC( } return; } -#ifdef FIX_ISSUE_1237 #ifdef DEBUGGING if ( exp0 >= 16 ) { @@ -809,7 +751,6 @@ void Copy_Scale_sig_16_32_DEPREC( } #else assert( exp0 < 16 ); -#endif #endif tmp = shl_o( 1, exp0, &Overflow ); FOR( i = 0; i < lg; i++ ) diff --git a/lib_com/trans_direct_fx.c b/lib_com/trans_direct_fx.c index d4792fb75..6a3cdf108 100644 --- a/lib_com/trans_direct_fx.c +++ b/lib_com/trans_direct_fx.c @@ -40,9 +40,7 @@ void direct_transform_fx( Word16 shift, Qmin = 31; Word32 L_tmp; Word16 Qs[NUM_TIME_SWITCHING_BLOCKS]; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( element_mode ); -#endif move16(); segment_length = shr( L, 1 ); diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 0033e2c9e..0683e266c 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -515,11 +515,7 @@ void preecho_sb_fx( tmp_fx1 = norm_l( es_mdct_hb_fx[i] ); tmp_fxL1 = L_shl( es_mdct_hb_fx[i], tmp_fx1 ); tmp_fxL2 = L_shl( mean_prev_hb_fx_loc, tmp_fx1 ); -#ifdef FIX_1013_CRASH_HQ_CORE_DEC tmp_fx1 = round_fx_sat( tmp_fxL1 ); -#else - tmp_fx1 = round_fx( tmp_fxL1 ); -#endif tmp_fx2 = round_fx( tmp_fxL2 ); tmp_fx3 = div_s( tmp_fx2, tmp_fx1 ); min_g_hb_fx[i] = Frac_sqrt( tmp_fx3 ); @@ -996,9 +992,7 @@ void Inverse_Transform( Word16 segment_length_div2, segment_length_div4; Word16 tmp, q_out; Word32 L_temp; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( element_mode ); -#endif /* This value is used to right shift all vectors returned by 'iedct_short_fx()' */ /* to bring them to a scaling that is equal to the 1st 'Q' returned by the 1st */ /* call to 'iedct_short_fx()' minus these guard bits. */ diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 34d01d7fe..74f1bfc09 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1590,11 +1590,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[*pPlocs], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( *pPlocs ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1605,11 +1601,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && EQ_16( *pPlocs, 1 ) ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[*pPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( *pPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1655,11 +1647,7 @@ static void ivas_spec_ana_fx( IF( EQ_16( currPlocs, ( sub( Lprot2_1, DELTA_CORR_F0_INT ) ) ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[currPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( currPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1673,11 +1661,7 @@ static void ivas_spec_ana_fx( * whould point */ IF( n > 0 ) /* fs/2 which makes special case . */ { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 -#else - Copy_Scale_sig_16_32_DEPREC( &xfp[currPlocs - 2], xfp_32, 3, Q16 ); // Q + 16 -#endif acc = L_deposit_h( sub( currPlocs, 2 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -4005,11 +3989,7 @@ static void ivas_fec_ecu_dft_fx( tmp = Exp16Array( *Nfft, Tfr16 ); *exp = add( tmp, add( 2, norm_s( *Nfft ) ) ); move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#else - Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif *exp = s_min( *exp, 15 ); DoRTFTn_fx( Tfr32, Tfi32, *Nfft ); @@ -4125,20 +4105,12 @@ static void fec_ecu_dft_fx( tmp = Exp16Array( *Nfft, Tfr16 ); *exp = add( tmp, add( 2, norm_s( *Nfft ) ) ); move16(); -#ifdef FIX_ISSUE_1237 { -#ifdef FIX_ISSUE_1237_KEEP_EVS_BE Word16 loctmp = *exp; move16(); loctmp = s_min( 15, loctmp ); Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, loctmp ); /*Qin+exp; */ /*Even with limiting loctmp, if Copy_Scale_sig_16_32_no_sat() is used, can lead to 1 difference */ -#else - Copy_Scale_sig_16_32_no_sat( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif } -#else - Copy_Scale_sig_16_32_DEPREC( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */ -#endif DoRTFTn_fx( Tfr32, Tfi32, *Nfft ); N_LP = shr( *Nfft, 1 ); diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 35bb254af..612816efd 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -504,11 +504,7 @@ void FEC_exc_estim_fx( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && st_fx->inactive_coder_type_flag && !st_fx->Opt_AMR_WB ) ) -#else - IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && LE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && !st_fx->Opt_AMR_WB ) ) -#endif { st_fx->GSC_noisy_speech = st_fx->Last_GSC_noisy_speech_flag; move16(); @@ -670,11 +666,7 @@ void FEC_exc_estim_fx( test(); test(); test(); -#ifdef NONBE_FIX_GSC_BSTR IF( EQ_16( st_fx->last_coder_type, AUDIO ) || ( EQ_16( st_fx->last_good, INACTIVE_CLAS ) && st_fx->inactive_coder_type_flag && !st_fx->Opt_AMR_WB ) ) -#else - IF( ( EQ_16( st_fx->last_coder_type, AUDIO ) || EQ_16( st_fx->last_good, INACTIVE_CLAS ) ) && LE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && !st_fx->Opt_AMR_WB ) -#endif { /* For GSC - the excitation is already computed */ Copy( exc, exc2, st_fx->L_frame ); diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index e50abddd6..e820f1399 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -76,13 +76,11 @@ void ivas_DetectTonalComponents_fx( pScaledMdctSpectrum[i] = L_shl( lastMDCTSpectrum[i], 16 ); /*15-lastMDCTSpectrum_exp+16 -> 31 - lastMDCTSpectrum_exp*/ move32(); } -#ifdef MSAN_FIX FOR( Word16 i = 0; i < FDNS_NPTS; i++ ) { sns_int_scf_fx[i] = L_shl_sat( scaleFactors[i], add( 1, scaleFactors_exp[i] ) ); // Q16 move32(); } -#endif IF( psychParamsCurrent == NULL ) { nBands = FDNS_NPTS; @@ -94,12 +92,6 @@ void ivas_DetectTonalComponents_fx( } ELSE { -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < FDNS_NPTS; i++ ) - { - sns_int_scf_fx[i] = L_shl( scaleFactors[i], add( 1, scaleFactors_exp[i] ) ); // Q16 - } -#endif q_pScaledMdctSpectrum = sub( 31, lastMDCTSpectrum_exp ); sns_shape_spectrum_fx( pScaledMdctSpectrum, &q_pScaledMdctSpectrum, psychParamsCurrent, sns_int_scf_fx, 16, nSamplesCore, NULL ); q_pScaledMdctSpectrum = add( q_pScaledMdctSpectrum, 1 ); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 0f94a7558..7a3c78644 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -113,7 +113,6 @@ ivas_error acelp_core_dec_fx( FD_BWE_DEC_HANDLE hBWE_FD; TCX_DEC_HANDLE hTcxDec; ivas_error error; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( tdm_lspQ_PCh ); (void) ( tdm_lsfQ_PCh ); (void) ( use_cldfb_for_dft ); @@ -125,7 +124,6 @@ ivas_error acelp_core_dec_fx( (void) ( output ); (void) ( read_sid_info ); (void) hStereoCng; -#endif hMusicPF = st_fx->hMusicPF; hBPF = st_fx->hBPF; hBWE_TD = st_fx->hBWE_TD; @@ -666,21 +664,13 @@ ivas_error acelp_core_dec_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif test(); test(); IF( EQ_16( st_fx->coder_type, TRANSITION ) && LT_16( tc_subfr_fx, L_SUBFR ) && EQ_16( st_fx->L_frame, L_FRAME ) ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, TRANSITION, -1, tc_subfr_fx, 2, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_fx, 2, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif } } diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 2ca524bb0..5807f2c67 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -83,22 +83,14 @@ ivas_error acelp_core_dec_ivas_fx( Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ -#ifdef MSAN_FIX Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ -#else - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ -#endif Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ Word32 enr_q_fx; /* E information for FER protection */ Word16 tmp_noise_fx; /* Long term temporary noise energy */ Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ Word16 FEC_pitch_fx; /* FEC pitch */ -#ifdef MSAN_FIX Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ -#else - Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ -#endif Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ Word16 i, j, int_fs; Word16 tc_subfr; @@ -133,13 +125,9 @@ ivas_error acelp_core_dec_ivas_fx( ivas_error error; Word32 bpf_error_signal_fx[L_FRAME16k]; -#ifdef MSAN_FIX set32_fx( bpf_error_signal_fx, 0, L_FRAME16k ); -#endif Word16 bpf_error_signal_16fx[L_FRAME16k]; -#ifdef MSAN_FIX set16_fx( bpf_error_signal_16fx, 0, L_FRAME16k ); -#endif set16_fx( Aq_fx, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( old_bwe_exc_fx, 0, ( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ) ); Word16 tmp; @@ -178,7 +166,6 @@ ivas_error acelp_core_dec_ivas_fx( IF( EQ_32( st->core_brate, SID_2k40 ) ) { FdCng_decodeSID_ivas_fx( st ); -#ifdef FIX_ISSUE_1218 Word16 n1, n2; n1 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART ); n2 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART ); @@ -188,9 +175,6 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( old_NoiseEstExp, common_e ) ); st->hFdCngDec->hFdCngCom->sidNoiseEstExp = common_e; move16(); -#else - rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ); -#endif } FOR( i = 0; i < NPART; i++ ) { @@ -621,11 +605,7 @@ ivas_error acelp_core_dec_ivas_fx( { test(); test(); -#ifdef FIX_1189_GSC_IVAS_OMASA IF( EQ_16( st->coder_type, AUDIO ) || ( EQ_16( st->coder_type, INACTIVE ) && EQ_16( st->inactive_coder_type_flag, 1 ) ) ) -#else - IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) -#endif { st->GSC_IVAS_mode = get_next_indice_fx( st, 2 ); move16(); @@ -642,14 +622,6 @@ ivas_error acelp_core_dec_ivas_fx( IF( st->cng_type == LP_CNG ) { CNG_dec_ivas_fx( st, last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, sid_bw, q_env_fx ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING - FOR( Word32 nsf = 0; nsf < NB_SUBFR16k; nsf++ ) - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif Copy( Aq_fx, st->Aq_cng, add( M, 1 ) ); /* comfort noise generation */ @@ -746,11 +718,7 @@ ivas_error acelp_core_dec_ivas_fx( IF( st->hMusicPF && st->hGSCDec ) { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, -#ifdef FIX_ISSUE_1291 L_FRAME32k, 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); -#else - imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); -#endif } IF( st->hPFstat != NULL ) { @@ -781,9 +749,6 @@ ivas_error acelp_core_dec_ivas_fx( /* synthesis at 12.8kHz sampling rate */ -#ifndef FIX_1100_REMOVE_LPC_RESCALING - Aq_fx[0] = ONE_IN_Q12; -#endif move16(); syn_12k8_fx( st->L_frame, Aq_fx, exc2_fx, psyn_fx, st->mem_syn2_fx, 1, st->Q_exc, st->Q_syn ); syn_12k8_fx( st->L_frame, Aq_fx, exc3_fx, syn1_fx, st->mem_syn3_fx, 1, st->Q_exc, st->Q_syn ); @@ -804,11 +769,7 @@ ivas_error acelp_core_dec_ivas_fx( Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn -> Q(-1) IF( st->hBWE_FD != NULL ) { -#ifdef FIX_ISSUE_1290 save_old_syn_fx( st->L_frame, temp_buf_fx, old_syn_12k8_16k_fx, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); -#else - save_old_syn_fx( st->L_frame, syn1_fx, old_syn_12k8_16k_fx, st->hBWE_FD->old_syn_12k8_16k_fx, st->preemph_fac, &st->hBWE_FD->mem_deemph_old_syn_fx ); -#endif } } @@ -848,21 +809,13 @@ ivas_error acelp_core_dec_ivas_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif test(); test(); IF( EQ_16( st->coder_type, TRANSITION ) && LT_16( tc_subfr, L_SUBFR ) && EQ_16( st->L_frame, L_FRAME ) ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } } @@ -944,18 +897,6 @@ ivas_error acelp_core_dec_ivas_fx( st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame ); move16(); } -#ifndef FIX_1100_REMOVE_LPC_RESCALING -#ifndef MSAN_FIX - for ( int nsf = 0; nsf < NB_SUBFR16k; nsf++ ) -#else - FOR( Word32 nsf = 0; nsf < st->nb_subfr; nsf++ ) -#endif - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); // Q(x-2) - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif test(); IF( EQ_16( st->last_core, HQ_CORE ) && st->element_mode > EVS_MONO ) { @@ -1129,11 +1070,7 @@ ivas_error acelp_core_dec_ivas_fx( * Apply energy matching when switching to inactive frames *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->L_frame, st->total_brate, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /*------------------------------------------------------------* * Decode information and modify the excitation signal of stationary unvoiced frames @@ -1291,18 +1228,6 @@ ivas_error acelp_core_dec_ivas_fx( lsf_dec_bfi( MODE1, lsf_new_fx, st->lsf_old_fx, st->lsf_adaptive_mean_fx, NULL, st->mem_MA_fx, st->mem_AR_fx, st->stab_fac_fx, st->last_coder_type, st->L_frame, st->last_good, st->nbLostCmpt, 0, NULL, NULL, NULL, st->hGSCDec->Last_GSC_pit_band_idx, st->Opt_AMR_WB, 0, st->bwidth ); FEC_lsf2lsp_interp( st, st->L_frame, Aq_fx, lsf_new_fx, lsp_new_fx ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING -#ifndef MSAN_FIX - for ( int nsf = 0; nsf < NB_SUBFR16k; nsf++ ) -#else - FOR( Word32 nsf = 0; nsf < st->nb_subfr; nsf++ ) -#endif - { - Scale_sig( Aq_fx + imult3216( nsf, ( M + 1 ) ), M + 1, sub( norm_s( Aq_fx[nsf * ( M + 1 )] ), Q2 ) ); // Qx->Q(x-2) - Aq_fx[nsf * ( M + 1 )] = ONE_IN_Q12; - move16(); - } -#endif IF( EQ_16( st->nelp_mode_dec, 1 ) ) { /* SC-VBR */ @@ -1340,11 +1265,7 @@ ivas_error acelp_core_dec_ivas_fx( } /* Apply energy matching when switching to inactive frames */ -#ifdef NONBE_FIX_GSC_BSTR Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - Inac_switch_ematch_ivas_fx( exc2_fx, dct_exc_tmp_fx, st->hGSCDec->lt_ener_per_band_fx, st->coder_type, st->L_frame, st->total_brate, st->Q_exc, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /* update past excitation signals for LD music post-filter */ IF( st->hMusicPF != NULL ) @@ -1766,23 +1687,14 @@ ivas_error acelp_core_dec_ivas_fx( pRealSave_fx[i] = realBufferSave_fx[i]; pImagSave_fx[i] = imagBufferSave_fx[i]; } -#ifndef MSAN_FIX - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 -#endif IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 -#endif Copy32( bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame ); Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); // Q11 } -#ifdef MSAN_FIX FOR( i = 0; i < st->L_frame; i++ ) -#else - for ( i = 0; i < L_FRAME16k; i++ ) -#endif { syn_32_fx[i] = L_shr( L_deposit_h( psyn_fx[i] ), add( 4, st->Q_syn ) ); // Q12 move32(); @@ -1803,15 +1715,7 @@ ivas_error acelp_core_dec_ivas_fx( q_bpf_error_signal = Q6; move16(); -#ifdef MSAN_FIX -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, st->L_frame, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, st->L_frame, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#endif -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, q_bpf_error_signal - st->Q_syn ); // Q6 -#endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, -Q7 ); // Q0 @@ -1910,9 +1814,6 @@ ivas_error acelp_core_dec_ivas_fx( #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifndef MSAN_FIX - Scale_sig32( save_hb_synth_fx, L_FRAME48k, sub( Q_real, 1 ) ); // Q_real-1 -#endif FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { @@ -1932,11 +1833,7 @@ ivas_error acelp_core_dec_ivas_fx( } } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, 0, st->cldfbSynHB ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, st->cldfbSynHB ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( save_hb_synth_fx, L_FRAME48k, negate( ( sub( Q_real, 1 ) ) ) ); // Q0 Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 @@ -1956,11 +1853,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // Q_real-1 st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( synth_fx, L_FRAME48k, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSynHB->Q_cldfb_state = Q10; @@ -2003,20 +1896,9 @@ ivas_error acelp_core_dec_ivas_fx( #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 ); -#endif -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ -#ifdef MSAN_FIX scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 -#else - Scale_sig32( synth_fx, L_FRAME48k, -( Q_real - 1 ) ); -#endif scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -2030,11 +1912,7 @@ ivas_error acelp_core_dec_ivas_fx( Word16 nSamples = NS2SA_FX2( i_mult( st->L_frame, FRAMES_PER_SEC ), FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ); /* IVAS-64: optimization is likely possible here (don't resample the whole frame) */ /* analysis of the synthesis at internal sampling rate - needed for DFT stereo -> TD stereo switching */ -#ifndef MSAN_FIX - for ( i = 0; i < L_FRAME16k; i++ ) -#else FOR( i = 0; i < st->L_frame; i++ ) -#endif { syn_32_fx[i] = L_shr( L_deposit_h( psyn_fx[i] ), add( 4, st->Q_syn ) ); move32(); @@ -2057,11 +1935,7 @@ ivas_error acelp_core_dec_ivas_fx( // Get Q-factor q_bpf_error_signal = Q6; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#else - Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, sub( q_bpf_error_signal, st->Q_syn ) ); // Q6 -#endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, -Q7 ); // Q0 @@ -2116,21 +1990,10 @@ ivas_error acelp_core_dec_ivas_fx( #else /* OPT_STEREO_32KBPS_V1 */ scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 ); -#endif -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ -#ifdef MSAN_FIX Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 -#else - Scale_sig32( synth_fx, L_FRAME48k, -( Q_real - 1 ) ); -#endif Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -2146,11 +2009,7 @@ ivas_error acelp_core_dec_ivas_fx( } /* Copy output signal */ -#ifndef MSAN_FIX - Scale_sig( syn_tmp_fx, L_FRAME16k + L_SUBFR, -st->Q_syn ); -#else Scale_sig( syn_tmp_fx, add( st->L_frame, L_SUBFR ), negate( st->Q_syn ) ); // Q0 -#endif IF( st->element_mode > EVS_MONO ) { Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/ @@ -2173,24 +2032,14 @@ ivas_error acelp_core_dec_ivas_fx( IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 -#else - Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); -#endif hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); -#ifdef MSAN_FIX Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 ); -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, L_FRAME48k, 0 ); -#endif } ELSE { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } } @@ -2225,11 +2074,7 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( !st->ppp_mode_dec && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#else - Copy_Scale_sig_16_32_DEPREC( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#endif non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } @@ -2270,18 +2115,7 @@ ivas_error acelp_core_dec_ivas_fx( { Copy_Scale_sig_32_16( save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0 ); // Q0 } -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2 -#else - Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); -#endif -#ifndef FIX_1100_REMOVE_LPC_RESCALING - if ( st->hFdCngDec ) - { - st->hFdCngDec->hFdCngCom->A_cng[0] = ONE_IN_Q12; - move16(); - } -#endif } pop_wmops(); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 6a1e60b06..9013f2f03 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -128,11 +128,7 @@ ivas_error acelp_core_switch_dec_fx( * Excitation decoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 ); -#else - config_acelp1( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 ); -#endif decod_gen_voic_core_switch_fx( st_fx, L_frame_for_cs, 0, Aq, exc, cbrate, &st_fx->Q_exc ); @@ -819,11 +815,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( *----------------------------------------------------------------*/ /* CLDFB analysis of the synthesis at internal sampling rate */ Qtmp = sub( 11, st_fx->Q_syn ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( syn, syn32, L_FRAME16k, Qtmp ); // Q(11) -#else - Copy_Scale_sig_16_32_DEPREC( syn, syn32, L_FRAME16k, Qtmp ); // Q(11) -#endif IF( NE_32( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbAna ) ), IVAS_ERR_OK ) ) { return error; @@ -845,11 +837,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( move16(); Copy_Scale_sig_16_32_DEPREC( synth_out, synth32, L_FRAME48k, 5 ); /*11-5-1*/ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), 0, st_fx->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), st_fx->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( st_fx->cldfbSyn->cldfb_state_fx, st_fx->cldfbSyn->cldfb_state_length, -1 ); // Q_cldfb_state-1 st_fx->cldfbSyn->Q_cldfb_state = sub( st_fx->cldfbSyn->Q_cldfb_state, 1 ); move16(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 1f6b0dd51..05125318f 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -898,9 +898,7 @@ ivas_error core_switching_post_dec_fx( HQ_DEC_HANDLE hHQ_core; ivas_error error; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( last_element_mode ); -#endif hBWE_TD = st_fx->hBWE_TD; hBWE_FD = st_fx->hBWE_FD; hHQ_core = st_fx->hHQ_core; @@ -2058,11 +2056,7 @@ static void core_switch_lb_upsamp_fx( } /* synthesis of the combined signal */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ /*rescaling whole buffer to a common Q*/ no_col = st->cldfbSyn->no_col; @@ -2100,13 +2094,8 @@ static void smoothTransitionDtxToTcx_fx( Word16 i, filter_len; Word16 w, step, fade_in; Word32 mem; -#ifdef MSAN_FIX - Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; -#else Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; -#endif set16_fx( smoothing_input_buffer, 0, 2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k ); set16_fx( smoothing_out_buffer, 0, 2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k ); @@ -2241,10 +2230,8 @@ ivas_error core_switching_pre_dec_ivas_fx( test(); IF( st->hBWE_TD != NULL && ( st->last_core != ACELP_CORE ) ) { -#ifdef MSAN_FIX st->hBWE_TD->prev_hb_synth_fx_exp = 31; move16(); -#endif // MSAN_FIX /* reset BWE memories */ set16_fx( st->hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; @@ -2262,9 +2249,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2379,11 +2364,7 @@ ivas_error core_switching_pre_dec_ivas_fx( return error; } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, 0, st->cldfbSyn ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, st->cldfbSyn ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ cldfb_restore_memory_ivas_fx( st->cldfbSyn ); Copy_Scale_sig_32_16( syn_Overl_fx, st->hTcxDec->syn_Overl, 320, 15 ); Copy_Scale_sig_32_16( fer_samples_fx, st->hHQ_core->fer_samples_fx, 960, 9 ); @@ -2587,9 +2568,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2639,9 +2618,7 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->hBWE_FD != NULL ) @@ -2662,11 +2639,7 @@ ivas_error core_switching_pre_dec_ivas_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for old_synth_lenFB (32 bit) \n" ) ); } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hTcxDec->old_synthFB_fx, old_synthFB_fx, st->hTcxDec->old_synth_lenFB, sub( Q10, Q_old_synthFB ) ); // Q10 -#else - Copy_Scale_sig_16_32_DEPREC( st->hTcxDec->old_synthFB_fx, old_synthFB_fx, st->hTcxDec->old_synth_lenFB, sub( Q10, Q_old_synthFB ) ); // Q10 -#endif Copy32( old_synthFB_fx + st->hTcxDec->old_synth_lenFB - offset, st->cldfbAna->cldfb_state_fx, offset ); st->cldfbAna->Q_cldfb_state = Q10; move16(); diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index bdfac224f..325beb9f3 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -693,11 +693,7 @@ ivas_error decod_gen_voic_ivas_fx( * Transform domain contribution decoding *-----------------------------------------------------------------*/ test(); -#ifdef NONBE_FIX_GSC_BSTR IF( !st_fx->inactive_coder_type_flag && st_fx->coder_type == INACTIVE ) -#else - IF( GE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && ( st_fx->coder_type == INACTIVE ) ) -#endif { transf_cdbk_dec_fx( st_fx, harm_flag_acelp, i_subfr_fx, Es_pred_fx, gain_code_fx, &gain_preQ_fx, &norm_gain_preQ_fx, code_preQ_fx, unbits ); } diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 8ff50f8a5..e2ea02dcc 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -2682,11 +2682,7 @@ void IMDCT_ivas_fx( } move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE set16_fx( win_fx, 0, ( L_FRAME_PLUS + L_MDCT_OVLP_MAX ) >> 1 ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - set16_fx( win_fx, 0, shr( add( L_FRAME_PLUS, L_MDCT_OVLP_MAX ), 1 ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 tcx_offset_tmp = add( tcx_offset, shr( L_ola, 1 ) ); set16_fx( xn_buf_fx, 0, tcx_offset_tmp ); /* zero left end of buffer */ @@ -2865,16 +2861,10 @@ void IMDCT_ivas_fx( q_tmp_fx_32 = q_xn_buf_fx_32; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 diff = sub( q_tmp_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx_32[ind] = L_shl( old_out_fx[ind], diff ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx_32[ind] = L_shl( old_out_fx[ind], sub( q_tmp_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move32(); } @@ -2882,13 +2872,8 @@ void IMDCT_ivas_fx( FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx[ind] = extract_l( L_shr( old_out_fx_32[ind], diff ) ); xn_buf_fx[ind] = extract_l( L_shr( xn_buf_fx_32[ind], diff ) ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx[ind] = (Word16) L_shr( old_out_fx_32[ind], sub( q_tmp_fx_32, q_win ) ); - xn_buf_fx[ind] = (Word16) L_shr( xn_buf_fx_32[ind], sub( q_tmp_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move16(); move16(); } @@ -2912,39 +2897,24 @@ void IMDCT_ivas_fx( q_tmp_fx_32 = sub( q_xn_buf_fx_32, res_e ); // v_multc_fixed( xn_buf_fx_32 + overlap / 2 + nz, (float) sqrt( (float) L_frame / NORM_MDCT_FACTOR ), tmp_fx_32, L_frame ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 q_diff = sub( q_xn_buf_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE xn_buf_fx[( ind + ( overlap / 2 ) ) + nz] = extract_l( L_shr( xn_buf_fx_32[( ind + ( overlap / 2 ) ) + nz], q_diff ) ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - xn_buf_fx[( ind + ( overlap / 2 ) ) + nz] = (Word16) L_shr( xn_buf_fx_32[( ind + ( overlap / 2 ) ) + nz], sub( q_xn_buf_fx_32, q_win ) ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move16(); } window_ola_fx( tmp_fx_32, xn_buf_fx, &q_tmp_fx_32, old_out_fx, &q_old_out, L_frame, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE q_diff = sub( q_old_out, q_win ); Word16 diff = sub( q_tmp_fx_32, q_win ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( Word16 ind = 0; ind < L_frame; ind++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE old_out_fx[ind] = shr_sat( old_out_fx[ind], q_diff ); move16(); xn_buf_fx[ind] = shr_sat( xn_buf_fx[ind], diff ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - old_out_fx[ind] = shr_sat( old_out_fx[ind], sub( q_old_out, q_win ) ); - move16(); - xn_buf_fx[ind] = shr_sat( xn_buf_fx[ind], sub( q_tmp_fx_32, q_win ) ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } } aldo = 1; @@ -4441,11 +4411,7 @@ void decoder_tcx_noisefilling_fx( /* get the starting location of the subframe in the frame */ IF( EQ_16( st->core, TCX_10_CORE ) ) { -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->subframe_fx = extract_l( L_mult0( frame_cnt, L_frameTCX_glob ) ); -#else - st->hPlcInfo->subframe = extract_l( L_mult0( frame_cnt, L_frameTCX_glob ) ); -#endif move16(); } } diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index f9833e80a..0bc7794dc 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -713,7 +713,6 @@ void decision_matrix_dec_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ @@ -727,6 +726,5 @@ void decision_matrix_dec_fx( move16(); } -#endif return; } diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index c509d5d10..df18d3dba 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -187,9 +187,7 @@ void initFdCngDec_ivas_fx( st->CNG_mode = -1; move16(); Copy( st->lsp_old_fx, st->lspCNG_fx, M ); /*Q15*/ -#ifdef MSAN_FIX hFdCngDec->hFdCngCom->sid_frame_counter = 0; -#endif return; } @@ -1765,12 +1763,8 @@ Word16 ApplyFdCng_ivas_fx( { FOR( ; j <= hFdCngCom->part[k]; j++ ) { -#ifdef FIX_ISSUE_1218 /* NOTE: saturation is added here as part of issue 1218 fix. after rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ cngNoiseLevel[j] = L_shl_sat( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ -#else - cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/ -#endif move32(); } } @@ -5275,11 +5269,7 @@ void generate_stereo_masking_noise_fx( IF( st->idchan == 0 ) { hFdCngCom = st->hFdCngDec->hFdCngCom; -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ -#else - Copy_Scale_sig_16_32_DEPREC( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ -#endif Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ set32_fx( &Np_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); @@ -5287,11 +5277,7 @@ void generate_stereo_masking_noise_fx( IF( !fadeOut ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ -#else - Copy_Scale_sig_16_32_DEPREC( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ -#endif generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 /* Generate masking noise for secondary channel */ IF( flag_sec_CNA ) diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c index 6c63377fd..8f29eb9d1 100644 --- a/lib_dec/gs_dec_fx.c +++ b/lib_dec/gs_dec_fx.c @@ -92,11 +92,7 @@ void decod_audio_fx( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics @@ -522,11 +518,7 @@ void decod_audio_ivas_fx( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics @@ -1372,14 +1364,10 @@ void gsc_dec_ivas_fx( } pvq_core_dec_fx( st_fx, gsc_sfm_start, gsc_sfm_end, gsc_sfm_size, concat_out, &Q_tmp, bit, nb_subbands, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE ); -#ifdef MSAN_FIX IF( nb_subbands > 0 ) { Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */ } -#else - Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */ -#endif seed_init = 0; move16(); @@ -1435,11 +1423,7 @@ void gsc_dec_ivas_fx( } if ( concat_out[j] < 0 ) { -#ifdef BASOP_NOGLOB_TMP_715 seed_init = add_sat( seed_init, 3 ); /* Q0 */ -#else - seed_init = add( seed_init, 3 ); -#endif } } diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 714245514..4d1ef6774 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -627,9 +627,7 @@ void ivas_hq_core_dec_fx( set16_fx( gapsynth_fx, 0, L_FRAME48k ); set16_fx( num_bands_p, 0, MAX_SB_NB ); set16_fx( ynrm, 39, NB_SFM ); /* Initialize to the smallest value */ -#ifdef MSAN_FIX set16_fx( wtda_audio_16, 0, 2 * L_FRAME48k ); -#endif mean_en_high_fx = 0; move16(); Q_audio = 12; @@ -951,9 +949,6 @@ void ivas_hq_core_dec_fx( index = tcx_cfg->tcx_last_overlap_mode; /* Q0 */ move16(); -#ifndef MSAN_FIX - Copy_Scale_sig_32_16( wtda_audio, wtda_audio_16, 2 * L_FRAME48k, -13 ); -#endif /* LB synthesis */ E_audio = sub( 31, Q_audio ); diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c index d72f0ec45..89864bc3b 100644 --- a/lib_dec/hq_hr_dec_fx.c +++ b/lib_dec/hq_hr_dec_fx.c @@ -100,7 +100,6 @@ void hq_pred_hb_bws_fx( } ELSE { -#ifdef EVS_FUNC_MODIFIED st_fx->prev_ener_shb_fx = 0; move16(); L_tmp = L_deposit_l( 0 ); @@ -111,15 +110,6 @@ void hq_pred_hb_bws_fx( L_tmp = Mpy_32_16_1( L_tmp, 2979 ); // Q1 st_fx->prev_ener_shb_fx = extract_l( L_tmp ); /*Q1*/ move16(); -#else - st_fx->prev_ener_shb_fx = 0; - move16(); - FOR( i = 0; i < SWB_FENV - 3; i++ ) - { - st_fx->prev_ener_shb_fx = add( st_fx->prev_ener_shb_fx, SWB_fenv[i] ); /*Q1*/ - } - st_fx->prev_ener_shb_fx = mult( st_fx->prev_ener_shb_fx, 2979 ); /*Q1*/ -#endif } } diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 5bfa7476a..60e649a08 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2883,9 +2883,6 @@ static void IGF_getWhiteSpectralData_ivas( Word16 j; Word32 ak; Word16 ak_e; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Word16 tmp_16; -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 tmp_e; Word16 out_e_arr[IGF_START_MX + MAX_IGF_SFB_LEN]; Word16 max_out_e; @@ -2904,23 +2901,18 @@ static void IGF_getWhiteSpectralData_ivas( Word16 guard_bits = add( find_guarded_bits_fx( add( i_mult( 2, level ), 1 ) ), 1 ) / 2; s_l = sub( s_l, guard_bits ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 shift = sub( shl( s_l, 1 ), 32 ); Word16 eff_e = sub( shl( sub( in_e, s_l ), 1 ), 15 ); Word16 diff = add( 21, in_e ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 quo = BASOP_Util_Divide3216_Scale( ONE_IN_Q30, add( shl( level, 1 ), 1 ), &tmp_e ); tmp_e = add( tmp_e, 1 ); ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15 -#ifdef OPT_SBA_AVOID_SPAR_RESCALE ak_e = sub( ak_e, 1 ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( i = start; i < stop - level; i++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word64 temp = 0; move64(); FOR( j = i - level; j < i + level + 1; j++ ) @@ -2935,30 +2927,11 @@ static void IGF_getWhiteSpectralData_ivas( out_e_arr[i] = sub( diff, n ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ak = 0; - move32(); - move32(); - FOR( j = i - level; j < i + level + 1; j++ ) - { - tmp_16 = extract_h( L_shl( in[j], s_l ) ); // e: in_e - s_l - ak = L_mac( ak, tmp_16, tmp_16 ); // e: 2 * (in_e - s_l) - } - ak = Mult_32_16( ak, quo ); // add( shl( level, 1 ), 1 ), &tmp_e ) ); - - - n = sub( 30, add( norm_l( ak ), sub( 31, ak_e ) ) ); - n = shr( n, 1 ); - - out_e_arr[i] = add( sub( 21, n ), in_e ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ max_out_e = s_max( max_out_e, out_e_arr[i] ); } FOR( ; i < stop; i++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word64 temp = 0; move64(); @@ -2974,24 +2947,6 @@ static void IGF_getWhiteSpectralData_ivas( out_e_arr[i] = sub( diff, n ); move16(); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ak = 0; - move32(); - - FOR( j = i - level; j < stop; j++ ) - { - tmp_16 = extract_h( L_shl( in[j], s_l ) ); // e: in_e - s_l - ak = L_mac( ak, tmp_16, tmp_16 ); // e: 2 * (in_e - s_l) - } - ak = L_deposit_h( BASOP_Util_Divide3216_Scale( ak, sub( stop, sub( i, level ) ), &tmp_e ) ); - ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15 - - n = sub( 30, add( norm_l( ak ), sub( 31, ak_e ) ) ); - n = shr( n, 1 ); - - out_e_arr[i] = add( sub( 21, n ), in_e ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ max_out_e = s_max( max_out_e, out_e_arr[i] ); } diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 934433132..b588fdce1 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -315,10 +315,8 @@ ivas_error init_decoder_fx( move16(); /*1; Q15*/ st_fx->exc_pe_fx = 0; // Q_stat_noise move16(); -#ifdef MSAN_FIX st_fx->Q_stat_noise = 31; move16(); -#endif // MSAN_FIX /*-----------------------------------------------------------------* * LD music post-filter *-----------------------------------------------------------------*/ @@ -1036,10 +1034,8 @@ ivas_error init_decoder_ivas_fx( move16(); st_fx->exc_pe_fx = 0; move16(); -#ifdef MSAN_FIX st_fx->Q_stat_noise = 31; move16(); -#endif st_fx->prev_coder_type = GENERIC; move16(); @@ -1139,9 +1135,7 @@ ivas_error init_decoder_ivas_fx( } hf_synth_init_fx( st_fx->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } ELSE { diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 85fefadbc..f78f14e8e 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -66,17 +66,11 @@ static void ivas_binRenderer_filterModule_fx( { Word16 bandIdx, k, chIdx, tapIdx; Word32 *filterStatesLeftRealPtr_fx, *filterStatesLeftImagPtr_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStates; -#else /* OPT_BASOP_ADD_v1 */ - Word16 *Q_filterStates; -#endif /* OPT_BASOP_ADD_v1 */ const Word32 *filterTapsLeftRealPtr_fx, *filterTapsLeftImagPtr_fx, *filterTapsRightRealPtr_fx, *filterTapsRightImagPtr_fx; Word16 shift_q; -#ifdef OPT_BASOP_ADD_v1 Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStatesLeft; move16(); -#endif /* OPT_BASOP_ADD_v1 */ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -84,9 +78,6 @@ static void ivas_binRenderer_filterModule_fx( { filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] ); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates = (Word16 *) &( hBinRenderer->hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx][0] ); -#endif /* OPT_BASOP_ADD_v1 */ filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29 filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29 @@ -108,13 +99,6 @@ static void ivas_binRenderer_filterModule_fx( filterStatesLeftImagPtr_fx[tapIdx] = filterStatesLeftImagPtr_fx[tapIdx - 1]; move32(); -#ifndef OPT_BASOP_ADD_v1 - shift_q = sub( Q_filterStates[tapIdx], Q_filterStates[tapIdx - 1] ); - outRealLeft_fx = W_shr( outRealLeft_fx, shift_q ); - outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); - outRealRight_fx = W_shr( outRealRight_fx, shift_q ); - outImagRight_fx = W_shr( outImagRight_fx, shift_q ); -#endif /* OPT_BASOP_ADD_v1 */ outRealLeft_fx = W_mac_32_32( outRealLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates outRealLeft_fx = W_mac_32_32( outRealLeft_fx, L_negate( filterStatesLeftImagPtr_fx[tapIdx] ), filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates @@ -127,40 +111,24 @@ static void ivas_binRenderer_filterModule_fx( outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates[tapIdx] = Q_filterStates[tapIdx - 1]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ } -#ifdef OPT_BASOP_ADD_v1 shift_q = add( sub( Q_filterStates, Q_curr ), 1 ); -#else /* OPT_BASOP_ADD_v1 */ - shift_q = add( sub( Q_filterStates[1], Q_curr ), 1 ); -#endif /* OPT_BASOP_ADD_v1 */ -#ifdef OPT_BASOP_ADD_v1 IF( shift_q != 0 ) { -#endif /* OPT_BASOP_ADD_v1 */ outRealLeft_fx = W_shr( outRealLeft_fx, shift_q ); // Q_curr outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); // Q_curr outRealRight_fx = W_shr( outRealRight_fx, shift_q ); // Q_curr outImagRight_fx = W_shr( outImagRight_fx, shift_q ); // Q_curr -#ifdef OPT_BASOP_ADD_v1 hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx]; move32(); filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx]; move32(); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates[0] = Q_curr; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ /* Left Real and Imag */ @@ -346,12 +314,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft = (Word16 ***) malloc( hBinRenderer->conv_band * sizeof( Word16 ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -365,12 +327,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[bandIdx] = (Word16 **) malloc( hBinRenderer->nInChannels * sizeof( Word16 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { @@ -384,12 +340,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] = (Word16 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ } } /* set memories */ @@ -434,12 +384,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); -#endif /* OPT_BASOP_ADD_v1 */ IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp]; @@ -453,12 +399,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); -#endif /* OPT_BASOP_ADD_v1 */ IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp]; @@ -1323,10 +1265,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] ); - hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); @@ -1335,10 +1273,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft[bandIdx] ); - hBinRenConvModule->Q_filterStatesLeft[bandIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx ); @@ -1347,10 +1281,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx ); hBinRenConvModule->filterStatesLeftImag_fx = NULL; -#ifndef OPT_BASOP_ADD_v1 - free( hBinRenConvModule->Q_filterStatesLeft ); - hBinRenConvModule->Q_filterStatesLeft = NULL; -#endif /* OPT_BASOP_ADD_v1 */ free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 37c32a8b1..4e654030b 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -336,11 +336,7 @@ ivas_error ivas_core_dec_fx( Word16 ovl, fade_len; IF( NE_16( sts[0]->L_frame, sts[0]->last_L_frame ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, sts[0]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, sts[0]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#endif L_lerp_fx_q11( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->L_frame, sts[0]->last_L_frame ); Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( sts[0]->hHQ_core->Q_old_wtda_LB, Q11 ) ); // Q_old_wtda_LB } @@ -527,11 +523,7 @@ ivas_error ivas_core_dec_fx( return error; } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 -#else - Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 -#endif Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 IF( st->cldfbAna ) { @@ -551,9 +543,6 @@ ivas_error ivas_core_dec_fx( st->cldfbSyn->Q_cldfb_state = Q11; move16(); } -#ifndef FIX_ISSUE_1279 /* the update of prev_Q_syn is already done inside rescale_mem( ) */ - st->prev_Q_syn = st->Q_syn; -#endif move16(); IF( save_hb_synth_32_fx ) @@ -641,11 +630,7 @@ ivas_error ivas_core_dec_fx( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_output ) ); // Q11 -#ifdef MSAN_FIX Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 -#else - Scale_sig( synth_16_fx[n], L_FRAME48k, negate( Q_synth ) ); -#endif Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 } @@ -660,11 +645,7 @@ ivas_error ivas_core_dec_fx( td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 -#endif } } /* n_channels loop */ @@ -910,19 +891,11 @@ ivas_error ivas_core_dec_fx( /* Memories Re-Scaling */ IF( hBWE_TD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, hBWE_TD->prev_Q_bwe_syn2 ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, st->prev_Q_bwe_syn2 ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_shb_fx_32, ALLPASSSECTIONS_STEEP * 2, sub( Q11, st->prev_Qx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, st->prev_Qx ) ); // Q11 -#endif Copy( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->state_32and48k_WB_upsample_fx, ( 2 * ALLPASSSECTIONS_STEEP ) ); } @@ -936,11 +909,7 @@ ivas_error ivas_core_dec_fx( test(); IF( sba_dirac_stereo_flag && NE_16( st->element_mode, IVAS_CPE_MDCT ) && !( EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#else - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#endif } IF( NE_32( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode, &Q_synth ) ), IVAS_ERR_OK ) ) @@ -954,11 +923,7 @@ ivas_error ivas_core_dec_fx( test(); IF( sba_dirac_stereo_flag && hSCE && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#else - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], hSCE->save_synth_fx, output_frame, sub( hSCE->q_save_synth_fx, Q_synth ) ); // q_save_synth_fx -#endif } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ @@ -985,11 +950,7 @@ ivas_error ivas_core_dec_fx( } ELSE { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->delay_buf_out_fx, st->delay_buf_out32_fx, ( HQ_DELTA_MAX * HQ_DELAY_COMP ), sub( Q11, st->hHQ_core->Q_old_postdec ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( st->delay_buf_out_fx, st->delay_buf_out32_fx, ( HQ_DELTA_MAX * HQ_DELAY_COMP ), sub( Q11, st->hHQ_core->Q_old_postdec ) ); // Q11 -#endif } Scale_sig32( output_32_fx[n], L_FRAME48k, ( Q11 - Q4 ) ); // Q11 @@ -1003,16 +964,12 @@ ivas_error ivas_core_dec_fx( move16(); } -#ifdef MSAN_FIX IF( Q_synth > 0 ) { Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 Q_synth = 0; move16(); } -#else - Scale_sig( synth_16_fx[n], L_FRAME48k, negate( Q_synth ) ); -#endif /*------------------reset-code-start---------------------*/ @@ -1078,31 +1035,17 @@ ivas_error ivas_core_dec_fx( } /* Memories Re-Scaling */ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5 Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, sub( Q11, Q_synth_fx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, sub( Q11, Q_synth_fx ) ); // Q11 -#endif IF( hBWE_FD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_FD->L_old_wtda_swb_fx, hBWE_FD->L_old_wtda_swb_fx32, L_FRAME48k, sub( Q11, hBWE_FD->old_wtda_swb_fx_exp ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_FD->L_old_wtda_swb_fx, hBWE_FD->L_old_wtda_swb_fx32, L_FRAME48k, sub( Q11, hBWE_FD->old_wtda_swb_fx_exp ) ); // Q11 -#endif } IF( hBWE_TD != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hBWE_TD->old_tbe_synth_fx, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH, sub( Q11, hBWE_TD->prev_Qx ) ); // Q11 -#endif } /*---------------------------------------------------------------------* @@ -1205,11 +1148,7 @@ ivas_error ivas_core_dec_fx( q = 2; move16(); Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 -#else - Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, L_FRAME48k, negate( add( Q11, q ) ) ); -#endif Scale_sig( hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, hBWE_TD->prev_Q_bwe_syn ) ); // Q8 Copy_Scale_sig_32_16( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, ( 2 * ALLPASSSECTIONS_STEEP ), sub( hBWE_TD->prev_Q_bwe_syn2, Q11 ) ); // prev_Q_bew_syn2 @@ -1242,7 +1181,6 @@ ivas_error ivas_core_dec_fx( move32(); } stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q, Q_white_exc ); -#ifdef MSAN_FIX test(); test(); test(); @@ -1254,10 +1192,6 @@ ivas_error ivas_core_dec_fx( Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); // Q11 Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); // Q11 } -#else - Scale_sig32( hb_synth_32_fx[0], L_FRAME48k, sub( Q11, q ) ); - Scale_sig32( hb_synth_32_fx[1], L_FRAME48k, sub( Q11, q ) ); -#endif } IF( EQ_16( st->element_mode, EVS_MONO ) ) @@ -1286,11 +1220,7 @@ ivas_error ivas_core_dec_fx( } waveform_adj2_fix( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, tmps, add( st->hPlcInfo->nbLostCmpt, 1 ), st->bfi ); -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->Pitch_fx = 0; -#else - st->hPlcInfo->Pitch = 0; -#endif move16(); } } @@ -1476,13 +1406,8 @@ ivas_error ivas_core_dec_fx( IF( st->hHQ_core != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, st->hHQ_core->Q_old_wtda_LB ) ); // Q11 Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, st->hHQ_core->Q_old_wtda ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, st->hHQ_core->Q_old_wtda_LB ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, st->hHQ_core->Q_old_wtda ) ); // Q11 -#endif } IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 05fec7736..c10c6beda 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -124,22 +124,14 @@ ivas_error ivas_cpe_dec_fx( test(); IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda ) ); // Q11 -#endif } } FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { IF( hCPE->hCoreCoder[ind1]->hHQ_core ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11 -#endif hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = Q11; move16(); } diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index a52390f68..40a9ca2d7 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2113,11 +2113,7 @@ void ivas_dirac_dec_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { -#ifdef MSAN_FIX ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local_fx, nchan_transport, NULL, NULL ); -#else - ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local, nchan_transport, NULL, NULL ); -#endif // MSAN_FIX n_samples_sf = i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->slot_size ); @@ -4108,11 +4104,7 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[ch]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col; move16(); @@ -4215,11 +4207,7 @@ void ivas_dirac_dec_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; move32(); } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, 0, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ IF( !st_ivas->hLsSetupCustom->separate_ch_found ) { @@ -4259,11 +4247,7 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub( ( Q6 - 1 ), st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state ) ); // Q6-1 st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[cldfbSynIdx] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[cldfbSynIdx] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ // Calculating length of output Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col; @@ -4332,11 +4316,7 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = ( Q6 - 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ // Scaling output from Q6-1 to Q11 Scale_sig32( p_out, out_len, ( Q11 - ( Q6 - 1 ) ) ); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index b247fd653..114083fad 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -723,11 +723,7 @@ Word16 computeMixingMatrices_fx( Word32 G_hat_fx[MAX_OUTPUT_CHANNELS]; Word16 G_hat_buff_e[MAX_OUTPUT_CHANNELS]; -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer2_e, mat_mult_buffer3_e; -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer1_e, mat_mult_buffer2_e, mat_mult_buffer3_e; -#endif /* OPT_BASOP_ADD_v1 */ Word32 mat_mult_buffer3_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; @@ -777,9 +773,7 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( Cy_fx, svd_in_buffer_fx, lengthCy, lengthCy, 0 ); svd_fx( svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCy, lengthCy ); -#ifdef OPT_BASOP_ADD_v1 Word16 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ /* Computing Ky */ FOR( i = 0; i < lengthCy; ++i ) { @@ -792,12 +786,9 @@ Word16 computeMixingMatrices_fx( move32(); Ky_fx_e[i + ( j * lengthCy )] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCy * lengthCy; ++i ) { Ky_fx[i] = L_shr( Ky_fx[i], sub( max_e, Ky_fx_e[i] ) ); @@ -805,7 +796,6 @@ Word16 computeMixingMatrices_fx( Ky_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Decomposition of Cx @@ -816,9 +806,7 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( Cx_fx, svd_in_buffer_fx, lengthCx, lengthCx, 0 ); svd_fx( svd_in_buffer_fx, Cx_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCx, lengthCx ); -#ifdef OPT_BASOP_ADD_v1 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { FOR( j = 0; j < lengthCx; ++j ) @@ -830,12 +818,9 @@ Word16 computeMixingMatrices_fx( move32(); Kx_fx_e[( i + ( j * lengthCx ) )] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCx * lengthCx; ++i ) { Kx_fx[i] = L_shr( Kx_fx[i], sub( max_e, Kx_fx_e[i] ) ); @@ -843,7 +828,6 @@ Word16 computeMixingMatrices_fx( Kx_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { @@ -967,49 +951,15 @@ Word16 computeMixingMatrices_fx( /* Computing the input matrix Kx'*Q'*G_hat'*Ky */ -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer1_fx_e; -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer1_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - Word16 Q_e_arr[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS]; - set16_fx( Q_e_arr, Q_e, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); - - matrix_product_mant_exp( Kx_fx, Kx_fx_e, lengthCx, lengthCx, 1, Q_fx, Q_e_arr, lengthCy, lengthCx, 1, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mat_mult_buffer2_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Kx_fx, Kx_fx_e[0], lengthCx, lengthCx, 1, Q_fx, Q_e, lengthCy, lengthCx, 1, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); matrix_diag_product_fx_2( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCx, lengthCy, 0, G_hat_fx, G_hat_buff_e, lengthCy, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); matrix_product_mant_exp_fx( mat_mult_buffer2_fx, mat_mult_buffer2_fx_e[0], lengthCx, lengthCy, 0, Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_diag_product_fx_1( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCx, lengthCy, 0, G_hat_fx, G_hat_buff_e, lengthCy, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); - - matrix_product_mant_exp( mat_mult_buffer2_fx, mat_mult_buffer2_fx_e, lengthCx, lengthCy, 0, Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); - - exp = mat_mult_buffer1_fx_e[0]; - move16(); - FOR( i = 1; i < lengthCy * lengthCx; i++ ) - { - if ( LT_16( exp, mat_mult_buffer1_fx_e[i] ) ) - { - exp = mat_mult_buffer1_fx_e[i]; - move16(); - } - } - - FOR( i = 0; i < lengthCy * lengthCx; i++ ) - { - mat_mult_buffer1_fx[i] = L_shr( mat_mult_buffer1_fx[i], sub( exp, mat_mult_buffer1_fx_e[i] ) ); // Q(31-exp) - move32(); - } - - mat_mult_buffer1_e = exp; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ IF( LT_16( lengthCx, lengthCy ) ) { @@ -1018,11 +968,7 @@ Word16 computeMixingMatrices_fx( move16(); nC = lengthCx; move16(); -#ifdef OPT_BASOP_ADD_v1 svd_fx( svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, svd_s_buffer_e, nL, nC ); -#else /* OPT_BASOP_ADD_v1 */ - svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, svd_s_buffer_e, nL, nC ); -#endif /* OPT_BASOP_ADD_v1 */ } ELSE { @@ -1031,11 +977,7 @@ Word16 computeMixingMatrices_fx( move16(); nC = lengthCy; move16(); -#ifdef OPT_BASOP_ADD_v1 svd_fx( svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, nL, nC ); -#else /* OPT_BASOP_ADD_v1 */ - svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, nL, nC ); -#endif /* OPT_BASOP_ADD_v1 */ } /* Actually Processing P */ @@ -1046,46 +988,25 @@ Word16 computeMixingMatrices_fx( svdMat2mat_fx( svd_v_buffer_fx, mat_mult_buffer1_fx, lengthCy, lengthCx ); svdMat2mat_fx( svd_u_buffer_fx, mat_mult_buffer2_fx, lengthCx, lengthCx ); -#ifdef OPT_BASOP_ADD_v1 mat_mult_buffer1_fx_e = 0; -#else /* OPT_BASOP_ADD_v1 */ - mat_mult_buffer1_e = 0; -#endif /* OPT_BASOP_ADD_v1 */ move16(); mat_mult_buffer2_e = 0; move16(); -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer2_fx, mat_mult_buffer2_e, lengthCx, lengthCx, 1, mat_mult_buffer3_fx, &mat_mult_buffer3_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp_fx( mat_mult_buffer1_fx, mat_mult_buffer1_e, lengthCy, lengthCx, 0, - mat_mult_buffer2_fx, mat_mult_buffer2_e, lengthCx, lengthCx, 1, - mat_mult_buffer3_fx, &mat_mult_buffer3_e ); -#endif /* OPT_BASOP_ADD_v1 */ /************************ Formulate M **********************/ -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer3_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - set16_fx( mat_mult_buffer3_fx_e, mat_mult_buffer3_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); - - matrix_product_mant_exp( Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; -#ifdef OPT_BASOP_ADD_v1 Word16 mat_mult_buffer1_fx_e1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; set16_fx( mat_mult_buffer1_fx_e1, mat_mult_buffer1_fx_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1, lengthCy, lengthCx, 0, Kx_reg_inv_fx, Kx_reg_inv_e, lengthCx, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, Kx_reg_inv_fx, Kx_reg_inv_e, lengthCx, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Formulate Cr @@ -1096,15 +1017,9 @@ Word16 computeMixingMatrices_fx( Word16 Cx_e_arr[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; set16_fx( Cx_e_arr, Cx_fx_e, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1 ); matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e1, lengthCy, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 1, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); -#else /* OPT_BASOP_ADD_v1 */ - matrix_product_mant_exp( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_fx_e ); - - matrix_product_mant_exp( mat_mult_buffer1_fx, mat_mult_buffer1_fx_e, lengthCy, lengthCx, 0, mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 1, mat_mult_buffer2_fx, mat_mult_buffer2_fx_e ); -#endif /* OPT_BASOP_ADD_v1 */ exp = mixing_matrix_fx_e[0]; move16(); @@ -1143,11 +1058,7 @@ Word16 computeMixingMatrices_fx( } /* Avoid Meaningless negative main diagonal elements */ -#ifdef OPT_BASOP_ADD_v1 IF( Cr_fx[i + ( i * lengthCy )] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Cr_fx[i + ( i * lengthCy )], exp, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { Cr_fx[i + ( i * lengthCy )] = 0; move32(); @@ -1209,11 +1120,7 @@ Word16 computeMixingMatrices_fx( { /* Avoid correction for very small energies, main diagonal elements of Cy_tilde_p may be negative */ -#ifdef OPT_BASOP_ADD_v1 IF( Cy_tilde_p_fx[i + ( i * lengthCy )] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Cy_tilde_p_fx[i + ( i * lengthCy )], mat_mult_buffer2_e, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -1232,12 +1139,8 @@ Word16 computeMixingMatrices_fx( move16(); } -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, adj_e[i] ) ); IF( GT_32( adj_fx_p[i], temp ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx_p[i], adj_e[i], 1073741824, 3 ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -1322,11 +1225,7 @@ Word16 computeMixingMatricesResidual_fx( Word16 mixing_matrix_e = 0, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e; move16(); -#ifdef MSAN_FIX Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS] = { 0 }; -#else - Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; -#endif Word16 svd_s_buffer_e[MAX_OUTPUT_CHANNELS]; Word32 L_tmp; Word16 tmp_e; @@ -1370,9 +1269,7 @@ Word16 computeMixingMatricesResidual_fx( svd_fx( svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, svd_s_buffer_e, lengthCy, lengthCy ); /* Computing Ky */ -#ifdef OPT_BASOP_ADD_v1 Word16 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCy; ++i ) { FOR( j = 0; j < lengthCy; ++j ) @@ -1384,13 +1281,10 @@ Word16 computeMixingMatricesResidual_fx( move32(); Ky_fx_e[i + j * lengthCy] = tmp_e; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, tmp_e ); -#endif /* OPT_BASOP_ADD_v1 */ } } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCy * lengthCy; ++i ) { Ky_fx[i] = L_shr( Ky_fx[i], sub( max_e, Ky_fx_e[i] ) ); @@ -1398,7 +1292,6 @@ Word16 computeMixingMatricesResidual_fx( Ky_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Decomposition of Cx @@ -1410,9 +1303,7 @@ Word16 computeMixingMatricesResidual_fx( * square root of the diagonal of Cx */ /* Computing Kx */ -#ifdef OPT_BASOP_ADD_v1 max_e = -32; -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { exp = Cx_e; @@ -1421,12 +1312,9 @@ Word16 computeMixingMatricesResidual_fx( move32(); Kx_fx_e[i] = exp; move16(); -#ifdef OPT_BASOP_ADD_v1 max_e = s_max( max_e, exp ); -#endif /* OPT_BASOP_ADD_v1 */ } -#ifdef OPT_BASOP_ADD_v1 FOR( i = 0; i < lengthCx; ++i ) { Kx_fx[i] = L_shr( Kx_fx[i], sub( max_e, Kx_fx_e[i] ) ); @@ -1434,7 +1322,6 @@ Word16 computeMixingMatricesResidual_fx( Kx_fx_e[i] = max_e; move16(); } -#endif /* OPT_BASOP_ADD_v1 */ /*-----------------------------------------------------------------* * Regularization of Sx @@ -1442,25 +1329,13 @@ Word16 computeMixingMatricesResidual_fx( limit_fx = Kx_fx[0]; move32(); -#ifndef OPT_BASOP_ADD_v1 - limit_e = Kx_fx_e[0]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 1; i < lengthCx; i++ ) { -#ifdef OPT_BASOP_ADD_v1 IF( GT_32( Kx_fx[i], limit_fx ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( Kx_fx[i], Kx_fx_e[i], limit_fx, limit_e ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { limit_fx = Kx_fx[i]; move32(); -#ifndef OPT_BASOP_ADD_v1 - limit_e = Kx_fx_e[i]; - move16(); -#endif /* OPT_BASOP_ADD_v1 */ } } @@ -1468,11 +1343,7 @@ Word16 computeMixingMatricesResidual_fx( L_tmp = L_add( L_tmp, EPSILLON_FX ); limit_fx = L_tmp; move16(); -#ifdef OPT_BASOP_ADD_v1 limit_e = add( Kx_fx_e[0], reg_Sx_e ); -#else /* OPT_BASOP_ADD_v1 */ - limit_e = add( limit_e, reg_Sx_e ); -#endif /* OPT_BASOP_ADD_v1 */ FOR( i = 0; i < lengthCx; ++i ) { @@ -1622,15 +1493,8 @@ Word16 computeMixingMatricesResidual_fx( *-----------------------------------------------------------------*/ -#ifdef OPT_BASOP_ADD_v1 matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); set16_fx( mat_mult_buffer1_buff_e, mat_mult_buffer1_buff_e[0], MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); -#else /* OPT_BASOP_ADD_v1 */ - Word16 mat_mult_buffer3_fx_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - set16_fx( mat_mult_buffer3_fx_e, mat_mult_buffer3_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); - - matrix_product_mant_exp( Ky_fx, Ky_fx_e, lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_fx_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); -#endif /* OPT_BASOP_ADD_v1 */ Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; @@ -1715,12 +1579,8 @@ Word16 computeMixingMatricesResidual_fx( move32(); adj_buff_e[i] = scale; move16(); -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, scale ) ); IF( GT_32( adj_fx_p[i], temp ) ) // 1073741824 -> 1.0f in Q30 -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx_p[i], scale, 1073741824, 3 ) > 0 ) // 1073741824 -> 1.0f in Q30 -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx_p[i] = 1073741824; // 1.0f in Q30 move32(); @@ -2115,12 +1975,8 @@ Word16 computeMixingMatricesISM_fx( } } -#ifdef OPT_BASOP_ADD_v1 Word32 temp = W_shl_sat_l( W_deposit32_l( 4 ), sub( 31, temp_e[i] ) ); IF( GT_32( adj_fx[i], temp ) ) -#else /* OPT_BASOP_ADD_v1 */ - IF( BASOP_Util_Cmp_Mant32Exp( adj_fx[i], temp_e[i], MAX_32, 2 ) > 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { adj_fx[i] = MAX_32; move32(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 292721723..4770d2193 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1266,9 +1266,7 @@ ivas_error ivas_init_decoder_fx( { return error; } -#ifdef MSAN_FIX set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); -#endif test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) { diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index c818af237..7686a5e8a 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -511,9 +511,7 @@ static ivas_error ivas_param_ism_rendering_init_fx( { set32_fx( hParamIsmRendering->mixing_matrix_lin_old_fx[bin_idx], 0, PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX ); } -#ifdef MSAN_FIX set16_fx( hParamIsmRendering->exp_mixing_matrix_lin_old_fx, 0, CLDFB_NO_CHANNELS_MAX ); -#endif /* memory allocation for proto matrix and interpolator */ IF( ( hParamIsmRendering->proto_matrix_fx = (Word16 *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( Word16 ) ) ) == NULL ) @@ -1535,11 +1533,7 @@ static void ivas_ism_param_dec_render_sf_fx( Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( sub( Q_real, 1 ), Q11 ) ); // Q_real-1 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub( Q_real, 1 ); move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( Q11, sub( Q_real, 1 ) ) ); // Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1918ce3f3..93e8bb4eb 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -129,10 +129,8 @@ ivas_error ivas_jbm_dec_tc_fx( set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k ); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } -#ifdef MSAN_FIX st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); move16(); -#endif } Word16 ch; @@ -434,19 +432,13 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } IF( hCPE->hStereoDft != NULL ) { -#ifdef MSAN_FIX IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; @@ -494,9 +486,6 @@ ivas_error ivas_jbm_dec_tc_fx( } } } -#else - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); -#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; move16(); @@ -517,14 +506,10 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx } -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -532,14 +517,10 @@ ivas_error ivas_jbm_dec_tc_fx( { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 } -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -555,7 +536,6 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hStereoDft != NULL ) { -#ifdef MSAN_FIX IF( LE_16( st_ivas->nchan_transport, 1 ) ) { st = hCPE->hCoreCoder[0]; @@ -603,9 +583,6 @@ ivas_error ivas_jbm_dec_tc_fx( } } } -#else - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 -#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; test(); @@ -971,13 +948,8 @@ ivas_error ivas_jbm_dec_tc_fx( } IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } @@ -1004,24 +976,16 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( 11, hCPE->q_prev_synth_fx ) ); // Q11 -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -1420,13 +1384,8 @@ ivas_error ivas_jbm_dec_tc_fx( IF( hCPE->hCoreCoder[0] != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q -#endif hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; move16(); } @@ -1458,23 +1417,15 @@ ivas_error ivas_jbm_dec_tc_fx( hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; move16(); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); -#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 -#else - Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); -#endif // MSAN_FIX scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -1916,10 +1867,8 @@ ivas_error ivas_jbm_dec_render_fx( } } -#ifdef MSAN_FIX st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full; move16(); -#endif // MSAN_FIX /*----------------------------------------------------------------* * Update combined orientation access index *----------------------------------------------------------------*/ @@ -2014,7 +1963,6 @@ ivas_error ivas_jbm_dec_render_fx( ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef MSAN_FIX FOR( i = 0; i < st_ivas->nchan_transport; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -2025,16 +1973,6 @@ ivas_error ivas_jbm_dec_render_fx( move32(); } } -#else - FOR( i = 0; i < 15; i++ ) - { - FOR( j = 0; j < 16; j++ ) - { - st_ivas->hIsmRendererData->gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q30 -> Q29 - st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q30 -> Q29 - } - } -#endif ivas_ism2sba_sf_fx( st_ivas->hTcBuffer->tc_fx, p_output_fx, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); Word16 sba_num_chans = imult1616( add( st_ivas->hIntSetup.ambisonics_order, 1 ), add( st_ivas->hIntSetup.ambisonics_order, 1 ) ); FOR( j = 0; j < sba_num_chans; j++ ) @@ -2043,7 +1981,6 @@ ivas_error ivas_jbm_dec_render_fx( } -#ifdef MSAN_FIX FOR( i = 0; i < st_ivas->nchan_transport; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -2054,16 +1991,6 @@ ivas_error ivas_jbm_dec_render_fx( move32(); } } -#else - FOR( i = 0; i < 15; i++ ) - { - FOR( j = 0; j < 16; j++ ) - { - st_ivas->hIsmRendererData->gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q29 -> Q30 - st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q29 -> Q30 - } - } -#endif } /* Binaural rendering */ @@ -2136,11 +2063,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2188,11 +2111,7 @@ ivas_error ivas_jbm_dec_render_fx( hSpar->hMdDec->Q_mixer_mat = 30; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2230,11 +2149,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) /*EXT output = individual objects + HOA3*/ { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output_fx[st_ivas->nchan_ism] ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output_fx[st_ivas->nchan_ism], 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2246,11 +2161,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2262,11 +2173,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -2868,11 +2775,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( set16_fx( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available ); /* render the last subframe */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx, L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index b2a8bd30b..4c0e7fcc6 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1862,9 +1862,6 @@ void ivas_param_mc_dec_render_fx( /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; UWord16 nband_synth; -#ifndef MSAN_FIX - UWord16 nchan_out_init, nbands_to_zero; -#endif UWord32 output_Fs; Word16 tmp_q = 0; move16(); @@ -1878,10 +1875,6 @@ void ivas_param_mc_dec_render_fx( nchan_transport = st_ivas->nchan_transport; move16(); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); -#ifndef MSAN_FIX - nchan_out_init = nchan_out_transport; - move16(); -#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); @@ -1891,12 +1884,6 @@ void ivas_param_mc_dec_render_fx( { nchan_out_cldfb = BINAURAL_CHANNELS; set16_fx( channel_active, 1, nchan_out_cldfb ); -#ifndef MSAN_FIX - IF( st_ivas->hCombinedOrientationData ) - { - nchan_out_init = MAX_INTERN_CHANNELS; - } -#endif nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); } ELSE IF( EQ_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) ) @@ -1924,21 +1911,12 @@ void ivas_param_mc_dec_render_fx( /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; move16(); -#ifdef MSAN_FIX FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) -#else - FOR( ch = 0; ch < nchan_out_init; ch++ ) -#endif { FOR( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) { -#ifdef MSAN_FIX set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX ); -#else - set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); - set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); -#endif } } @@ -1973,31 +1951,8 @@ void ivas_param_mc_dec_render_fx( slot_idx_start_cldfb_synth = 0; move16(); -#ifndef FIX_1009_OPT_PARAMMC_RENDER - Flag is_zero = 1; - move32(); -#endif FOR( j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++ ) { -#ifndef FIX_1009_OPT_PARAMMC_RENDER - is_zero = 1; - move16(); - FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++ ) - { - IF( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i] != 0 ) - { - is_zero = 0; - move16(); - } - } - IF( is_zero ) - { - hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0; - move16(); - } - is_zero = 1; - move16(); -#else Flag is_zero = is_zero_arr( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j], hParamMC->h_output_synthesis_cov_state.mixing_matrix_len ); { if ( is_zero != 0 ) @@ -2006,23 +1961,10 @@ void ivas_param_mc_dec_render_fx( move16(); } } -#endif IF( LT_16( st_ivas->hParamMC->band_grouping[j], st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) ) { -#ifndef FIX_1009_OPT_PARAMMC_RENDER - FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++ ) - { - IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0 ) ) - { - is_zero = 0; - move16(); - } - } - IF( is_zero ) -#else is_zero = is_zero_arr( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len ); if ( is_zero != 0 ) -#endif { hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0; move16(); @@ -2247,13 +2189,8 @@ void ivas_param_mc_dec_render_fx( Word16 len = add( imult1616( slot_idx_start_cldfb_synth, hParamMC->num_freq_bands ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ) ); scale_sig32( output_f_fx[ch], len, 5 - 11 ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), - imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( output_f_fx[ch], len, 11 - 5 ); // Q11 } @@ -2742,9 +2679,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); set_zero_fx( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); -#ifdef MSAN_FIX set_zero_fx( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); -#endif Word16 proto_matrix_noLFE_e = 0; move16(); @@ -2941,11 +2876,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( FOR( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ ) { -#ifdef OPT_BASOP_ADD_v1 if ( Cproto_diag_fx[ch_idx1] < 0 ) -#else /* OPT_BASOP_ADD_v1 */ - if ( BASOP_Util_Cmp_Mant32Exp( Cproto_diag_fx[ch_idx1], Cproto_diag_e, 0, 0 ) < 0 ) -#endif /* OPT_BASOP_ADD_v1 */ { Cproto_diag_fx[ch_idx1] = 0; move16(); diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index f4d6cb535..40f9f46e2 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -716,13 +716,8 @@ static void ivas_mc_paramupmix_dec_sf( Word16 noparamupmix_delay, n_samples_rendered; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; Word16 subframeIdx, idx_in, maxBand; -#ifdef MSAN_FIX Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; -#else - Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif // MSAN_FIX Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -874,11 +869,7 @@ static void ivas_mc_paramupmix_dec_sf( scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q5 - Q11 ); // Q11 -> Q5 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 0, st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q5 -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q5 -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q11 - Q5 ); // Q5 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); @@ -913,13 +904,8 @@ static void ivas_mc_paramupmix_dec_sf( ptr_re_fx[0] = Cldfb_RealBuffer_fx[ch][slot_idx]; // Q6 ptr_im_fx[0] = Cldfb_ImagBuffer_fx[ch][slot_idx]; // Q6 -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), hMCParamUpmix->num_freq_bands, 0, st_ivas->cldfbSynDec[ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), - hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, sub( Q11, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); // Q6 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 4eb0ad686..7e1597749 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -84,10 +84,8 @@ ivas_error ivas_mct_dec_fx( set16_fx( x_len[0], 0, NB_DIV ); set16_fx( x_len[1], 0, NB_DIV ); Decoder_State **sts; -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS Word32 *p_output_orig_fx[2]; Word32 synth_32_fx[CPE_CHANNELS][L_FRAME_PLUS]; -#endif Word16 synth_fx[CPE_CHANNELS][L_FRAME_PLUS]; //(Q_synth) Word32 ivas_total_brate; ivas_error error; @@ -164,7 +162,6 @@ ivas_error ivas_mct_dec_fx( /* MCT side bits decoder */ ivas_mct_side_bits_fx( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */ IF( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { @@ -174,7 +171,6 @@ ivas_error ivas_mct_dec_fx( output_fx[n] = synth_32_fx[n]; } } -#endif FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -348,13 +344,8 @@ ivas_error ivas_mct_dec_fx( 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 } -#ifdef FIX_ISSUE_1237 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 ) ) ) ) ); -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ); - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ); -#endif ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, e_sig ); Word16 hdrm, sh; @@ -385,7 +376,6 @@ ivas_error ivas_mct_dec_fx( } } -#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* set pointers back */ test(); IF( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) @@ -396,7 +386,6 @@ ivas_error ivas_mct_dec_fx( } } -#endif /*----------------------------------------------------------------* * CoreCoder Post-processing and updates @@ -409,19 +398,10 @@ ivas_error ivas_mct_dec_fx( test(); IF( ( st_ivas->sba_dirac_stereo_flag != 0 ) && ( NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) || GE_16( cpe_id, sub( nCPE, 2 ) ) ) ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_fx[n], synth_fx_32[n], L_FRAME48k, sub( Q11, ( sub( 15, e_sig[n] ) ) ) ); // Q11 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->old_out_fx32, output_frame, sub( Q11, hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda ) ); -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx[n], synth_fx_32[n], L_FRAME48k, sub( Q11, ( sub( 15, e_sig[n] ) ) ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->old_out_fx32, output_frame, sub( Q11, hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda ) ); -#endif ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1, Q11 ); -#ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx_32[n], synth_fx[n], output_frame, sub( sub( 15, e_sig[n] ), Q11 ) ); // Q0 -#else - Copy_Scale_sig_32_16( synth_fx_32[n], synth_fx[n], L_FRAME48k, 0 - Q11 ); -#endif } /* Postprocessing for ACELP/MDCT core switching and synchronization */ @@ -452,11 +432,7 @@ ivas_error ivas_mct_dec_fx( { return error; } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( synth_fx[n], output_fx[( cpe_id * CPE_CHANNELS ) + n], output_frame, sub( Q11, Q_synth ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( synth_fx[n], output_fx[( cpe_id * CPE_CHANNELS ) + n], output_frame, sub( Q11, Q_synth ) ); // Q11 -#endif /* Save synthesis for HQ FEC */ Word32 output_fx_[L_FRAME48k]; Copy32( output_fx[( cpe_id * CPE_CHANNELS ) + n], output_fx_, L_FRAME48k ); // Q11 @@ -476,11 +452,7 @@ ivas_error ivas_mct_dec_fx( { IF( hCPE->hCoreCoder[n] ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11 ); // Q0 -> Q11 -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11 ); // Q0 -> Q11 -#endif } } diff --git a/lib_dec/ivas_mct_dec_mct_fx_fx.c b/lib_dec/ivas_mct_dec_mct_fx_fx.c index c275820fb..0f20c1ec0 100644 --- a/lib_dec/ivas_mct_dec_mct_fx_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx_fx.c @@ -313,17 +313,6 @@ void mctStereoIGF_dec_fx( test(); IF( NE_16( hMCT->hBlockData[b]->hStereoMdct->IGFStereoMode[k], SMDCT_DUAL_MONO ) || NE_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[k], SMDCT_DUAL_MONO ) ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxCfg->tcx_coded_lines, nSubframes, &tmp_e ); - L_spec[0] = shr( tmp, add( 15, negate( tmp_e ) ) ); - move16(); - - tmp = BASOP_Util_Divide1616_Scale( sts[0]->L_frame, nSubframes, &tmp_e ); - L_frame_nSubframe = shr( tmp, add( 15, negate( tmp_e ) ) ); - - tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxDec->L_frameTCX, nSubframes, &tmp_e ); - L_frameTCX_nSubframe = shr( tmp, add( 15, negate( tmp_e ) ) ); -#else Word16 shr_div, shr_k; assert( nSubframes == 1 || nSubframes == 2 ); @@ -334,7 +323,6 @@ void mctStereoIGF_dec_fx( move16(); L_frame_nSubframe = shr( sts[0]->L_frame, shr_div ); L_frameTCX_nSubframe = shr( sts[0]->hTcxDec->L_frameTCX, shr_div ); -#endif init_tcx_info_fx( sts[0], 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] ); @@ -344,28 +332,16 @@ 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 FIX_1109_OPTIM_MCT_STEREO_IGF_DEC shr_k = sub( 31 - Q12, p_x_e[0][k] ); -#endif FOR( Word16 i = 0; i < p_x_len[0][k]; i++ ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - p_x[0][k][i] = L_shr( p_x[0][k][i], sub( 31 - Q12, p_x_e[0][k] ) ); -#else p_x[0][k][i] = L_shr( p_x[0][k][i], shr_k ); -#endif move32(); } -#ifdef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC shr_k = sub( 31 - Q12, p_x_e[1][k] ); -#endif FOR( Word16 i = 0; i < p_x_len[1][k]; i++ ) { -#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC - p_x[1][k][i] = L_shr( p_x[1][k][i], sub( 31 - Q12, p_x_e[1][k] ) ); -#else p_x[1][k][i] = L_shr( p_x[1][k][i], shr_k ); -#endif move32(); } } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 1899c8bea..71839557a 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -684,10 +684,8 @@ void ivas_mdct_core_invQ_fx( { spectralData_tmp[k] = malloc( N_MAX * sizeof( Word32 ) ); } -#ifdef MSAN_FIX set32_fx( spectralData_tmp[0], 0, L_FRAME_MAX ); set32_fx( spectralData_tmp[1], 0, L_FRAME_MAX ); -#endif // MSAN_FIX push_wmops( "mdct_core_invQ" ); sts = hCPE->hCoreCoder; @@ -728,18 +726,8 @@ void ivas_mdct_core_invQ_fx( common_exp = s_max( sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ); -#ifdef MSAN_FIX -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_frameTCX[0], sub( 15, sub( common_exp, sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp1 Copy_Scale_sig_16_32_no_sat( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_frameTCX[1], sub( 15, sub( common_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp2 -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_frameTCX[0], sub( 15, sub( common_exp, sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp1 - Copy_Scale_sig_16_32_DEPREC( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_frameTCX[1], sub( 15, sub( common_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ) ); // 30 - spectral_exp2 -#endif -#else - Copy_Scale_sig_16_32_DEPREC( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_FRAME_MAX, 15 - ( common_exp - sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp1 - Copy_Scale_sig_16_32_DEPREC( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_FRAME_MAX, 15 - ( common_exp - sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp2 -#endif // MSAN_FIX sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = common_exp; move16(); @@ -751,13 +739,8 @@ void ivas_mdct_core_invQ_fx( /* both input in same Q */ 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 ); -#ifdef MSAN_FIX 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 -#else - Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); - Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); -#endif sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_l ); sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_r ); move16(); @@ -1193,13 +1176,8 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win -#ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win -#else - Scale_sig( synth_buf_fx, 3136, sub( q_win, q_syn ) ); - Scale_sig( synth_bufFB_fx, 3136, sub( q_win, q_syn ) ); -#endif Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win FOR( k = 0; k < nSubframes[ch]; k++ ) { @@ -1263,13 +1241,8 @@ void ivas_mdct_core_reconstruct_fx( move16(); Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( sub( -1, st->Q_syn ), st->hTcxDec->Q_old_syn_Overl ) ); // q_win -> Q(-1 - st->Q_syn) st->hTcxDec->Q_old_syn_Overl = sub( -1, st->Q_syn ); -#ifdef MSAN_FIX Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn -#else - Scale_sig( synth_buf_fx, 3136, sub( q_syn, q_win ) ); - Scale_sig( synth_bufFB_fx, 3136, sub( q_syn, q_win ) ); -#endif Scale_sig( st->syn, M + 1, add( st->Q_syn, 2 ) ); Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn @@ -1400,11 +1373,7 @@ void ivas_mdct_core_reconstruct_fx( move16(); st->last_coder_type = st->coder_type; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( x_fx_16, x_fx[ch][0], st->L_frame, sub( q_x, q_syn ) ); // q_syn -> Q_x -#else - Copy_Scale_sig_16_32_DEPREC( x_fx_16, x_fx[ch][0], st->L_frame, sub( q_x, q_syn ) ); // q_syn -> Q_x -#endif } IF( GT_16( e_sig[0], e_sig[1] ) ) @@ -1508,9 +1477,7 @@ void ivas_mdct_core_tns_ns_fx( move16(); set32_fx( xn_buf_fx, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); -#ifdef MSAN_FIX set32_fx( sns_int_scf_fx, 0, FDNS_NPTS ); -#endif /* TNS, ITF, IMDCT and updates */ diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index adee0fc91..8f7da758d 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -713,22 +713,14 @@ void ivas_omasa_dirac_rend_jbm_fx( ivas_dirac_dec_render_fx( st_ivas, nchan_transport, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_f ); -#ifdef MSAN_FIX FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) -#else - FOR( Word16 ind1 = 0; ind1 < MAX_CICP_CHANNELS - 1; ind1++ ) -#endif // MSAN_FIX { scale_sig32( st_ivas->hIsmRendererData->prev_gains_fx[ind1], MAX_OUTPUT_CHANNELS, -1 ); // Q30 -> Q29 } ivas_omasa_separate_object_render_jbm_fx( st_ivas, *nSamplesRendered, data_separated_objects, output_f, subframes_rendered, slots_rendered ); -#ifdef MSAN_FIX FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) -#else - FOR( Word16 ind1 = 0; ind1 < MAX_CICP_CHANNELS - 1; ind1++ ) -#endif // MSAN_FIX { scale_sig32( st_ivas->hIsmRendererData->prev_gains_fx[ind1], MAX_OUTPUT_CHANNELS, 1 ); // Q29 -> Q30 } diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 493301743..80413b21a 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -130,10 +130,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 n; @@ -150,11 +146,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( channel_offset = st_ivas->nchan_ism; move16(); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset] ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset], out_len ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } @@ -240,11 +232,7 @@ ivas_error ivas_osba_render_sf_fx( v_shr( p_output[n], Q11 - Q11, output_ism[n], nSamplesAsked ); // Q11 } -#ifdef OPT_SBA_AVOID_SPAR_RESCALE IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output ) ), IVAS_ERR_OK ) ) -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output, 960 ) ), IVAS_ERR_OK ) ) -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ { return error; } diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 756eed60e..fc69d3919 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -479,12 +479,10 @@ ivas_error ivas_ls_setup_conversion_open_fx( set32_fx( hLsSetUpConversion->targetEnergyPrev_fx[0], 0, MAX_SFB + 2 ); set32_fx( hLsSetUpConversion->dmxEnergyPrev_fx[0], 0, MAX_SFB + 2 ); -#ifdef MSAN_FIX hLsSetUpConversion->te_prev_exp[0] = 0; hLsSetUpConversion->dmx_prev_exp[0] = 0; move16(); move16(); -#endif } /* Initialize the DMX conversion matrix */ diff --git a/lib_dec/ivas_post_proc_fx.c b/lib_dec/ivas_post_proc_fx.c index 03fe4063a..c0e69b916 100644 --- a/lib_dec/ivas_post_proc_fx.c +++ b/lib_dec/ivas_post_proc_fx.c @@ -243,12 +243,6 @@ void stereo_dft_dec_core_switching_fx( move16(); } -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, sub( *q, Q11 ) ); - } -#endif test(); test(); @@ -273,9 +267,7 @@ void stereo_dft_dec_core_switching_fx( test(); IF( st->p_bpf_noise_buf_32 && NE_16( st->core, HQ_CORE ) ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 2, 0, q, q_DFT ); } /* st->p_bpf_noise_buf not updated FOR HQ core -> skip analysis and set input memory to zero */ @@ -294,11 +286,7 @@ void stereo_dft_dec_core_switching_fx( { Word16 mem_len = NS2SA_FX2( L_mult0( L_frameTCX, FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ); /*Q0*/ move16(); -#ifdef MSAN_FIX Word32 mem_len_inv = mem_len_inv_tbl[( mem_len / 25 ) - 1]; -#else - Word32 mem_len_inv = mem_len_inv_tbl[( mem_len / 25 )]; -#endif move32(); Word16 qmem_len = norm_l( mem_len ); Word32 mem_len_fx = L_shl( mem_len, qmem_len ); @@ -441,9 +429,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } } @@ -472,9 +458,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -549,9 +533,7 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); /*q*/ -#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -723,12 +705,6 @@ void stereo_dft_dec_core_switching_fx( } } -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, negate( sub( *q, Q11 ) ) ); - } -#endif return; } diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index c78c51c52..6e36c7765 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -1113,7 +1113,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( } } -#ifdef MSAN_FIX FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) @@ -1122,19 +1121,8 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } -#else - FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) - { - FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) - { - hQMetaData->q_direction[0].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[0][b][m] ); - move32(); - } - } -#endif // MSAN_FIX IF( EQ_32( hQMetaData->no_directions, 2 ) ) { -#ifdef MSAN_FIX FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) @@ -1143,16 +1131,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } -#else - FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) - { - FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) - { - hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] ); - move32(); - } - } -#endif // MSAN_FIX } /* Store status information for renderer use */ hQMetaData->ec_flag = 0; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index f89e9601f..c8c3d80a5 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -349,12 +349,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( test(); test(); test(); -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH test(); IF( hSpar->hPCA == NULL && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( st_ivas->sba_order, 1 ) && ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) -#else - IF( hSpar->hPCA == NULL && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( st_ivas->sba_order, 1 ) && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) -#endif { IF( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { @@ -874,10 +870,6 @@ ivas_error ivas_sba_dec_render_fx( UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered Q0*/ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render Q0*/ Word32 *output_fx[] /* o : rendered time signal Q11*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len /*Store the length of values in each channel*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 slots_to_render, first_sf, last_sf, subframe_idx; @@ -886,15 +878,8 @@ ivas_error ivas_sba_dec_render_fx( SPAR_DEC_HANDLE hSpar; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; Word32 *output_f_local_fx[MAX_OUTPUT_CHANNELS]; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Word16 output_f_local_len; -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ivas_error error; -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - output_f_local_len = out_len; - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ hSpar = st_ivas->hSpar; hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -926,18 +911,11 @@ ivas_error ivas_sba_dec_render_fx( { Word16 n_samples_sf = imult1616( slot_size, hSpar->subframe_nbslots[subframe_idx] ); /*Q0*/ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal, output_f_local_len ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ch = 0; ch < nchan_out; ch++ ) { output_f_local_fx[ch] = output_f_local_fx[ch] + n_samples_sf; /*Q11*/ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - output_f_local_len = sub( output_f_local_len, n_samples_sf ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 0c7544682..50db27aa5 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -725,12 +725,10 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( ELSE { set32_fx( hStereoDft->hb_stefi_sig_fx + hStereoDft->hb_stefi_delay, 0, output_frame ); -#ifdef MSAN_FIX hStereoDft->hb_nrg_subr_fx[0] = 0; move32(); hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); -#endif // MSAN_FIX } hStereoDft->hb_nrg_subr_fx[0] = hStereoDft->hb_nrg_subr_fx[0]; // imult3216(hStereoDft->hb_nrg_subr_fx[0] , shr(hStereoDft->NFFT, 1)); /*hStereoDft->q_hb_nrg_subr*/ move32(); @@ -1240,12 +1238,10 @@ void ivas_sba_dirac_stereo_dec_fx( CPE_DEC_HANDLE hCPE; STEREO_DFT_DEC_DATA_HANDLE hStereoDft; -#ifdef MSAN_FIX FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) { set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX ); } -#endif hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; @@ -1257,18 +1253,10 @@ void ivas_sba_dirac_stereo_dec_fx( q_dft[1] = hCPE->hStereoDft->q_dft; move16(); -#ifdef MSAN_FIX Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ -#else - Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif IF( hSCE != NULL ) { -#ifdef MSAN_FIX Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/ -#else - Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft; move16(); } @@ -1398,18 +1386,10 @@ void ivas_sba_dirac_stereo_dec_fx( set32_fx( output[ch], 0, output_frame ); } -#ifdef MSAN_FIX Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/ -#else - Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif IF( hSCE != NULL ) { -#ifdef MSAN_FIX Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/ -#else - Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); -#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = Q11; move16(); } diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 461b18fbc..c3e2ad096 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -787,11 +787,7 @@ void ivas_spar_get_cldfb_gains_fx( cldfbAnalysis_ts_fx_fixed_q( ts_inout_fx, ts_re_fx, ts_im_fx, num_cldfb_bands, cldfbAnaDec0, &q_cldfb ); cldfb_reset_memory_fx( cldfbSynDec0 ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, 0, cldfbSynDec0 ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, cldfbSynDec0 ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( sample = 0; sample < stride; sample++ ) { T_fx[( ( slot * stride ) + sample )][slot] = ts_inout_fx[sample]; /*Q21*/ @@ -1161,10 +1157,8 @@ void ivas_spar_get_parameters_fx( split_band = SPAR_DIRAC_SPLIT_START_BAND; move16(); -#ifdef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS Word16 add_weight_fx = sub( MAX_WORD16, weight_fx ); Word16 add_weight_20ms_fx = sub( MAX_WORD16, weight_20ms_fx ); -#endif FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { FOR( out_ch = 0; out_ch < num_ch_out; out_ch++ ) @@ -1179,13 +1173,8 @@ void ivas_spar_get_parameters_fx( { IF( GT_16( hSpar->i_subframe, 3 ) ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[ts0][out_ch][in_ch][spar_band], sub( MAX_WORD16, weight_fx ) ), - Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[ts1][out_ch][in_ch][spar_band], weight_fx ) ); /*hSpar->hMdDec->Q_mixer_mat*/ -#else 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 ); -#endif move32(); } ELSE @@ -1202,12 +1191,8 @@ void ivas_spar_get_parameters_fx( /* 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(); -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat( Mpy_32_16_1( hSpar->hMdDec->mixer_mat_prev_fx[prev_idx][out_ch][in_ch][spar_band], sub( MAX_WORD16, weight_20ms_fx ) ), Mpy_32_16_1( hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band], weight_20ms_fx ) ); /*hSpar->hMdDec->Q_mixer_mat*/ -#else 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*/ -#endif move32(); } } @@ -1367,17 +1352,10 @@ static void ivas_spar_calc_smooth_facs_fx( smooth_long_avg_fx[b] = L_add( smooth_long_avg_fx[b], smooth_buf_fx[b][i] ); // Q0 move32(); } -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS - smooth_short_avg_fx[b] = Mpy_32_16_1( smooth_short_avg_fx[b], 5461 /*(1/6 in Q15)*/ ); // Q0 - move32(); - smooth_long_avg_fx[b] = Mpy_32_16_1( smooth_long_avg_fx[b], 1639 /*(1/20 in Q15)*/ ); // Q0 - move32(); -#else smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 move32(); smooth_long_avg_fx[b] = Mpy_32_32( smooth_long_avg_fx[b], 107374182 /*(1/20 in Q31)*/ ); // Q0 move32(); -#endif /* calculate smoothing factor based on energy averages */ /* reduce factor for higher short-term energy */ @@ -1689,10 +1667,6 @@ void ivas_spar_dec_upmixer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Word32 *output_fx[], /* o : output audio channels Q11*/ const Word16 nchan_internal /* i : number of internal channels Q0*/ -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - , - Word16 out_len -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ ) { Word16 cldfb_band, num_cldfb_bands, numch_in, numch_out; @@ -1793,9 +1767,7 @@ void ivas_spar_dec_upmixer_sf_fx( * Prepare CLDFB buffers *---------------------------------------------------------------------*/ -#ifdef MSAN_FIX set_zero_fx( &Pcm_tmp_fx[0][0], ( MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ) * L_FRAME48k ); -#endif // MSAN_FIX /* set-up pointers */ IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) ) { @@ -1871,9 +1843,7 @@ void ivas_spar_dec_upmixer_sf_fx( ivas_spar_calc_smooth_facs_fx( cldfb_in_ts_re_fx[0], cldfb_in_ts_im_fx[0], q_cldfb, num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_buf_fx ); } -#ifdef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL Word16 sh_l = sub( 31, q1 ); -#endif FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { md_idx = hSpar->render_to_md_map[( ts + slot_idx_start )]; /*Q0*/ @@ -1889,18 +1859,12 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE Word16 diff = sub( 32767, hSpar->hMdDec->smooth_fac_fx[spar_band] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { FOR( in_ch = 0; in_ch < numch_in; in_ch++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE mixer_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( mixer_mat_fx[out_ch][in_ch][spar_band], diff ), hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band], hSpar->hMdDec->smooth_fac_fx[spar_band] ); /*q1*/ -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - mixer_mat_fx[out_ch][in_ch][spar_band] = Madd_32_16( Mpy_32_16_1( mixer_mat_fx[out_ch][in_ch][spar_band], sub( 32767, hSpar->hMdDec->smooth_fac_fx[spar_band] ) ), hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band], hSpar->hMdDec->smooth_fac_fx[spar_band] ); /*q1*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ move32(); hSpar->hMdDec->mixer_mat_prev2_fx[out_ch][in_ch][spar_band] = mixer_mat_fx[out_ch][in_ch][spar_band]; /*q1*/ move32(); @@ -1908,68 +1872,6 @@ void ivas_spar_dec_upmixer_sf_fx( } } } -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS - FOR( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) - { - Word32 out_re_fx[IVAS_SPAR_MAX_CH]; - Word32 out_im_fx[IVAS_SPAR_MAX_CH]; - Word32 cldfb_par_fx; /*q1*/ - ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; - - FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - out_re_fx[out_ch] = 0; - move32(); - out_im_fx[out_ch] = 0; - move32(); - FOR( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - IF( b_skip_mat[out_ch][in_ch] == 0 ) - { - IF( LT_16( cldfb_band, CLDFB_PAR_WEIGHT_START_BAND ) ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ - { - spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; /*Q0*/ - move16(); - cldfb_par_fx = mixer_mat_fx[out_ch][in_ch][spar_band]; /*q1*/ - move32(); - } - ELSE - { - Word64 acc = 0; - move64(); - FOR( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) - { - /* accumulate contributions from all SPAR bands */ - acc = W_mac_32_32( acc, mixer_mat_fx[out_ch][in_ch][spar_band], bin2band->pp_cldfb_weights_per_spar_band_fx[cldfb_band][spar_band] ); // q1+ Q23 - } - cldfb_par_fx = W_shl_sat_l( acc, -23 ); // q1 - } - - out_re_fx[out_ch] = Madd_32_32( out_re_fx[out_ch], cldfb_in_ts_re_fx[in_ch][ts][cldfb_band], cldfb_par_fx ); /*q1-25*/ - move32(); - out_im_fx[out_ch] = Madd_32_32( out_im_fx[out_ch], cldfb_in_ts_im_fx[in_ch][ts][cldfb_band], cldfb_par_fx ); /*q1-25*/ - move32(); - } - } - } - - /*update CLDFB data with the parameter-modified data*/ - FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) - { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ - move32(); -#endif - } - } -#else /* FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS */ /* Note: This version splits the cldfb band loop into 2 loops, removing some inner-loop IF_statements */ Word16 min_cldf_band = s_min( CLDFB_PAR_WEIGHT_START_BAND, num_cldfb_bands ); Word32 out_re_fx[IVAS_SPAR_MAX_CH]; @@ -2004,17 +1906,10 @@ void ivas_spar_dec_upmixer_sf_fx( /*update CLDFB data with the parameter-modified data*/ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ move32(); cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ move32(); -#endif } } @@ -2052,20 +1947,12 @@ void ivas_spar_dec_upmixer_sf_fx( /*update CLDFB data with the parameter-modified data*/ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { -#ifndef FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL - cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); - cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sub( 31, q1 ) ); /*Q=6*/ - move32(); -#else cldfb_in_ts_re_fx[out_ch][ts][cldfb_band] = L_shl( out_re_fx[out_ch], sh_l ); /*Q=6*/ move32(); cldfb_in_ts_im_fx[out_ch][ts][cldfb_band] = L_shl( out_im_fx[out_ch], sh_l ); /*Q=6*/ move32(); -#endif } } -#endif /* FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS */ test(); IF( ( EQ_16( ( add( add( slot_idx_start, ts ), 1 ) ), hSpar->num_slots ) ) || ( NE_16( ( shr( md_idx, 2 ) /* md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME */ ), ( hSpar->render_to_md_map[( ( slot_idx_start + ts ) + 1 )] / JBM_CLDFB_SLOTS_IN_SUBFRAME /*It's value is 4*/ ) ) ) ) { @@ -2080,12 +1967,6 @@ void ivas_spar_dec_upmixer_sf_fx( } IF( LT_16( split_band, IVAS_MAX_NUM_BANDS ) ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[1][0][0], hSpar->hMdDec->mixer_mat_prev_fx[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[2][0][0], hSpar->hMdDec->mixer_mat_prev_fx[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[3][0][0], hSpar->hMdDec->mixer_mat_prev_fx[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ - Copy32( hSpar->hMdDec->mixer_mat_prev_fx[4][0][0], hSpar->hMdDec->mixer_mat_prev_fx[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); /*hSpar->hMdDec->Q_mixer_mat*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( out_ch = 0; out_ch < numch_out; out_ch++ ) { @@ -2093,7 +1974,6 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( b = 0; b < num_spar_bands; b++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE hSpar->hMdDec->mixer_mat_prev_fx[0][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[1][out_ch][in_ch][b]; hSpar->hMdDec->mixer_mat_prev_fx[1][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[2][out_ch][in_ch][b]; hSpar->hMdDec->mixer_mat_prev_fx[2][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_prev_fx[3][out_ch][in_ch][b]; @@ -2102,7 +1982,6 @@ void ivas_spar_dec_upmixer_sf_fx( move32(); move32(); move32(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ hSpar->hMdDec->mixer_mat_prev_fx[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][( b + ( md_sf * IVAS_MAX_NUM_BANDS ) )]; /*hSpar->hMdDec->Q_mixer_mat*/ move32(); @@ -2156,26 +2035,10 @@ void ivas_spar_dec_upmixer_sf_fx( IF( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) || !( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) && !( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, -6 ); /*st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state-6*/ - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = sub( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, 6 ); - move16(); - Scale_sig32( output_fx[ch], out_len, -6 ); /*Q5*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, st_ivas->cldfbSynDec[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( output_fx[ch], out_len, 6 ); /*Q11*/ - Scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, 6 ); /*st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state+6*/ - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = add( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, 6 ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } idx_in = add( idx_in, 1 ); @@ -2187,26 +2050,10 @@ void ivas_spar_dec_upmixer_sf_fx( /* CLDFB to time synthesis (overwrite mixer output) */ FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx, st_ivas->cldfbSynDec[out_ch]->p_filter_length, -6 ); /*st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state-6*/ - st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state = sub( st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state, 6 ); - move16(); - Scale_sig32( output_fx[out_ch], out_len, -6 ); /*Q5*/ -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[out_ch] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } -#ifndef OPT_SBA_AVOID_SPAR_RESCALE - Scale_sig32( output_fx[out_ch], out_len, 6 ); /*Q11*/ - Scale_sig32( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx, st_ivas->cldfbSynDec[out_ch]->p_filter_length, 6 ); /*st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state+6*/ - st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state = add( st_ivas->cldfbSynDec[out_ch]->Q_cldfb_state, 6 ); - move16(); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5704f4f60..429a99ca4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -961,9 +961,7 @@ typedef struct decoder_tc_buffer_structure Word32 *tc_buffer_fx; /* the buffer itself */ Word16 tc_buff_len; /*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV -#ifdef MSAN_FIX Word16 no_channels; /*Stores no of channels in tc_fx with values*/ -#endif Word16 q_tc_fx; TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ Word16 nchan_transport_jbm; /* number of TCs after TC decoding */ diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 223860db0..478f96dc1 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -683,12 +683,8 @@ static void stereo_dft_generate_comfort_noise_fx( factor = L_min( L_add( L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ), W_extract_l( W_mult0_32_32( Mpy_32_16_1( L_sub( factor, L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ) ), ONE_BY_MAX_K ), hStereoCng->xfade_frame_counter ) ) ), factor ); /* q_div */ FOR( ; j <= hFdCngCom->part[k]; j++ ) { -#ifdef FIX_ISSUE_1218 /* NOTE: saturation is added here as part of issue 1218 fix. After rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */ hFdCngCom->cngNoiseLevel[j] = L_shl_sat( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp) */ -#else - hFdCngCom->cngNoiseLevel[j] = L_shl( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp) */ -#endif move32(); } } diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 9c1b488cb..324f2b7f3 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -96,9 +96,7 @@ void stereo_dft_dec_reset_fx( { Word16 i; Word16 j, b; -#ifdef MSAN_FIX set_zero_fx( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); -#endif /*Configuration*/ set16_fx( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); @@ -122,25 +120,13 @@ void stereo_dft_dec_reset_fx( set16_fx( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); -#ifdef MSAN_FIX FOR( i = 0; i < STEREO_DFT_BAND_MAX * 2; i++ ) { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } -#else - FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ - move32(); - } -#endif -#ifdef MSAN_FIX set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX * 2 ); -#else - set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); -#endif /*residual coding*/ set16_fx( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); @@ -260,7 +246,6 @@ void stereo_dft_dec_reset_fx( move32(); hStereoDft->frame_sid_nodata = 0; move16(); -#ifdef MSAN_FIX FOR( b = 0; b < 2 * IVAS_MAX_NUM_BANDS; b++ ) { FOR( i = 0; i < 2; i++ ) @@ -272,19 +257,6 @@ void stereo_dft_dec_reset_fx( } } } -#else - FOR( b = 0; b < hStereoDft->nbands; b++ ) - { - FOR( i = 0; i < 2; i++ ) - { - FOR( j = 0; j < 4; j++ ) - { - hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; - move32(); - } - } - } -#endif hStereoDft->first_frame = 1; move16(); hStereoDft->g_L_prev_fx = 0; @@ -429,9 +401,7 @@ ivas_error stereo_dft_dec_create_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hStereoDft_loc->hb_nrg_subr_fx, STEREO_DFT_NBDIV ); /*Setting hb_nrg_subr_fx to zero*/ -#endif // MSAN_FIX hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); @@ -1436,11 +1406,7 @@ void stereo_dft_dec_res_fx( move32(); } } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif IF( res_bpf_flag ) { v_sub_32( output, bpf_error_signal_8k, output, L_FRAME8k ); @@ -1451,20 +1417,12 @@ void stereo_dft_dec_res_fx( set16_fx( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif } ELSE { /* This step is needed to ensure output is properly populated with scaled values in all cases*/ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( out_16, output, L_FRAME8k, sub( 15, sub( q_shift, 1 ) ) ); /* Q15 */ -#else - Copy_Scale_sig_16_32_DEPREC( out_16, output, L_FRAME8k, 16 ); /* Q16 */ -#endif } return; diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index 694aad0b4..73cf9ccd0 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -59,13 +59,8 @@ void stereo_tca_dec_fx( ) { /* Buffers, input Left and right channels @ input_Fs*/ -#ifdef MSAN_FIX Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; -#else - Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; - Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; -#endif Word32 *ptrChanL_fx, *ptrChanR_fx; Word32 *target_fx; Word16 target_idx, prevNCShift, currentNCShift, l_shift_adapt; diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 04aeccbb5..1c2ecffaf 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -234,12 +234,10 @@ void stereo_icBWE_dec_fx( ELSE { set32_fx( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, 0, output_frame ); -#ifdef MSAN_FIX hCPE->hStereoDft->hb_nrg_subr_fx[0] = 0; move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); -#endif // MSAN_FIX } hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[0], shl( shr( hCPE->hStereoDft->NFFT, 1 ), 6 ) ) ); // 2 * (Qsynth + SynthRef_shift) - 40 // 2 * (Qx + SynthRef_shift) - 31 - 15 move32(); @@ -719,11 +717,7 @@ void stereo_icBWE_dec_fx( { IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { -#ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) @@ -819,11 +813,7 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prev_Q_fsout = tmp; move16(); } -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); -#else Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ -#endif *Q_syn = sub( *Q_syn, 1 ); @@ -886,11 +876,7 @@ void stereo_icBWE_dec_fx( { IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { -#ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index a6b350d33..cd7e92f71 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -540,13 +540,8 @@ void stereo_mdct_core_dec_fx( move16(); } } -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */ Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */ -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, ( 28 - norm_s( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0] - 1 ) ) ); /* Q28 */ - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, ( 28 - norm_s( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0] - 1 ) ) ); /* Q28 */ -#endif ivas_mdct_core_reconstruct_fx( hCPE, x_fx, signal_outFB_tmp_fx, fUseTns, 0, Q11, e_sigFB ); Copy32( signal_out_tmp_fx[0], signal_out_fx[0], L_FRAME48k ); /* Q11 */ diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 5b1378a89..5248839f5 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -904,13 +904,8 @@ void updateBuffersForDmxMdctStereo_fx( move16(); sts[0]->hTcxLtpDec->exp_tcxltp_mem_out = add( sts[0]->hTcxLtpDec->exp_tcxltp_mem_out, 1 ); move16(); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( &sts[0]->hTcxLtpDec->tcxltp_mem_in[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in ) ) ); // Q11 Copy_Scale_sig_16_32_no_sat( &sts[0]->hTcxLtpDec->tcxltp_mem_out[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out ) ) ); // Q11 -#else - Copy_Scale_sig_16_32_DEPREC( &sts[0]->hTcxLtpDec->tcxltp_mem_in[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in ) ) ); // Q11 - Copy_Scale_sig_16_32_DEPREC( &sts[0]->hTcxLtpDec->tcxltp_mem_out[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], TCXLTP_MAX_DELAY, sub( 11, sub( 15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out ) ) ); // Q11 -#endif } return; diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 6c2ad055c..1a6ea257b 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -197,9 +197,7 @@ static ivas_error allocate_CoreCoder_fx( } hf_synth_init_fx( st->hBWE_zero ); -#ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif } IF( st->cldfbAna == NULL ) @@ -2153,21 +2151,13 @@ void stereo_td2dft_update_fx( /* update buffers used for fading when switching to DFT Stereo */ v_add_fx( sts[0]->hHQ_core->old_out_LB_fx32 + nsLB, sts[1]->hHQ_core->old_out_LB_fx32 + nsLB, hCPE->old_outLB_mdct_fx, old_outLB_len ); L_lerp_fx_q11( hCPE->old_outLB_mdct_fx, hCPE->old_outLB_mdct_fx, STEREO_MDCT2DFT_FADE_LEN_48k, old_outLB_len ); -#ifndef MSAN_FIX - for ( i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) -#else FOR( i = 0; i < old_outLB_len; i++ ) -#endif { hCPE->old_outLB_mdct_fx[i] = L_shr( hCPE->old_outLB_mdct_fx[i], 1 ); /* Q11 */ move32(); } v_add_fx( sts[0]->hHQ_core->old_out_fx32 + ns, sts[1]->hHQ_core->old_out_fx32 + ns, hCPE->old_out_mdct_fx, old_out_len ); /* exp(exp_old_out) */ -#ifndef MSAN_FIX - for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) -#else FOR( i = 0; i < old_out_len; i++ ) -#endif { hCPE->old_out_mdct_fx[i] = L_shr( hCPE->old_out_mdct_fx[i], 1 ); /* q_old_out_mdct */ move32(); diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 1467687d8..dd9859504 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -70,11 +70,7 @@ static void biDiagonalReductionLeft_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ @@ -88,11 +84,7 @@ static void biDiagonalReductionLeft_fx( static void biDiagonalReductionRight_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ @@ -105,11 +97,7 @@ static void biDiagonalReductionRight_fx( static void singularVectorsAccumulationLeft_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) as Input, Q31 as output */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC /* Q0 */ @@ -119,16 +107,8 @@ static void singularVectorsAccumulationRight_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* singularVectors_e */ Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* singularVectors_e */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_e, -#else Word16 *secDiag_e, -#endif const Word16 nChannelsC /* Q0 */ ); @@ -168,7 +148,6 @@ static void ApplyRotation_fx( const Word16 nChannels /* Q0 */ ); -#ifdef FIX_1010_OPT_GIVENS_INV static void GivensRotation2_fx( const Word32 x, /* exp(x_e) */ const Word16 x_e, @@ -178,7 +157,6 @@ static void GivensRotation2_fx( Word32 *resultInv, Word16 *out_e, Word16 *outInv_e ); -#endif static Word32 GivensRotation_fx( const Word32 x, /* exp(x_e) */ @@ -306,11 +284,7 @@ Word16 svd_fx( Word16 lengthSingularValues; Word16 errorMessage, condition; Word32 secDiag_fx[MAX_OUTPUT_CHANNELS]; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_fx_e = 0; -#else Word16 secDiag_fx_e[MAX_OUTPUT_CHANNELS]; -#endif move16(); Word32 eps_x_fx = 0, temp_fx; move16(); @@ -320,10 +294,6 @@ Word16 svd_fx( push_wmops( "svd_fx" ); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - set32_fx( secDiag_fx, 0, MAX_OUTPUT_CHANNELS ); - set16_fx( singularValues_fx_e, 0, MAX_OUTPUT_CHANNELS ); -#endif /* Collecting Values */ FOR( iCh = 0; iCh < nChannelsL; iCh++ ) @@ -336,22 +306,14 @@ Word16 svd_fx( } /* Householder reduction */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - HouseholderReduction_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, InputMatrix_e, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, &eps_x_fx, &eps_x_fx_e ); -#else HouseholderReduction_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, InputMatrix_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, &eps_x_fx, &eps_x_fx_e ); -#endif /* Set extremely small values to zero if needed */ // flushToZeroArray(singularValues, max_length); // flushToZeroMat(singularVectors_Left, nChannelsL, nChannelsL); // flushToZeroMat(singularVectors_Right, nChannelsC, nChannelsC); /* BidagonalDiagonalisation */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - errorMessage = BidagonalDiagonalisation_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, eps_x_fx, eps_x_fx_e ); /* Q0 */ -#else errorMessage = BidagonalDiagonalisation_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, eps_x_fx, eps_x_fx_e ); /* Q0 */ -#endif /* Sort the singular values descending order */ lengthSingularValues = s_min( nChannelsL, nChannelsC ); /* Q0 */ @@ -423,11 +385,7 @@ static Word16 BidagonalDiagonalisation_fx( Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) singularValues_fx_e*/ Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: secDiag_fx_e*/ Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 *secDiag_fx_e, /* i/o: */ -#else Word16 *secDiag_new_e, /* i/o: */ -#endif const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ const Word32 eps_x, /* i : eps_x_e*/ @@ -441,9 +399,7 @@ static Word16 BidagonalDiagonalisation_fx( move16(); move16(); Word16 temp_exp; -#ifdef FIX_1010_OPT_NORM_NOSAT Word16 temp_exp2; -#endif Word32 g = 0; move16(); Word16 g_e = 0; @@ -451,14 +407,8 @@ static Word16 BidagonalDiagonalisation_fx( Word16 convergence, iteration, found_split; Word16 error = 0; move16(); -#ifdef FIX_1010_OPT_GIVENS_INV Word32 temp; -#endif Word16 singularValues_new_e[MAX_OUTPUT_CHANNELS]; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_new_e[MAX_OUTPUT_CHANNELS]; - set16_fx( secDiag_new_e, *secDiag_fx_e, MAX_OUTPUT_CHANNELS ); -#endif Copy( singularValues_fx_e, singularValues_new_e, MAX_OUTPUT_CHANNELS ); FOR( iCh = nChannelsC - 1; iCh >= 0; iCh-- ) /* nChannelsC */ @@ -527,46 +477,17 @@ static Word16 BidagonalDiagonalisation_fx( c = singularValues_fx[kCh]; /* exp(singularValues_new_e) */ c_e = singularValues_new_e[kCh]; -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_fx[kCh], &temp, &singularValues_new_e[kCh], &temp_exp ); /* exp(singularValues_new_e) */ c = Mpy_32_32( c, temp ); c_e = add( c_e, temp_exp ); -#else - singularValues_fx[kCh] = GivensRotation_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_new_e[kCh] ); /* exp(singularValues_new_e) */ - c = BASOP_Util_Divide3232_Scale_cadence( c, maxWithSign_fx( singularValues_fx[kCh] ), &temp_exp ); /* exp(temp_exp + (c_e - singularValues_new_e)) */ - c_e = add( temp_exp, sub( c_e, singularValues_new_e[kCh] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_exp2 = norm_l( c ); c = L_shl( c, temp_exp2 ); c_e = sub( c_e, temp_exp2 ); -#endif -#ifdef FIX_1010_OPT_GIVENS_INV s = Mpy_32_32( -g, temp ); s_e = add( g_e, temp_exp ); -#else - s = BASOP_Util_Divide3232_Scale_cadence( -g, maxWithSign_fx( singularValues_fx[kCh] ), &temp_exp ); /* exp(temp_exp + (g_e - singularValues_new_e))*/ - s_e = add( temp_exp, sub( g_e, singularValues_new_e[kCh] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_exp2 = norm_l( s ); s = L_shl( s, temp_exp2 ); s_e = sub( s_e, temp_exp2 ); -#endif ApplyRotation_fx( singularVectors_Left_fx, c, c_e, s, s_e, 0, x11_e, 0, x12_e, &f1, &f1_e, &f2, &f2_e, kCh, split, nChannelsL ); /* nChannelsL */ } } @@ -617,24 +538,6 @@ static Word16 BidagonalDiagonalisation_fx( // rescaling block Copy( singularValues_new_e, singularValues_fx_e, MAX_OUTPUT_CHANNELS ); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 max_exp = -31; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - if ( secDiag_fx[iCh] ) - { - max_exp = s_max( max_exp, secDiag_new_e[iCh] ); - } - } - *secDiag_fx_e = max_exp; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - secDiag_fx[iCh] = L_shr_r( secDiag_fx[iCh], sub( *secDiag_fx_e, secDiag_new_e[iCh] ) ); /* exp(secDiag_fx_e) */ - move32(); - } -#endif return ( error ); } @@ -658,13 +561,9 @@ static void ApplyQRTransform_fx( const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ ) { -#ifdef FIX_1010_OPT_GIVENS_INV Word32 temp; Word16 temp_e; -#endif -#ifdef FIX_1010_OPT_NORM_NOSAT Word16 temp_norm_e; -#endif Word16 ch, split; Word32 d = 0, g = 0, r = 0, x_ii = 0, x_split = 0, x_kk = 0, mu = 0, aux = 0; move32(); @@ -767,47 +666,17 @@ static void ApplyQRTransform_fx( g = Mpy_32_32( c, secDiag[ch + 1] ); /* exp(c_e + secDiag_e) */ g_e = add( c_e, secDiag_e[ch + 1] ); -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( d, d_e, r, r_e, &secDiag[ch], &temp, &secDiag_e[ch], &temp_e ); /* exp(secDiag_e) */ c = Mpy_32_32( d, temp ); c_e = add( temp_e, d_e ); -#else - secDiag[ch] = GivensRotation_fx( d, d_e, r, r_e, &secDiag_e[ch] ); /* exp(secDiag_e) */ - move32(); - c = BASOP_Util_Divide3232_Scale_cadence( d, maxWithSign_fx( secDiag[ch] ), &c_e ); /* exp(c_e + (d_e + secDiag_e)) */ - c_e = add( c_e, sub( d_e, secDiag_e[ch] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_norm_e = norm_l( c ); c = L_shl( c, temp_norm_e ); c_e = sub( c_e, temp_norm_e ); -#endif -#ifdef FIX_1010_OPT_GIVENS_INV s = Mpy_32_32( r, temp ); s_e = add( r_e, temp_e ); -#else - s = BASOP_Util_Divide3232_Scale_cadence( r, maxWithSign_fx( secDiag[ch] ), &s_e ); /* exp(s_e + (r_e - sec_Diag_e))*/ - s_e = add( s_e, sub( r_e, secDiag_e[ch] ) ); -#endif -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_norm_e = norm_l( s ); s = L_shl( s, temp_norm_e ); s_e = sub( s_e, temp_norm_e ); -#endif r = Mpy_32_32( s, singularValues[ch + 1] ); /* exp(r_e + secDiag_e) */ r_e = add( s_e, singularValues_e[ch + 1] ); x_split = Mpy_32_32( c, singularValues[ch + 1] ); /* exp(c_e + secDiag_e) */ @@ -821,48 +690,21 @@ static void ApplyQRTransform_fx( // ApplyRotation(singularVectors_Right, c, s, x_ii, aux, &d, &g, ch + 1, ch, nChannelsC); ApplyRotation_fx( singularVectors_Right, c, c_e, s, s_e, x_ii, x_ii_e, aux, aux_e, &d, &d_e, &g, &g_e, ch + 1, ch, nChannelsC ); -#ifdef FIX_1010_OPT_GIVENS_INV GivensRotation2_fx( d, d_e, r, r_e, &singularValues[ch], &aux, &singularValues_e[ch], &aux_e ); /* exp(singularValues_e) */ -#else - singularValues[ch] = GivensRotation_fx( d, d_e, r, r_e, &singularValues_e[ch] ); /* exp(singularValues_e) */ - move32(); -#endif IF( singularValues[ch] != 0 ) { -#ifndef FIX_1010_OPT_GIVENS_INV - aux = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, singularValues[ch], &aux_e ); /* exp(aux_e + (1 - singularValues_e)) */ - aux_e = add( aux_e, sub( 1, singularValues_e[ch] ) ); -#endif c = Mpy_32_32( d, aux ); /* exp(d_e + aux_e) */ c_e = add( d_e, aux_e ); -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( c_e > 0 ) - { - c = L_shl_sat( c, c_e ); // Q31 - c_e = 0; - move16(); - } -#else temp_norm_e = norm_l( c ); c = L_shl( c, temp_norm_e ); c_e = sub( c_e, temp_norm_e ); -#endif s = Mpy_32_32( r, aux ); /* exp(r_e + aux_e) */ s_e = add( r_e, aux_e ); -#ifndef FIX_1010_OPT_NORM_NOSAT - IF( s_e > 0 ) - { - s = L_shl_sat( s, s_e ); // Q31 - s_e = 0; - move16(); - } -#else temp_norm_e = norm_l( s ); s = L_shl( s, temp_norm_e ); s_e = sub( s_e, temp_norm_e ); -#endif } // ApplyRotation(singularVectors_Left, c, s, g, x_split, &d, &x_ii, ch + 1, ch, nChannelsL); @@ -915,7 +757,6 @@ static void ApplyRotation_fx( *g = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), add( c_e, x12_e ), Mpy_32_32( L_negate( s ), x11 ), add( s_e, x11_e ), g_e ); /* exp(g_e) */ move32(); -#ifdef SVD_WMOPS_OPT Word16 c_q = sub( 31, c_e ); Word16 s_q = sub( 31, s_e ); Word32 op1, op2; @@ -957,42 +798,6 @@ static void ApplyRotation_fx( singularVector[ch][currentIndex1] = W_sat_l( temp ); // Q(singularVector) move32(); } -#else -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - FOR( ch = 0; ch < nChannels; ch++ ) - { - x11 = singularVector[ch][currentIndex2]; - move32(); - x12 = singularVector[ch][currentIndex1]; - move32(); - singularVector[ch][currentIndex2] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), c_e, Mpy_32_32( s, x12 ), s_e, &temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex2] = L_shl_sat( singularVector[ch][currentIndex2], temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), c_e, Mpy_32_32( L_negate( s ), x11 ), s_e, &temp_exp ); /* exp(temp_exp) */ - move32(); - singularVector[ch][currentIndex1] = L_shl_sat( singularVector[ch][currentIndex1], temp_exp ); /* exp(temp_exp) */ - move32(); - } -#else - Word32 s_neg = L_negate( s ); - Word32 temp; - FOR( ch = 0; ch < nChannels; ch++ ) - { - x11 = singularVector[ch][currentIndex2]; - move32(); - x12 = singularVector[ch][currentIndex1]; - move32(); - temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), c_e, Mpy_32_32( s, x12 ), s_e, &temp_exp ); /* exp(temp_exp) */ - singularVector[ch][currentIndex2] = L_shl_sat( temp, temp_exp ); /* exp(temp_exp) */ - move32(); - temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), c_e, Mpy_32_32( s_neg, x11 ), s_e, &temp_exp ); /* exp(temp_exp) */ - singularVector[ch][currentIndex1] = L_shl_sat( temp, temp_exp ); /* exp(temp_exp) */ - move32(); - } - -#endif -#endif return; } @@ -1024,7 +829,6 @@ static void HouseholderReduction_fx( Word16 sig_x_fx_e = 0; move16(); -#ifdef FIX_1010_OPT_SINGLE_RESCALE Word16 iCh, jCh; Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; FOR( jCh = 0; jCh < nChannelsL; jCh++ ) @@ -1035,25 +839,15 @@ static void HouseholderReduction_fx( move16(); } } -#endif /* Bidiagonal Reduction for every channel */ FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, &singularVectors_Left_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); - biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, &singularVectors_Left_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); -#else biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); -#endif Word16 L_temp_e; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), *secDiag_fx_e, &L_temp_e ); /* exp(L_temp_e) */ -#else Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), secDiag_fx_e[nCh], &L_temp_e ); /* exp(L_temp_e) */ -#endif IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_temp, L_temp_e, *eps_x_fx, *eps_x_fx_e ), 1 ) ) { *eps_x_fx = L_temp; /* exp(L_temp_e) */ @@ -1064,19 +858,10 @@ static void HouseholderReduction_fx( } /* SingularVecotr Accumulation */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_e, *secDiag_fx_e, nChannelsC ); - singularVectorsAccumulationLeft_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Left_e, singularValues_fx_e, nChannelsL, nChannelsC ); -#else -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, *secDiag_fx_e, nChannelsC ); -#else singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsC ); -#endif singularVectorsAccumulationLeft_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Left_fx_e, singularValues_fx_e, nChannelsL, nChannelsC ); -#endif return; } @@ -1091,11 +876,7 @@ static void biDiagonalReductionLeft_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], Word16 *secDiag_e, const Word16 nChannelsL, /* Q0 */ @@ -1111,39 +892,11 @@ static void biDiagonalReductionLeft_fx( Word16 norm_x_e, f_e, r_e; Word32 L_temp; Word16 L_temp_e; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp[MAX_OUTPUT_CHANNELS]; - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ ) - { - set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); /* exp(sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - // rescaling block - IF( GT_16( *sig_x_e, *secDiag_e ) ) - { - FOR( Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++ ){ - IF( NE_16( i, currChannel ) ){ - secDiag[i] = L_shl( secDiag[i], sub( *secDiag_e, *sig_x_e ) ); /* sig_x_e */ - move32(); - } -} -*secDiag_e = *sig_x_e; -move16(); -} -ELSE IF( LT_16( *sig_x_e, *secDiag_e ) ) -{ - secDiag[currChannel] = L_shr_r( secDiag[currChannel], sub( *secDiag_e, *sig_x_e ) ); /* exp(secDiag_e) */ - move32(); -} -#else secDiag_e[currChannel] = *sig_x_e; move16(); -#endif /* Setting values to 0 */ ( *sig_x ) = 0; @@ -1158,54 +911,26 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */ -#else ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ -#endif } IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ { -#ifdef FIX_1010_OPT_DIV Word16 invVal_e; Word32 invVal; invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); -#endif norm_x = 0; move32(); norm_x_e = 0; move16(); FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else - singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &L_temp_e ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - singularVectors2_e[jCh][currChannel] = add( L_temp_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ); - move16(); - 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 -#else Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp[jCh] = sub( add( invVal_e, sub( *singularVectors_e, *sig_x_e ) ), temp_e ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); move16(); 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 -#endif } IF( GT_16( norm_x_e, 0 ) ) { @@ -1219,38 +944,18 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ L_temp = Sqrt32( norm_x, &L_temp_e ); L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - IF( singularVectors[currChannel][idx] >= 0 ) - { - ( *g ) = L_negate( L_temp ); - move32(); - } - ELSE - { - ( *g ) = L_negate( L_negate( L_temp ) ); - move32(); - } -#else if ( singularVectors[currChannel][idx] >= 0 ) { L_temp = L_negate( L_temp ); } ( *g ) = L_temp; move32(); -#endif -#ifndef FIX_1010_OPT_SINGLE_RESCALE - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[currChannel], -( *g ), 0, &sing_exp[currChannel] ); /* sing_exp */ -#else r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ -#endif move32(); -#ifdef FIX_1010_OPT_DIV invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); -#endif FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { @@ -1260,28 +965,15 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ move16(); FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( sing_exp[jCh], *singularVectors_e ), &norm_x_e ); /* exp(norm_x_e) */ -#else 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 } -#ifndef FIX_1010_OPT_DIV - f = BASOP_Util_Divide3232_Scale_cadence( norm_x, maxWithSign_fx( r ), &f_e ); /* f_e + (norm_x_e - r_e) */ - f_e = add( f_e, sub( norm_x_e, r_e ) ); -#else 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 ) ); -#endif FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], *singularVectors_e, Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, sing_exp[jCh] ), &sing_exp2[jCh][iCh] ); /* exp( sing_exp2) */ -#else singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] ); -#endif move32(); } } @@ -1291,37 +983,10 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ { singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[jCh][currChannel] = add( sing_exp[jCh], *sig_x_e ); -#else singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e ); -#endif move16(); } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - // rescaling block - Word16 exp_max = *singularVectors_e; - move16(); - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsL; jCh++ ) - { - exp_max = s_max( exp_max, sing_exp2[jCh][iCh] ); - } - } - - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsL; jCh++ ) - { - singularVectors[jCh][iCh] = L_shr_r( singularVectors[jCh][iCh], sub( exp_max, sing_exp2[jCh][iCh] ) ); /* exp(exp_max) */ - move32(); - } - } - *singularVectors_e = exp_max; - move16(); -#endif } // rescaling block @@ -1343,16 +1008,8 @@ return; static void biDiagonalReductionRight_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_exp[]) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 *singularVectors_e, -#else Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 *secDiag_e, -#else Word16 *secDiag_exp, -#endif const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ @@ -1364,22 +1021,8 @@ static void biDiagonalReductionRight_fx( Word16 iCh, jCh, idx; Word32 norm_x, r; Word16 norm_x_e, r_e; -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_exp[MAX_OUTPUT_CHANNELS]; -#endif Word32 L_temp; Word16 L_temp_e; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp[MAX_OUTPUT_CHANNELS]; - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ ) - { - set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - set16_fx( secDiag_exp, *secDiag_e, MAX_OUTPUT_CHANNELS ); -#endif /* Setting values to 0 */ ( *sig_x ) = 0; @@ -1393,11 +1036,7 @@ static void biDiagonalReductionRight_fx( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */ -#else ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), singularVectors2_e[currChannel][jCh], sig_x_e ); /* exp(sig_x_e) */ -#endif } IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ @@ -1407,41 +1046,17 @@ static void biDiagonalReductionRight_fx( norm_x_e = 0; move16(); -#ifdef FIX_1010_OPT_DIV Word16 invVal_e, temp_e; Word32 invVal; invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); -#endif FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e)) */ - move32(); - sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else - singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( *sig_x ), &L_temp_e ); /* exp(sing_exp + (singularVectors_e - sig_x_e)) */ - move32(); - singularVectors2_e[currChannel][jCh] = add( L_temp_e, sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#endif -#else temp_e = norm_l( singularVectors[currChannel][jCh] ); singularVectors[currChannel][jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp[jCh] = add( sub( invVal_e, temp_e ), sub( *singularVectors_e, *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#else singularVectors2_e[currChannel][jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) ); move16(); norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ -#endif -#endif } IF( GT_16( norm_x_e, 0 ) ) { @@ -1465,44 +1080,19 @@ static void biDiagonalReductionRight_fx( move32(); } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[idx] ); /* exp(sing_exp) */ -#else r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */ -#endif move32(); -#ifdef FIX_1010_OPT_DIV invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); -#endif FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_DIV -#ifndef FIX_1010_OPT_SINGLE_RESCALE - secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( r ), &secDiag_exp[jCh] ); /* exp(secDiag_exp + (sing_exp - r_e) */ - move32(); - secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( sing_exp[jCh], r_e ) ); - move32(); -#else - secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( r ), &secDiag_exp[jCh] ); /* exp(secDiag_exp + (sing_exp - r_e) */ - move32(); - secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( singularVectors2_e[currChannel][jCh], r_e ) ); - move32(); -#endif -#else temp_e = norm_l( singularVectors[currChannel][jCh] ); secDiag[jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( sing_exp[jCh], r_e ) ); -#else secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], r_e ) ); -#endif move16(); -#endif } FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */ @@ -1513,20 +1103,12 @@ static void biDiagonalReductionRight_fx( move16(); FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( *singularVectors_e, sing_exp[jCh] ), &norm_x_e ); /* exp(norm_x_e) */ -#else norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */ -#endif } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], *singularVectors_e, Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &sing_exp2[iCh][jCh] ); /* exp(sing_exp2) */ -#else singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ -#endif move32(); } } @@ -1535,54 +1117,12 @@ static void biDiagonalReductionRight_fx( { singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[currChannel][jCh] = add( sing_exp[jCh], *sig_x_e ); -#else singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); -#endif move16(); } -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - /*rescaling block*/ - Word16 exp_max = *secDiag_e; - move16(); - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - exp_max = s_max( exp_max, secDiag_exp[jCh] ); - } - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - secDiag[jCh] = L_shr_r( secDiag[jCh], sub( exp_max, secDiag_exp[jCh] ) ); /* exp(exp_max) */ - move32(); - } - *secDiag_e = exp_max; - move16(); -#endif - -#ifndef FIX_1010_OPT_SINGLE_RESCALE - exp_max = *singularVectors_e; - move16(); - FOR( iCh = 0; iCh < nChannelsL; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - exp_max = s_max( exp_max, sing_exp2[iCh][jCh] ); - } - } - FOR( iCh = 0; iCh < nChannelsL; iCh++ ) - { - FOR( jCh = 0; jCh < nChannelsC; jCh++ ) - { - singularVectors[iCh][jCh] = L_shr_r( singularVectors[iCh][jCh], sub( exp_max, sing_exp2[iCh][jCh] ) ); /* exp(exp_max) */ - move32(); - } - } - *singularVectors_e = exp_max; - move16(); -#endif } } @@ -1598,11 +1138,7 @@ static void biDiagonalReductionRight_fx( static void singularVectorsAccumulationLeft_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* input exp(singularVectors_Left_e), output Q31 */ Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif Word16 singularValues_e[MAX_OUTPUT_CHANNELS], const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC /* Q0 */ @@ -1612,13 +1148,6 @@ static void singularVectorsAccumulationLeft_fx( Word16 nChannels; Word32 norm_y, t_jj, t_ii; Word16 norm_y_e, t_jj_e, t_ii_e, temp_exp; -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; - FOR( nCh = 0; nCh < MAX_OUTPUT_CHANNELS; nCh++ ) - { - set16_fx( sing_exp2[nCh], singularVectors_e, MAX_OUTPUT_CHANNELS ); - } -#endif /* Processing */ nChannels = s_min( nChannelsL, nChannelsC ); /* min(nChannelsL,ChannelsC) Q0*/ @@ -1638,13 +1167,8 @@ static void singularVectorsAccumulationLeft_fx( IF( t_ii ) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/ { -#ifdef FIX_1010_OPT_DIV t_ii = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( t_ii ), &temp_exp ); t_ii_e = sub( temp_exp, t_ii_e ); -#else - t_ii = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxWithSign_fx( t_ii ), &temp_exp ); /* exp(1 + (temp_exp + tii_e)) */ - t_ii_e = add( 1, sub( temp_exp, t_ii_e ) ); -#endif Word16 tempe; Word32 temp = BASOP_Util_Divide3232_Scale_cadence( t_ii, maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &tempe ); tempe = add( tempe, sub( t_ii_e, singularVectors_Left_e[nCh][nCh] ) ); @@ -1659,13 +1183,9 @@ static void singularVectorsAccumulationLeft_fx( move16(); FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ), add( sing_exp2[k][nCh], sing_exp2[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */ -#else prod[k] = W_mult0_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ); prod_e[k] = add( singularVectors_Left_e[k][nCh], singularVectors_Left_e[k][iCh] ); max_e = s_max( max_e, prod_e[k] ); -#endif } FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */ @@ -1678,18 +1198,10 @@ static void singularVectorsAccumulationLeft_fx( norm_y = W_extract_h( acc ); norm_y_e = add( sub( max_e, acc_e ), 1 ); t_jj = Mpy_32_32( temp, norm_y ); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - t_jj_e = add( temp_exp, sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) ); -#else t_jj_e = add( tempe, norm_y_e ); -#endif FOR( k = nCh; k < nChannelsL; k++ ) /* nChannelsL */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[k][iCh], sing_exp2[k][iCh], Mpy_32_32( t_jj, singularVectors_Left[k][nCh] ), add( t_jj_e, sing_exp2[k][nCh] ), &sing_exp2[k][iCh] ); /* exp(sing_exp2) */ -#else singularVectors_Left[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[k][iCh], singularVectors_Left_e[k][iCh], Mpy_32_32( t_jj, singularVectors_Left[k][nCh] ), add( t_jj_e, singularVectors_Left_e[k][nCh] ), &singularVectors_Left_e[k][iCh] ); /* exp(sing_exp2) */ -#endif move32(); } } @@ -1698,11 +1210,7 @@ static void singularVectorsAccumulationLeft_fx( { singularVectors_Left[iCh][nCh] = Mpy_32_32( singularVectors_Left[iCh][nCh], t_ii ); /* exp(sing_exp2 + t_ii_e) */ move32(); -#ifndef FIX_1010_OPT_SINGLE_RESCALE - sing_exp2[iCh][nCh] = add( sing_exp2[iCh][nCh], t_ii_e ); -#else singularVectors_Left_e[iCh][nCh] = add( singularVectors_Left_e[iCh][nCh], t_ii_e ); -#endif move16(); } } @@ -1714,11 +1222,7 @@ static void singularVectorsAccumulationLeft_fx( move32(); } } -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[nCh][nCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[nCh][nCh], sing_exp2[nCh][nCh], ONE_IN_Q30, 1, &sing_exp2[nCh][nCh] ); /* exp(sing_exp2) */ -#else 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) */ -#endif move32(); } // fclose(fp); @@ -1726,11 +1230,7 @@ static void singularVectorsAccumulationLeft_fx( { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], sing_exp2[nCh][iCh] ); /* Q31 */ -#else singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ -#endif move32(); } } @@ -1748,16 +1248,8 @@ static void singularVectorsAccumulationRight_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_Left_e) */ Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* input exp(singularVectors_Left_e), output Q31 */ Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ -#ifndef FIX_1010_OPT_SINGLE_RESCALE - Word16 singularVectors_e, -#else Word16 singularVectors_Left_e[][MAX_OUTPUT_CHANNELS], -#endif -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - Word16 secDiag_e, -#else Word16 *secDiag_e, -#endif const Word16 nChannelsC /* Q0 */ ) { @@ -1783,22 +1275,11 @@ static void singularVectorsAccumulationRight_fx( FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC*/ { -#ifdef FIX_1010_OPT_DIV ratio_float = L_deposit_h( BASOP_Util_Divide3232_Scale( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1] ), &temp_exp1 ) ); /* exp(temp_exp1) */ singularVectors_Right[iCh][nCh] = L_deposit_h( BASOP_Util_Divide3232_Scale( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh] ) ); /* exp(sing_right_exp + (temp_exp1 - secDiag_e) */ -#else - ratio_float = BASOP_Util_Divide3232_Scale_cadence( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1] ), &temp_exp1 ); /* exp(temp_exp1) */ - singularVectors_Right[iCh][nCh] = BASOP_Util_Divide3232_Scale_cadence( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh] ); /* exp(sing_right_exp + (temp_exp1 - secDiag_e) */ -#endif -#ifdef FIX_1010_OPT_SINGLE_RESCALE temp_exp1 = add( temp_exp1, sub( singularVectors_Left_e[nCh][iCh], singularVectors_Left_e[nCh][nCh + 1] ) ); -#endif move32(); -#ifndef FIX_1010_OPT_SEC_SINGLE_RESCALE - sing_right_exp[iCh][nCh] = add( sing_right_exp[iCh][nCh], sub( temp_exp1, secDiag_e ) ); -#else sing_right_exp[iCh][nCh] = add( sing_right_exp[iCh][nCh], sub( temp_exp1, secDiag_e[nCh + 1] ) ); -#endif move16(); // singularVectors_Right[iCh][nCh] = L_shl_sat( singularVectors_Right[iCh][nCh], temp_exp2 ); } @@ -1812,11 +1293,7 @@ static void singularVectorsAccumulationRight_fx( FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ { -#ifndef FIX_1010_OPT_SINGLE_RESCALE - norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[nCh][k], singularVectors_Right[k][iCh] ), add( singularVectors_e, sing_right_exp[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */ -#else 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 } FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ @@ -1853,7 +1330,6 @@ static void singularVectorsAccumulationRight_fx( *-------------------------------------------------------------------------*/ -#ifdef FIX_1010_OPT_GIVENS_INV static void GivensRotation2_fx( const Word32 x, /* exp(x_e) */ const Word16 x_e, @@ -1875,7 +1351,6 @@ static void GivensRotation2_fx( *resultInv = ISqrt32( r, outInv_e ); move32(); } -#endif static Word32 GivensRotation_fx( const Word32 x, /* exp(x_e) */ @@ -1884,62 +1359,10 @@ static Word32 GivensRotation_fx( const Word16 z_e, Word16 *out_e ) { -#ifdef FIX_1010_OPT_GIVENS Word32 r; -#else - Word32 x_abs, z_abs; - Word32 cotan, tan, r; - Word16 temp_exp; - Word32 L_temp; -#endif -#ifdef FIX_1010_OPT_GIVENS r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( z, z ), shl( z_e, 1 ), Mpy_32_32( x, x ), shl( x_e, 1 ), out_e ); r = Sqrt32( r, out_e ); -#else - x_abs = L_abs( x ); - z_abs = L_abs( z ); - test(); - IF( LE_32( x_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, x_abs ) ) && LE_32( z_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, z_abs ) ) ) - { - r = 0; - move32(); - } - ELSE IF( BASOP_Util_Cmp_Mant32Exp( x_abs, x_e, z_abs, z_e ) >= 0 ) - { - IF( LE_32( x_abs, SVD_MINIMUM_VALUE_FX ) ) - { - r = 0; - move32(); - } - ELSE - { - cotan = BASOP_Util_Divide3232_Scale_cadence( z_abs, x_abs, &temp_exp ); /* exp(temp_exp + (z_e - x_e) */ - temp_exp = add( temp_exp, sub( z_e, x_e ) ); - L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( cotan, cotan ), 2 * temp_exp, &temp_exp ); /* exp(temp_exp) */ - L_temp = Sqrt32( L_temp, &temp_exp ); - r = Mpy_32_32( x_abs, L_temp ); /* exp(x_e + temp_exp) */ - *out_e = add( x_e, temp_exp ); - } - } - ELSE - { - IF( LE_32( z_abs, SVD_MINIMUM_VALUE_FX ) ) - { - r = 0; - move32(); - } - ELSE - { - tan = BASOP_Util_Divide3232_Scale_cadence( x_abs, z_abs, &temp_exp ); /* exp(temp_exp + (x_e - z_e) */ - temp_exp = add( temp_exp, sub( x_e, z_e ) ); - L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( tan, tan ), shl( temp_exp, 1 ), &temp_exp ); /* exp(temp_exp) */ - L_temp = Sqrt32( L_temp, &temp_exp ); - r = Mpy_32_32( z_abs, L_temp ); /* exp(z_e + temp_exp) */ - *out_e = add( z_e, temp_exp ); - } - } -#endif return ( r ); } @@ -1953,20 +1376,6 @@ static Word32 maxWithSign_fx( const Word32 a /* Qx */ ) { -#ifndef FIX_MINOR_SVD_WMOPS_MR1010X - IF( GT_32( L_abs( a ), SVD_MINIMUM_VALUE_FX ) ) - { - return a; - } - ELSE IF( a < 0 ) - { - return -SVD_MINIMUM_VALUE_FX; - } - ELSE - { - return SVD_MINIMUM_VALUE_FX; - } -#else Word32 result; IF( a >= 0 ) { @@ -1977,7 +1386,6 @@ static Word32 maxWithSign_fx( result = L_min( a, -SVD_MINIMUM_VALUE_FX ); } return result; -#endif } /*------------------------------------------------------------------------- diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c187c351c..aa5a379e8 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -644,21 +644,13 @@ void stereo_tcx_core_dec_fx( test(); test(); test(); -#ifdef NONBE_FIX_1402_WAVEADJUST IF( ( bfi || st->prev_bfi ) && st->hPlcInfo->Pitch_fx && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) ) -#else - IF( ( bfi || st->prev_bfi ) && st->hPlcInfo->Pitch && EQ_16( st->hPlcInfo->concealment_method, TCX_NONTONAL ) ) -#endif { lerp( synthFB_fx, synth_fx, st->L_frame, hTcxDec->L_frameTCX ); if ( !bfi && st->prev_bfi ) { -#ifdef NONBE_FIX_1402_WAVEADJUST st->hPlcInfo->Pitch_fx = 0; -#else - st->hPlcInfo->Pitch = 0; -#endif move16(); } } @@ -816,21 +808,11 @@ void stereo_tcx_core_dec_fx( move16(); /* Postfiltering */ -#ifndef MSAN_FIX - IF( st->p_bpf_noise_buf_32 ) - { - Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, negate( Q11 ) ); - } -#endif post_decoder( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); test(); -#ifdef MSAN_FIX IF( st->p_bpf_noise_buf_32 && st->tcxonly == 0 ) -#else - IF( st->p_bpf_noise_buf_32 ) -#endif // MSAN_FIX { Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); /* q_p_bpf + Q11 */ } diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c index 98c1a6a79..3191a8b4a 100644 --- a/lib_dec/ivas_td_low_rate_dec_fx.c +++ b/lib_dec/ivas_td_low_rate_dec_fx.c @@ -137,7 +137,6 @@ void tdm_low_rate_dec_fx( edct_16fx( exc_wo_nf_fx, exc_wo_nf_fx, L_FRAME, find_guarded_bits_fx( L_FRAME ), IVAS_CPE_TD ); -#ifdef FIX_USAN_ISSUES IF( bwe_exc != NULL ) { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, @@ -148,10 +147,6 @@ void tdm_low_rate_dec_fx( Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], NULL, st->hGSCDec->last_exc_dct_in_fx, L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); } -#else - Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, - L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); -#endif /*----------------------------------------------------------------------* * Remove potential pre-echo in case an onset has been detected *----------------------------------------------------------------------*/ diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index fc793dff0..e2528e619 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -270,9 +270,7 @@ UWord8 apa_reconfigure( free( ps->buf_out_fx ); ps->buf_out_fx = (Word16 *) malloc( sizeof( Word16 ) * ps->buf_out_capacity ); -#ifdef MSAN_FIX memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) ); -#endif ps->Q_buf_out = Q15; move16(); IF( !ps->buf_out_fx ) diff --git a/lib_dec/lead_deindexing_fx.c b/lib_dec/lead_deindexing_fx.c index 786e0c276..ecc5f6fe0 100644 --- a/lib_dec/lead_deindexing_fx.c +++ b/lib_dec/lead_deindexing_fx.c @@ -192,7 +192,6 @@ void re8_decode_base_index_fx( m1 = sub( k1, 1 ); m2 = 8; move16(); -#ifdef CR_2109_to_2112_cd0_ce0 l = 1; move16(); FOR( i = 0; i < 8; i++ ) @@ -206,9 +205,6 @@ void re8_decode_base_index_fx( test(); /* if the signs are constrained and all components are non-zero */ IF( EQ_16( k1, 7 ) && ( l > 0 ) ) -#else - IF( k1 == 7 ) -#endif { m2 = 7; move16(); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 413585447..77deb9e7d 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -44,9 +44,6 @@ #include "jbm_pcmdsp_fifo.h" #include #include -#ifndef FIX_DISCLAIMER -#include -#endif #include "wmc_auto.h" #define INV_1000_Q31 2147484 /*1/1000 IN Q31*/ @@ -3061,85 +3058,6 @@ const char *IVAS_DEC_GetErrorMessage( return ivas_error_to_string( error ); } -#ifndef FIX_DISCLAIMER -/*---------------------------------------------------------------------* - * get_channel_config() - * - * Gets a str related to input config - *---------------------------------------------------------------------*/ - -static ivas_error get_channel_config( - AUDIO_CONFIG config, - Word8 *str ) -{ - IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MONO ) ) - { - strcpy( (char *) str, "Mono" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - strcpy( (char *) str, "Stereo" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1 ) ) - { - strcpy( (char *) str, "Multichannel 5.1 (CICP6)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1 ) ) - { - strcpy( (char *) str, "Multichannel 7.1 (CICP12)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_2 ) ) - { - strcpy( (char *) str, "Multichannel 5.1+2 (CICP14)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_4 ) ) - { - strcpy( (char *) str, "Multichannel 5.1+4 (CICP16)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1_4 ) ) - { - strcpy( (char *) str, "Multichannel 7.1+4 (CICP19)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - strcpy( (char *) str, "Multichannel (custom loudspeaker layout)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_FOA ) ) - { - strcpy( (char *) str, "Ambisonics: First Order (FOA)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA2 ) ) - { - strcpy( (char *) str, "Ambisonics: Second Order (HOA2)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA3 ) ) - { - strcpy( (char *) str, "Ambisonics: Third Order (HOA3)" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL ) ) - { - strcpy( (char *) str, "Binaural: no room" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) - { - strcpy( (char *) str, "Binaural: room with impulse responses" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - strcpy( (char *) str, "Binaural: room with reverb" ); - } - ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { - strcpy( (char *) str, "External renderer" ); - } - ELSE - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" ); - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * printConfigInfo_dec( ) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 712ead8f4..fcd5142a4 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -161,13 +161,7 @@ typedef struct { Word16 L_frameTCX; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 Pitch; -#endif Word16 Pitch_fx; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 T_bfi; -#endif Word8 T_bfi_fx; Word16 Transient[MAX_POST_LEN]; @@ -187,9 +181,6 @@ typedef struct Word16 step_concealgain_fx; Word16 concealment_method; -#ifndef NONBE_FIX_1402_WAVEADJUST - Word16 subframe; -#endif Word16 subframe_fx; Word16 nbLostCmpt; Word16 seed; diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 492c927b6..1b51a29fb 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -6070,12 +6070,6 @@ void ivas_swb_tbe_dec_fx( tmp = i_mult( j, ( LPC_SHB_ORDER + 1 ) ); /* convert LSPs to LP coefficients */ E_LPC_f_lsp_a_conversion( lsp_temp_fx, lpc_shb_sf_fx + tmp, LPC_SHB_ORDER ); -#ifndef FIX_1100_REMOVE_LPC_RESCALING - /* Bring the LPCs to Q12 */ - Copy_Scale_sig( lpc_shb_sf_fx + tmp, lpc_shb_sf_fx + tmp, LPC_SHB_ORDER + 1, sub( norm_s( lpc_shb_sf_fx[tmp] ), 2 ) ); - lpc_shb_sf_fx[i_mult( j, ( LPC_SHB_ORDER + 1 ) )] = ONE_IN_Q12; // recheck this - move16(); -#endif } } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 650e8572b..e74df3a96 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -146,28 +146,20 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->tcx_cfg = hTcxCfg; hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); -#endif move16(); hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); -#endif move16(); hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; move16(); hTonalMDCTConc->secondLastPowerSpectrum_exp = hTonalMDCTConc->secondLastBlockData.spectralData_exp; move16(); hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS ); -#endif move16(); hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS ); -#endif move16(); hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; move16(); @@ -234,9 +226,7 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( move16(); /* just the second half of the second last pcm output is needed */ -#ifdef MSAN_FIX set16_fx( hTonalMDCTConc->timeDataBuffer, 0, ( 3 * L_FRAME_MAX ) / 2 ); -#endif hTonalMDCTConc->secondLastPcmOut = &hTonalMDCTConc->timeDataBuffer[( 3 * L_FRAME_MAX ) / 2 - ( 3 * min( L_FRAME_MAX, nSamples ) / 2 )]; hTonalMDCTConc->lastPcmOut = &hTonalMDCTConc->timeDataBuffer[( 3 * L_FRAME_MAX ) / 2 - min( L_FRAME_MAX, nSamples )]; /* If the second last frame was lost, we reuse saved TonalComponentsInfo and don't update pcm buffers */ @@ -1226,9 +1216,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word16 element_mode ) { Word32 secondLastMDST[L_FRAME_MAX]; -#ifdef MSAN_FIX set32_fx( secondLastMDST, 0, L_FRAME_MAX ); -#endif Word32 secondLastMDCT[L_FRAME_MAX]; Word16 secondLastMDCT_exp; Word32 *powerSpectrum = secondLastMDST; @@ -1236,9 +1224,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word16 nSamples; // Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; -#ifdef MSAN_FIX set32_fx( sns_int_scf_fx, 0, FDNS_NPTS ); -#endif nSamples = hTonalMDCTConc->nSamples; move16(); @@ -1302,11 +1288,7 @@ void TonalMDCTConceal_Detect_ivas_fx( { /* If the second last frame was also lost, it is expected that pastTimeSignal could hold a bit different signal (e.g. including fade-out) from the one stored in TonalMDCTConceal_SaveTimeSignal. */ /* That is why we reuse the already stored information about the concealed spectrum in the second last frame */ -#ifdef MSAN_FIX Word16 temp_power_spectrum_q = 0; -#else - Word16 power_spectrum_q; -#endif nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 ); @@ -3511,9 +3493,7 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx( psychParams = st->hTonalMDCTConc->psychParams; hFdCngCom = st->hFdCngDec->hFdCngCom; -#ifdef MSAN_FIX set32_fx( whitenend_noise_shape, 0, L_FRAME16k ); -#endif IF( EQ_32( whitening_mode, ON_FIRST_LOST_FRAME ) ) { diff --git a/lib_dec/transition_dec_fx.c b/lib_dec/transition_dec_fx.c index b82378198..b9ad17fcf 100644 --- a/lib_dec/transition_dec_fx.c +++ b/lib_dec/transition_dec_fx.c @@ -56,9 +56,7 @@ void transition_dec_fx( Word16 i, offset, temp, tmp; Word16 limit_flag; Word16 i_subfridx; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( Opt_AMR_WB ); -#endif i_subfridx = i_subfr / L_SUBFR; /*i_subfr / L_SUBFR*/ /* Set limit_flag to 0 for restrained limits, and 1 for extended limits */ @@ -830,9 +828,7 @@ Word16 tc_classif_fx( /*o: Q0*/ ) { Word16 tc_subfr, indice; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( L_frame ); -#endif IF( EQ_16( st_fx->L_frame, L_FRAME ) ) { IF( get_next_indice_fx( st_fx, 1 ) ) diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c index f993caa8d..75a514cc2 100644 --- a/lib_dec/waveadjust_fec_dec_fx.c +++ b/lib_dec/waveadjust_fec_dec_fx.c @@ -848,16 +848,8 @@ void concealment_init_ivas_fx( hPlcInfo->L_frameTCX = L_frameTCX; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->Pitch = 0; - move16(); -#endif hPlcInfo->Pitch_fx = 0; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->T_bfi = 0; - move16(); -#endif hPlcInfo->T_bfi_fx = 0; move16(); hPlcInfo->outx_new_n1_fx = 0; @@ -876,10 +868,6 @@ void concealment_init_ivas_fx( move16(); hPlcInfo->concealment_method = TCX_NONTONAL; move16(); -#ifndef NONBE_FIX_1402_WAVEADJUST - hPlcInfo->subframe = 0; - move16(); -#endif hPlcInfo->subframe_fx = 0; move16(); hPlcInfo->nbLostCmpt = (Word16) L_deposit_l( 0 ); @@ -1326,11 +1314,7 @@ static Word16 waveform_adj_fix( test(); test(); test(); -#ifdef NONBE_FIX_1402_WAVEADJUST IF( hPlcInfo->T_bfi_fx && ( LE_16( pitch, Framesizediv2 ) ) && ( GT_16( Framesize, 256 ) ) && ( EQ_16( core, 1 ) ) ) -#else - IF( hPlcInfo->T_bfi && ( LE_16( pitch, Framesizediv2 ) ) && ( GT_16( Framesize, 256 ) ) && ( EQ_16( core, 1 ) ) ) -#endif { Word16 i1 = 0, i2 = 0; Word16 pos1, pos2, pos3; diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index d2d5ac4e6..a93690738 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -395,11 +395,7 @@ ivas_error acelp_core_enc_fx( IF( !nelp_mode && !ppp_mode ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, -#else - st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, -#endif tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); } @@ -465,11 +461,7 @@ ivas_error acelp_core_enc_fx( tc_classif_enc_fx( Q_new, st_fx->L_frame, &tc_subfr_fx, &position, attack_flag, st_fx->pitch[0], res_fx ); config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -#ifdef NONBE_FIX_GSC_BSTR -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, -#else - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, -#endif tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); } @@ -522,11 +514,7 @@ ivas_error acelp_core_enc_fx( /* Configure ACELP bit allocation */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -#ifdef NONBE_FIX_GSC_BSTR -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, -#else - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, -#endif st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); /* redo LSF quantization */ @@ -772,21 +760,17 @@ ivas_error acelp_core_enc_ivas_fx( Word32 Bin_E_fx[L_FFT], Bin_E_old_fx[L_FFT / 2]; Word16 clip_var_fx, mem_w0_bck_fx, streaklimit_fx; -#ifdef MSAN_FIX set16_fx( old_bwe_exc_fx, 0, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ); set16_fx( old_exc_fx, 0, L_EXC ); set16_fx( Aq, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( syn_fx, 0, L_FRAME16k ); -#endif Word16 tilt_code_bck_fx; Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; Word32 q_env_fx[NUM_ENV_CNG]; -#ifdef MSAN_FIX set32_fx( q_env_fx, 0, NUM_ENV_CNG ); set16_fx( exc2_fx, 0, L_FRAME16k ); -#endif Word16 exc3_fx[L_FRAME16k]; Word16 syn1_fx[L_FRAME16k]; Word16 *tdm_Pri_pitch_buf_fx; @@ -1189,11 +1173,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); IF( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* @@ -1330,11 +1310,7 @@ ivas_error acelp_core_enc_ivas_fx( { tc_classif_enc_fx( Q_new, st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res_fx ); -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -1393,11 +1369,7 @@ ivas_error acelp_core_enc_ivas_fx( lsf_syn_mem_restore_ivas_fx( st, tilt_code_bck_fx, gc_threshold_bck_fx, clip_var_bck_fx, next_force_sf_bck, lsp_new, lsp_mid, clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen ); /* Configure ACELP bit allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_IVAS( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new ); @@ -1459,11 +1431,7 @@ ivas_error acelp_core_enc_ivas_fx( IF( st->element_mode > EVS_MONO && st->hTcxEnc != NULL ) { Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn -#ifdef MSAN_FIX Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 1 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); // st->Q_syn -#else - Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 2 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); -#endif st->hTcxEnc->q_Txnq = st->Q_syn; move16(); } @@ -1488,11 +1456,7 @@ ivas_error acelp_core_enc_ivas_fx( *-----------------------------------------------------------------*/ Scale_sig( syn_fx, L_FRAME, sub( s_min( st->Q_syn, Q_new ), st->Q_syn ) ); // min( st->Q_syn, Q_new ) -#ifdef MSAN_FIX Scale_sig( res_fx, st->L_frame, sub( s_min( st->Q_syn, Q_new ), Q_new ) ); // min( st->Q_syn, Q_new ) -#else - Scale_sig( res_fx, L_FRAME16k, sub( s_min( st->Q_syn, Q_new ), Q_new ) ); -#endif FEC_encode_ivas_fx( hBstr, st->acelp_cfg, syn_fx, st->coder_type, st->clas, pitch_buf, res_fx, &st->Last_pulse_pos, st->L_frame, st->total_brate, s_min( st->Q_syn, Q_new ) ); IF( st->hBWE_TD != NULL ) { @@ -1557,11 +1521,7 @@ ivas_error acelp_core_enc_ivas_fx( IF( !st->Opt_SC_VBR && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { /* Apply a non linearity to the SHB excitation */ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#else - Copy_Scale_sig_16_32_DEPREC( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc -#endif non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, Q_new, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( Q_new, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index d88e1523e..f9058b9b9 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -149,11 +149,7 @@ void acelp_core_switch_enc_fx( *----------------------------------------------------------------*/ config_acelp1( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, -#ifdef NONBE_FIX_GSC_BSTR GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - GENERIC, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); @@ -264,11 +260,7 @@ void acelp_core_switch_enc_ivas_fx( *----------------------------------------------------------------*/ config_acelp1_IVAS( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, -#ifdef NONBE_FIX_GSC_BSTR GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - GENERIC, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index a1d672fe0..a241101ba 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -269,11 +269,7 @@ Word16 bass_pf_enc_fx( st = sub( s2, s2_old ); FOR( i = 0; i < tmp16; i++ ) { -#ifdef FIX_ISSUE_1187 noise_buf[i] = shl_sat( mem_bpf->noise_buf[i], st ); -#else - noise_buf[i] = shl( mem_bpf->noise_buf[i], st ); -#endif move16(); } Copy( noise_buf + l_subfr, mem_bpf->noise_buf, tmp16 ); diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 6c99a4306..e2b29ba59 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2011,14 +2011,12 @@ void CNG_enc_ivas_fx( /* convert log2 of residual signal energy */ /*enr = (float)log10( enr + 0.1f ) / (float)log10( 2.0f ); */ -#ifdef FIX_ISSUE_1245 IF( L_ener == 0 ) { enr = -850; /*log(0.1) base 2 in Q8*/ move16(); } ELSE -#endif { hi = norm_l( L_ener ); lo = Log2_norm_lc( L_shl( L_ener, hi ) ); diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c index e701b8e46..d3725dcba 100644 --- a/lib_enc/cod_ace_fx.c +++ b/lib_enc/cod_ace_fx.c @@ -37,14 +37,8 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * Word16 *bwe_exc /* o : excitation for SWB TBE Qx */ ) { -#ifndef SIMPLIFY_CODE_BE - Word16 i, j, i_subfr, j_subfr; - Word16 tmp, tmp2, Es_pred; - Word32 gain_code_vect[2]; -#else Word16 i, i_subfr, j_subfr; Word16 tmp, Es_pred; -#endif Word16 T0, T0_min, T0_min_frac, T0_max, T0_max_frac, T0_res; Word16 T0_frac; Word16 gain_pit, voice_fac; @@ -103,11 +97,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * /* Configure ACELP */ -#ifndef MSAN_FIX - hLPDmem->nbits = BITS_ALLOC_config_acelp( target_bits, st->coder_type, acelp_cfg, st->narrowBand, st->nb_subfr ); -#else BITS_ALLOC_config_acelp( target_bits, st->coder_type, acelp_cfg, st->narrowBand, st->nb_subfr ); -#endif /* Init Framing parameters */ move16(); @@ -324,12 +314,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); -#ifndef SIMPLIFY_CODE_BE - gain_code_vect[0] = gain_code; - move32(); - gain_code_vect[1] = gain_code; - move32(); -#endif /*----------------------------------------------------------* * - voice factor (for pitch enhancement) * *----------------------------------------------------------*/ @@ -361,32 +345,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * /*-------------------------------------------------------* * - Find the total excitation. * *-------------------------------------------------------*/ -#ifndef SIMPLIFY_CODE_BE - tmp2 = shr( L_SUBFR, 1 ); - FOR( j = 0; j < 2; j++ ) - { - FOR( i = sub( tmp2, shr( L_SUBFR, 1 ) ); i < tmp2; i++ ) - { - /* code in Q9, gain_pit in Q14; exc Q_new */ - Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); - Ltmp = L_shl( Ltmp, Q_new_p5 ); - Ltmp = L_mac( Ltmp, gain_pit, exc[i + i_subfr] ); - BASOP_SATURATE_WARNING_OFF_EVS - exc2[i] = round_fx( L_shl( Ltmp, 1 ) ); - BASOP_SATURATE_WARNING_ON_EVS - - Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code[i] ); - Ltmp2 = L_shl( Ltmp2, Q_new_p5 ); - Ltmp = L_add( Ltmp, Ltmp2 ); - BASOP_SATURATE_WARNING_OFF_EVS - Ltmp = L_shl( Ltmp, 1 ); /* saturation can occur here */ - BASOP_SATURATE_WARNING_ON_EVS - exc[i + i_subfr] = round_fx( Ltmp ); - } - tmp2 = L_SUBFR; - move16(); - } -#else FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14; exc Q_new */ @@ -402,7 +360,6 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision * exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); move16(); } -#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index e6fc25e36..54f57b287 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -14,11 +14,9 @@ #include "stl.h" // #include "basop_mpy.h" #include "prot_fx_enc.h" -#ifdef IVAS_FLOAT_FIXED_CONVERSIONS #include #include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -1717,9 +1715,7 @@ void EstimateStereoTCXNoiseLevel_fx( Word16 *fac_ns_q; Word32 total_brate; -#ifdef MSAN_FIX set32_fx( combined_q_spectrum, 0, N_MAX ); -#endif FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -4365,9 +4361,6 @@ void coder_tcx_fx( Word16 winMDST[N_MAX + L_MDCT_OVLP_MAX]; Word16 *pWinMDST; Word16 left_overlap_mode, right_overlap_mode; -#ifndef MSAN_FIX - LPD_state_HANDLE hLPDmem = st->hLPDmem; -#endif TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; left_overlap = right_overlap = -1; @@ -4533,10 +4526,6 @@ void coder_tcx_fx( st, hm_cfg ); -#ifndef MSAN_FIX - hLPDmem->nbits = add( hLPDmem->nbits, add( tnsBits, ltpBits ) ); - move16(); -#endif } diff --git a/lib_enc/cod_uv_fx.c b/lib_enc/cod_uv_fx.c index 8eccddc0b..8b1e8a144 100644 --- a/lib_enc/cod_uv_fx.c +++ b/lib_enc/cod_uv_fx.c @@ -135,7 +135,6 @@ void gauss_L2_ivas_fx( *gain = L_deposit_l( 0 ); move32(); /*Update correlations for gains coding */ -#ifdef FIX_ISSUE_1167 tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 ); /* Q16 */ tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 16 ); /* Q16 */ FOR( i = 0; i < L_SUBFR; i++ ) @@ -144,34 +143,17 @@ void gauss_L2_ivas_fx( tmp32 = L_mac0( tmp32, tmp16, tmp16 ); /* Q16 */ tmp32_2 = L_mac0( tmp32_2, tmp16, shr( y2[i], 1 ) ); /* Q16 */ } -#else - tmp32 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ - tmp32_2 = L_shr( 21474836l /*0.01f Q31*/, 31 - 18 ); /* Q18 */ - FOR( i = 0; i < L_SUBFR; i++ ) - { - tmp32 = L_mac0( tmp32, y11[i], y11[i] ); /* Q18 */ - tmp32_2 = L_mac0( tmp32_2, y11[i], y2[i] ); /* Q18 */ - } -#endif tmp16 = norm_l( tmp32 ); // To be checked g_corr->y1y1 = round_fx_sat( L_shl( tmp32, tmp16 ) ); -#ifdef FIX_ISSUE_1167 g_corr->y1y1_e = sub( 31 - 16, tmp16 ); -#else - g_corr->y1y1_e = sub( 31 - 18, tmp16 ); -#endif move16(); move16(); tmp16 = norm_l( tmp32_2 ); g_corr->y1y2 = round_fx_sat( L_shl( tmp32_2, tmp16 ) ); -#ifdef FIX_ISSUE_1167 g_corr->y1y2_e = sub( 31 - 16, tmp16 ); -#else - g_corr->y1y2_e = sub( 31 - 18, tmp16 ); -#endif move16(); move16(); } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index bfe17fcd2..405b3ac2b 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -299,11 +299,9 @@ static void init_tcx_fx( Word16 i; Word16 fscaleFB; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) MCT_flag; (void) total_brate; (void) last_total_brate; -#endif // PMT("init_tcx_fx needs an entire review to adapt to IVAS") fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 ); @@ -945,9 +943,7 @@ static void init_modes_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ -#ifdef FIX_920_IGF_INIT_ERROR const Word32 igf_brate, /* i : IGF configuration bitrate */ -#endif const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { @@ -1080,11 +1076,7 @@ void init_coder_ace_plus_ivas_fx( test(); IF( st->igf && st->hIGFEnc != NULL ) { -#ifdef FIX_920_IGF_INIT_ERROR IGFEncSetMode_ivas_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); -#else - IGFEncSetMode_ivas_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); -#endif } ELSE IF( st->hIGFEnc != NULL ) { diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 04857c334..18f48e904 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -80,10 +80,8 @@ void core_encode_openloop_fx( Word16 w_rf[M + 1], lsf_uq_rf[M + 1]; Word16 lsf_q_1st_rf[M + 1], lsf_q_d_rf[M + 1], lsf_q_rf[M + 1]; Word16 lsp_old_q_rf[M + 1], lsf_old_q_rf[M + 1]; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) vad_hover_flag; (void) vad_flag_dtx; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); diff --git a/lib_enc/core_enc_reconf_fx.c b/lib_enc/core_enc_reconf_fx.c index 1ba496b0e..9e7380aaa 100644 --- a/lib_enc/core_enc_reconf_fx.c +++ b/lib_enc/core_enc_reconf_fx.c @@ -24,9 +24,7 @@ void core_coder_reconfig_fx( { Word16 i, bwidth, index; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) last_total_brate; -#endif /*Configuration of ACELP*/ BITS_ALLOC_init_config_acelp( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) ); diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index f3b4aea6b..2f21f1015 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -408,11 +408,7 @@ void core_coder_mode_switch_ivas_fx( Scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift ); st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); -#else - init_coder_ace_plus_ivas_fx( st, last_total_brate, MCT_flag ); -#endif if ( st->hLPDmem != NULL ) { st->hLPDmem->q_lpd_old_exc = st->prev_Q_new; diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index dc3062298..5290509cd 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -997,10 +997,8 @@ void core_switching_pre_enc_ivas_fx( tmp = sub( L_LOOK_16k + L_SUBFR16k, Sample_Delay_HP ); Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); -#ifdef FIX_ISSUE_1230 hBWE_FD->Q_new_input_hp = 0; move16(); -#endif IF( NE_16( st_fx->last_extl, WB_BWE ) ) { diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index 3624cf374..c95bc9d5b 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -386,7 +386,6 @@ void decision_matrix_enc_fx( move16(); } -#ifdef NONBE_FIX_GSC_BSTR /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ @@ -400,7 +399,6 @@ void decision_matrix_enc_fx( move16(); } -#endif return; } diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 154b43c12..44be8dcc6 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -29,9 +29,6 @@ #define CNG_TYPE_HO 20 /* hangover for switching between CNG types */ -#ifndef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD -#define DTX_THR 5 /* LP_NOISE level */ -#endif #define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ #define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ @@ -64,9 +61,7 @@ static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, /*==================================================================================*/ void dtx_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ const Word16 vad, /* i : vad flag for DTX Q0*/ const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ @@ -83,21 +78,15 @@ void dtx_ivas_fx( Flag Overflow = 0; move32(); #endif -#ifdef NONBE_1211_DTX_BR_SWITCHING Word32 total_brate_ref; total_brate_ref = st_fx->total_brate; move32(); -#endif IF( st_fx->dtx_sce_sba != 0 ) { last_br_cng_flag = 1; last_br_flag = 1; -#ifndef NONBE_1211_DTX_BR_SWITCHING - br_dtx_flag = 1; - move16(); -#endif move16(); move16(); } @@ -112,15 +101,9 @@ void dtx_ivas_fx( test(); test(); -#ifdef NONBE_1211_DTX_BR_SWITCHING last_br_flag = ( st_fx->element_mode == EVS_MONO && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) ) || ( st_fx->element_mode != EVS_MONO && LE_32( last_ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ); -#else - last_br_flag = LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_IVAS ) ); - br_dtx_flag = 0; - move16(); -#endif } /* Initialization */ @@ -217,10 +200,8 @@ void dtx_ivas_fx( * Select SID or FRAME_NO_DATA frame if DTX is enabled *------------------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING br_dtx_flag = 1; move16(); -#endif IF( st_fx->dtx_sce_sba == 0 ) { @@ -230,11 +211,7 @@ void dtx_ivas_fx( test(); br_dtx_flag = ( ( st_fx->element_mode == EVS_MONO ) && LE_32( st_fx->total_brate, MAX_BRATE_DTX_EVS ) ) || ( ( st_fx->element_mode != EVS_MONO ) && LE_32( ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ); -#else - LT_16( st_fx->lp_noise_fx, 3840 /*15 in Q8*/ ); -#endif } test(); test(); @@ -352,13 +329,11 @@ void dtx_ivas_fx( reset_indices_enc_fx( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); } } -#ifdef NONBE_1211_DTX_BR_SWITCHING ELSE IF( st_fx->element_mode != EVS_MONO ) { st_fx->total_brate = total_brate_ref; move32(); } -#endif /*------------------------------------------------------------------------* * Reset counters when in active frame (not in SID or FRAME_NO_DATA frame) diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index a509a7cd7..4317bdbb3 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -1387,7 +1387,6 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const return; } -#ifdef FIX_ISSUE_1165 void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ) { Word16 sign[L_SUBFR], vec[L_SUBFR]; @@ -1712,7 +1711,6 @@ void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, } return; } -#endif /* * E_ACELP_4t_fx @@ -1869,11 +1867,7 @@ void E_ACELP_4t_ivas_fx( } ELSE { -#ifdef FIX_ISSUE_1165 E_ACELP_4tsearch_ivas_fx( dn, cn, H, code, &config, ind, y ); -#else - E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y ); -#endif } E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index ); return; diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index f18da2ef2..9612696ed 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -781,11 +781,7 @@ void E_ACELP_4tsearchx_ivas_fx( alp = shr( alp, 1 ); Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/ Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ -#ifndef MSAN_FIX - Scale_sig( dn, 2 * L_SUBFR, -1 ); -#else Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ -#endif } diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 06c49a8d3..62f740fb2 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -656,11 +656,7 @@ void encod_gen_voic_ivas_fx( *-----------------------------------------------------------------*/ test(); -#ifdef NONBE_FIX_GSC_BSTR IF( !st_fx->inactive_coder_type_flag && EQ_16( st_fx->coder_type, INACTIVE ) ) -#else - IF( GE_32( st_fx->total_brate, MAX_GSC_INACTIVE_BRATE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) -#endif { transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 7e5734e70..7af329a1c 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -578,9 +578,6 @@ void enc_pit_exc_ivas_fx( Word16 use_fcb; Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes*/ -#ifndef FIX_ISSUE_1376 - Word16 h1_q15[PIT_EXC_L_SUBFR + ( M + 1 )]; -#endif Word16 q_h1; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc; @@ -602,9 +599,7 @@ void enc_pit_exc_ivas_fx( move16(); Pitch_CT = GENERIC; move16(); -#ifdef MSAN_FIX set16_fx( cn1, 0, PIT_EXC_L_SUBFR ); -#endif test(); test(); IF( st_fx->GSC_IVAS_mode > 0 && ( st_fx->GSC_noisy_speech || GT_32( st_fx->core_brate, GSC_H_RATE_STG ) ) ) @@ -773,15 +768,8 @@ void enc_pit_exc_ivas_fx( * Codebook target computation * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ -#ifndef FIX_ISSUE_1376 - Copy_Scale_sig( h1, h1_q15, L_subfr, 1 ); // Q14 -> Q15 - - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1_q15, - xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#else lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 5b9f67503..4cda393d5 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -478,9 +478,7 @@ Word16 encod_tran_ivas_fx( L_frame_fx = st_fx->L_frame; move16(); -#ifdef MSAN_FIX set16_fx( h1, 0, L_SUBFR + ( M + 1 ) ); -#endif /*------------------------------------------------------------------* * Initializations diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index b0c67abf5..8a77b9e2b 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -453,14 +453,10 @@ void encod_unvoiced_ivas_fx( voice_factors_fx[i_subfr / L_SUBFR] = 0; move16(); -#ifdef FIX_ISSUE_1148 if ( st_fx->hBWE_TD != NULL ) { interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); } -#else - interp_code_5over2_fx( &exc_fx[i_subfr], &bwe_exc_fx[i_subfr * HIBND_ACB_L_FAC], L_SUBFR ); -#endif /*-----------------------------------------------------------------* * Synthesize speech to update mem_syn[]. diff --git a/lib_enc/energy_fx.c b/lib_enc/energy_fx.c index 7dc96a4e3..0168e52b1 100644 --- a/lib_enc/energy_fx.c +++ b/lib_enc/energy_fx.c @@ -451,11 +451,7 @@ void background_update_fx( tmp = L_shr( 2147 /* 0.000001 Q31 */, sub( 31, scale_sb_energy ) ); /* scale_sb_energy */ FOR( i = 0; i < SNR_sb_num; i++ ) { -#ifdef FIX_ISSUE_1209 sb_bg_energy[i] = L_add_sat( MUL_F( sb_bg_energy[i], 32112 /* 0.98 Q15 */ ), tmp ); /* scale_sb_energy */ -#else - sb_bg_energy[i] = L_add( MUL_F( sb_bg_energy[i], 32112 /* 0.98 Q15 */ ), tmp ); /* scale_sb_energy */ -#endif move32(); } } diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index f546c3ef8..087d892e3 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -967,10 +967,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( Q_win_temp[frameno] = *q_win; move16(); -#ifdef MSAN_FIX Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len[frameno], *q_win ); // q_win -#endif IF( EQ_16( frameno, 1 ) ) { Scale_sig32( windowed_samples + 2, win_len[0], sub( *q_win, Q_win_temp[0] ) ); // q_win @@ -1384,27 +1382,11 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( st->igf ) { Word16 q_spectrum = sub( Q31, hTcxEnc->spectrum_e[frameno] ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); -#else ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); -#endif } } } -#ifndef MSAN_FIX - IF( windowed_samples != NULL ) - { - FOR( frameno = 0; frameno < nSubframes; frameno++ ) - { - IF( !( ( EQ_16( transform_type[frameno], TCX_20 ) ) && ( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) ) ) - { - Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len, *q_win ); - } - } - } -#endif IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index ea71b09bc..ed8ff425e 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -93,11 +93,7 @@ void find_tilt_fx( } tmp = BASOP_Util_Divide3232_Scale( lp_bckr, hp_bckr, &e_tmp ); -#ifdef FIX_ISSUE_1152 Ltmp = L_shr_r_sat( L_deposit_h( tmp ), sub( 15, e_tmp ) ); -#else - Ltmp = L_shr_r( L_deposit_h( tmp ), sub( 15, e_tmp ) ); -#endif *bckr_tilt_lt = L_add( Mpy_32_16_r( *bckr_tilt_lt, 29491 ), Mpy_32_16_r( Ltmp, 3277 ) ); /* Q16 */ diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index f943b104d..edddc6a88 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -979,13 +979,8 @@ void gauss2v_ivas_fx( /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */ /* Use ScalingShift to stay aligned with ener[] */ eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */ -#ifndef FIX_1298 - eneri = L_add( ener[i], eneri ); - eneri = L_add( ener[j], eneri ); /* Q31 */ -#else eneri = L_add_sat( ener[i], eneri ); eneri = L_add_sat( ener[j], eneri ); /* Q31 */ -#endif lo1 = L_Extract_lc( cor32, &hi1 ); cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 944cb2649..2b53082f7 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -83,7 +83,6 @@ static Word16 hf_spectrum_sparseness_fx( crest_mod_fx = 0; move32(); maximum_l( A_fx, L_SPEC_HB, &Amax_fx ); -#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO IF( Amax_fx == 0 ) { /* For all-zero input the crest is 1.0 */ @@ -94,7 +93,6 @@ static Word16 hf_spectrum_sparseness_fx( } ELSE { -#endif thr_fx = Mpy_32_32( Amax_fx, PEAK_THRESHOLD_FX ); /* Q12 */ movmean_fx = 0; /* avoid uninitialized warning */ move32(); @@ -160,9 +158,7 @@ static Word16 hf_spectrum_sparseness_fx( move32(); st->hHQ_core->crest_mod_lp_q = sub( Q12, inv_rms32_e ); move16(); -#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO } -#endif *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); /* Q(st->hHQ_core->crest_lp_q) */ move32(); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index f22218d13..6bc466e3d 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -374,7 +374,6 @@ void HQ_core_enc_init_fx( hHQ_core->last_max_pos_pulse = 0; move16(); -#ifdef MSAN_FIX hHQ_core->crest_lp_fx = HQ_CREST_THRESHOLD_FX; /* Q28 */ move32(); hHQ_core->crest_lp_q = Q28; @@ -383,7 +382,6 @@ void HQ_core_enc_init_fx( move32(); hHQ_core->crest_mod_lp_q = Q29; move16(); -#endif return; } @@ -482,11 +480,7 @@ void hq_core_enc_ivas_fx( Q_audio = sub( Q16, q ); TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ -#else - Copy_Scale_sig_16_32_DEPREC( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ -#endif inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index fc7c32fdb..d5f071784 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -716,13 +716,8 @@ static void IGF_CalculateEnvelope_ivas_fx( Word32 mean_y_fx_tmp = 0; move32(); mean_xy_fx = mean_x2_fx = 0; -#ifdef FIX_ISSUE_1214 mean_x_e = 15; mean_xy_e = mean_y_e = mean_x2_e = 31; -#else - mean_x_e = mean_y_e = 15; - mean_xy_e = mean_x2_e = 31; -#endif move16(); move16(); move16(); @@ -738,21 +733,12 @@ static void IGF_CalculateEnvelope_ivas_fx( mean_x_fx = add( mean_x_fx, x ); /*Q0*/ mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/ -#ifdef FIX_ISSUE_1214 /*y = 20.f * log10f( max( 1.f, powerSpectrum[i] ) );*/ IF( LE_64( W_deposit32_l( pPowerSpectrum_fx[sb] ), W_shl( 1, ( sub( 31, e_ps[sb] ) ) ) ) ) { y = 0; move16(); } -#else - - /*y = 20 * (int16_t) log10f( max( 1e-018f, pPowerSpectrum[sb] ) );*/ - IF( LT_32( pPowerSpectrum_fx[sb], 1 ) ) - { - y = imult1616( 20, ( -18 /* log10f(1e-018f) */ ) ); - } -#endif ELSE { y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( e_ps[sb], Q25 ) ) ), INV_Log2_10_Q15 ), Q25 ) ) ); /*Q0*/ @@ -1258,21 +1244,12 @@ static void IGF_CalculateStereoEnvelope_fx( move16(); } } -#ifdef FIX_ISSUE_1214 tmp_tb_fx = shr_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ tmp_sb_fx = shr_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_TB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_TB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/ hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_SB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_SB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/ -#else - tmp_tb_fx = shl_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - tmp_sb_fx = shl_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, tmp_tb_e ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, tmp_tb_e ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/ - hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, tmp_sb_e ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, tmp_sb_e ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */ - hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/ -#endif move16(); move16(); move16(); @@ -2541,9 +2518,7 @@ void IGFEncResetTCX10BitCounter_ivas_fx( void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ -#endif const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ @@ -2563,9 +2538,7 @@ void IGFEncApplyMono_ivas_fx( Word32 common_pPowerSpectrum_fx[N_MAX + L_MDCT_OVLP_MAX]; -#ifdef MSAN_FIX set32_fx( common_pPowerSpectrum_fx, 0, N_MAX + L_MDCT_OVLP_MAX ); -#endif Word16 common_pPowerSpectrum_exp = MIN16B; move16(); @@ -2624,20 +2597,12 @@ void IGFEncApplyMono_ivas_fx( IF( pPowerSpectrumParameter_fx ) { -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < N_MAX + L_MDCT_OVLP_MAX; i++ ) -#else FOR( Word16 i = 0; i < powerSpectrum_len; i++ ) -#endif { common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, pPowerSpectrumParameter_exp[i] ); } -#ifndef MSAN_FIX - FOR( Word16 i = 0; i < N_MAX + L_MDCT_OVLP_MAX; i++ ) -#else FOR( Word16 i = 0; i < powerSpectrum_len; i++ ) -#endif { common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[i], sub( pPowerSpectrumParameter_exp[i], common_pPowerSpectrum_exp ) ); move16(); diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index ebfd9c4a2..1d695659c 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1398,11 +1398,7 @@ ivas_error init_encoder_ivas_fx( st->exp_buf_wspeech_enc = 0; move16(); /* initializations */ -#ifndef MSAN_FIX - set32_fx( st->Bin_E_old_fx, 0, shr( L_FFT, 2 ) ); -#else set32_fx( st->Bin_E_old_fx, 0, L_FFT / 2 ); -#endif st->q_Bin_E_old = Q31; move16(); set16_fx( st->mem_decim_fx, 0, shl( L_FILT_MAX, 1 ) ); @@ -1821,10 +1817,8 @@ ivas_error init_encoder_ivas_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } ELSE { @@ -2069,7 +2063,6 @@ ivas_error init_encoder_ivas_fx( set16_fx( st->totalNoise_increase_hist_fx, 0, TOTALNOISE_HIST_SIZE ); st->totalNoise_increase_len = 0; move16(); -#ifdef IVAS_FLOAT_FIXED_CONVERSIONS TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; IF( hTcxEnc != NULL ) { @@ -2080,10 +2073,8 @@ ivas_error init_encoder_ivas_fx( move32(); st->currEnergyHF_e_fx = 0; move16(); -#ifdef MSAN_FIX st->prevEnergyHF_fx = 0; move32(); -#endif /* Initialize TCX */ @@ -2097,12 +2088,7 @@ ivas_error init_encoder_ivas_fx( st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); /* Initialize ACELP */ -#endif -#ifdef FIX_920_IGF_INIT_ERROR init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); -#else - init_coder_ace_plus_ivas_fx( st, st->last_total_brate, 0 ); -#endif IF( st->hLPDmem != NULL ) { diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 46bec5f4d..e47b14559 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -89,9 +89,7 @@ Word16 inov_encode_fx( Word16 Rw[L_SUBFR]; Word16 acelpautoc; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) last_L_frame; -#endif stack_pulses = 0; move16(); diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index cacbcabd3..1e7a13d45 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -118,14 +118,12 @@ ivas_error ivas_core_enc_fx( set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); -#ifdef MSAN_FIX FOR( i = 0; i < CPE_CHANNELS; i++ ) { set_zero_fx( bwe_exc_extended_fx[i], L_FRAME32k + NL_BUFF_OFFSET ); set16_fx( old_syn_12k8_16k_fx[i], 0, L_FRAME16k ); } set16_fx( shb_speech_fx, 0, L_FRAME16k ); -#endif push_wmops( "ivas_core_enc" ); @@ -215,7 +213,6 @@ ivas_error ivas_core_enc_fx( /*---------------------------------------------------------------------* * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ -#ifdef MSAN_FIX IF( st->cldfbAnaEnc ) { Word16 tmp_shift = L_norm_arr( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels ); @@ -227,16 +224,6 @@ ivas_error ivas_core_enc_fx( move16(); } } -#else - Word16 tmp_shift = getScaleFactor32( enerBuffer_fx[n], CLDFB_NO_CHANNELS_MAX ); - tmp_shift = sub( tmp_shift, 5 ); - IF( tmp_shift < 0 ) - { - scale_sig32( enerBuffer_fx[n], CLDFB_NO_CHANNELS_MAX, tmp_shift ); - enerBuffer_fx_exp[n] = sub( enerBuffer_fx_exp[n], tmp_shift ); - move16(); - } -#endif Scale_sig( fft_buff_fx[n], ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum // fft_buff_fx_exp = add(fft_buff_fx_exp,1); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 45098926e..bf7c36eef 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -131,9 +131,7 @@ ivas_error pre_proc_front_ivas_fx( const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO @@ -212,10 +210,6 @@ ivas_error pre_proc_front_ivas_fx( Word16 new_inp_out_size; Word16 Q_new_inp; Word16 mem_decim_size; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - Word16 Q_new; - Word16 corr_shift_fx; -#endif Word16 dummy_fx; Word16 ncharX_fx; @@ -259,13 +253,8 @@ ivas_error pre_proc_front_ivas_fx( IF( hSCE != NULL ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx, hSCE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx - input_frame, hSCE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( hSCE->hCoreCoder[n]->input_fx, hSCE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( hSCE->hCoreCoder[n]->input_fx - input_frame, hSCE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#endif hSCE->hCoreCoder[n]->q_inp32 = Q11; move16(); Scale_sig( hSCE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ @@ -282,13 +271,8 @@ ivas_error pre_proc_front_ivas_fx( } ELSE { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx, hCPE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx - input_frame, hCPE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->input_fx, hCPE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[n]->input_fx - input_frame, hCPE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ -#endif hCPE->hCoreCoder[n]->q_inp32 = Q11; move16(); Scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ @@ -316,13 +300,11 @@ ivas_error pre_proc_front_ivas_fx( } #endif -#ifdef MSAN_FIX FOR( Word16 k = 0; k < CLDFB_NO_COL_MAX; k++ ) { set32_fx( realBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( imagBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); } -#endif Word16 sf_energySum[CLDFB_NO_CHANNELS_MAX]; Word16 Q_to_be_looked_into = -1; @@ -365,9 +347,6 @@ ivas_error pre_proc_front_ivas_fx( IF( hSCE != NULL ) { st = hSCE->hCoreCoder[n]; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - signal_in = hSCE->hCoreCoder[n]->input; -#endif signal_in_fx = hSCE->hCoreCoder[n]->input_fx; /* hSCE->hCoreCoder[n]->q_inp */ signal32_in_fx = hSCE->hCoreCoder[n]->input32_fx; /* hSCE->hCoreCoder[n]->q_inp32 */ element_mode = IVAS_SCE; @@ -381,9 +360,6 @@ ivas_error pre_proc_front_ivas_fx( ELSE /* CPE */ { st = hCPE->hCoreCoder[n]; -#ifndef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - signal_in = hCPE->hCoreCoder[n]->input; -#endif signal_in_fx = hCPE->hCoreCoder[n]->input_fx; /* hSCE->hCoreCoder[n]->q_inp */ signal32_in_fx = hCPE->hCoreCoder[n]->input32_fx; /* hSCE->hCoreCoder[n]->q_inp32 */ element_mode = hCPE->element_mode; @@ -1092,11 +1068,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx_ivas_fx( st, last_ivas_total_brate, ivas_total_brate, *vad_flag_dtx, inp_12k8_fx, *Q_new ); -#else - dtx_ivas_fx( st, ivas_total_brate, *vad_flag_dtx, inp_12k8_fx, *Q_new ); -#endif test(); test(); @@ -1464,11 +1436,7 @@ ivas_error pre_proc_front_ivas_fx( st->coder_type = find_uv_ivas_fx( st, pitch_fr_fx, voicing_fr_fx, inp_12k8_fx, ee_fx, &dE1X_fx, corr_shift_fx, *relE_fx, Etot_fx, hp_E_fx, &flag_spitch, last_core_orig, hStereoClassif, *Q_new /*q_inp_12k8*/, fr_bands_fx_q ); // Q0 -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->lgBin_E_fx, st->Bin_E_fx, L_FFT / 2, sub( st->q_Bin_E, Q7 ) ); -#else - Copy_Scale_sig_16_32_DEPREC( st->lgBin_E_fx, st->Bin_E_fx, L_FFT / 2, sub( st->q_Bin_E, Q7 ) ); -#endif #ifdef DEBUG_FORCE_DIR if ( st->force_dir[0] != '\0' ) diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 8d00e608c..ca53a227a 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -282,11 +282,7 @@ ivas_error pre_proc_ivas_fx( } ELSE IF( GT_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) && ( ( st->vad_flag == 0 && GE_16( st->bwidth, SWB ) && GE_16( st->max_bwidth, SWB ) ) || ( st->localVAD == 0 && ( LE_16( st->bwidth, WB ) || LE_16( st->max_bwidth, WB ) ) ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR /* inactive frames will be coded by AVQ technology (exceptionally it can be later rewritten to GSC technology in ivas_combined_format_brate_sanity()) */ -#else - /* inactive frames will be coded by AVQ technology */ -#endif st->coder_type = INACTIVE; move16(); } @@ -734,9 +730,7 @@ ivas_error ivas_compute_core_buffers_fx( Word16 *preemp_start_idx = NULL; Word32 sig_out[960], max_32; /*Word16 Q_exp, Q_wsp_exp*/; -#ifdef MSAN_FIX set16_fx( new_inp_resamp16k_fx, 0, L_FRAME16k ); -#endif set16_fx( epsP_h, 0, M + 1 ); set16_fx( epsP_l, 0, M + 1 ); signal_in_fx = st->input_fx; /* st->q_inp */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index ea70a33d3..6108b138c 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -78,9 +78,7 @@ ivas_error ivas_cpe_enc_fx( Word16 Q_new[CPE_CHANNELS] = { 0 }; Word16 fft_buff_fx[CPE_CHANNELS][2 * L_FFT]; /* FFT buffer */ Word16 fft_buff_fx_q[CPE_CHANNELS]; /* FFT buffer */ -#ifdef MSAN_FIX set16_fx( fft_buff_fx_q, 0, CPE_CHANNELS ); -#endif Word16 fft_buff_fx_final_q = MAX_16; move16(); Word32 ener_fx[CPE_CHANNELS]; /* residual energy from Levinson-Durbin Q6 */ @@ -176,7 +174,6 @@ ivas_error ivas_cpe_enc_fx( set16_fx( voicing_fr_fx[0], 0, NB_SUBFR ); set16_fx( voicing_fr_fx[1], 0, NB_SUBFR ); -#ifdef MSAN_FIX FOR( Word16 i = 0; i < CPE_CHANNELS; i++ ) { set16_zero_fx( fft_buff_fx[i], 2 * L_FFT ); @@ -185,7 +182,6 @@ ivas_error ivas_cpe_enc_fx( set16_zero_fx( old_inp_12k8_16fx[i], L_INP_12k8 ); set_zero_fx( old_inp_12k8_fx[i], L_INP_12k8 ); } -#endif /*------------------------------------------------------------------* * CPE initialization - core coder *-----------------------------------------------------------------*/ @@ -288,9 +284,7 @@ ivas_error ivas_cpe_enc_fx( move16(); Word16 front_create_flag = 0; move16(); -#ifdef MSAN_FIX set32_fx( band_energies_LR_fx, 0, 2 * NB_BANDS ); -#endif IF( hCPE->hFrontVad[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) { @@ -375,13 +369,8 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Set TD stereo parameters *----------------------------------------------------------------*/ -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ -#endif Word16 shift = getScaleFactor32( sts[1]->input32_fx, input_frame ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* Q11 + shift */ sts[1]->q_inp32 = add( Q11, shift ); @@ -408,7 +397,6 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ -#ifdef FIX_ISSUE_1247 shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); @@ -426,25 +414,6 @@ ivas_error ivas_cpe_enc_fx( Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); move16(); -#else - shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); - Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[1]->input_fx, input_frame ); - Scale_sig( sts[1]->input_fx, input_frame, shift ); /* sts[1]->q_inp + shift */ - sts[1]->q_inp = add( sts[1]->q_inp, shift ); - move16(); - - shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); - Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[0]->input_fx, input_frame ); - Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ - sts[0]->q_inp = add( sts[0]->q_inp, shift ); - move16(); -#endif Word16 q_inp = s_min( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), s_min( sts[1]->q_inp, sts[1]->q_old_inp ) ); @@ -682,9 +651,6 @@ ivas_error ivas_cpe_enc_fx( // printf("\n%f %f ", hCPE->hStereoClassif->is_speech, hCPE->hCoreCoder[0]->hSpMusClas->past_dlp[0]); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { -#ifndef MSAN_FIX - hCPE->hStereoClassif->xtalk_score_fx = floatToFixed( hCPE->hStereoClassif->xtalk_score, 31 ); -#endif // !MSAN_FIX /*flt2fix: dft_synthesize*/ test(); if ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] ) @@ -866,7 +832,6 @@ ivas_error ivas_cpe_enc_fx( move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); -#ifdef FIX_ISSUE_1135 // Normalise the input buffer from Q15 Word16 input_norm, q_inp32, common_q, fir_delay_len; input_norm = L_norm_arr( sts[0]->input32_fx + out_start_ind, sub( out_end_ind, out_start_ind ) ); @@ -887,9 +852,6 @@ ivas_error ivas_cpe_enc_fx( move16(); sts[0]->q_old_inp = common_q; move16(); -#else - Copy_Scale_sig32_16( sts[0]->input32_fx + out_start_ind, sts[0]->input_fx + out_start_ind, sub( out_end_ind, out_start_ind ), sub( add( Q16, sts[0]->q_inp ), Q15 ) ); // Q15 -#endif /* iDFT & resampling to 12.8kHz internal sampling rate */ stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[0] + L_INP_MEM, &out_12k8_start_ind[0], &out_12k8_end_ind[0], 0, input_Fs, INT_FS_12k8, 0, NULL ); @@ -956,11 +918,7 @@ ivas_error ivas_cpe_enc_fx( &ener_fx[n], &relE_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], &vad_hover_flag[n], &attack_flag[n], realBuffer_fx[n], imagBuffer_fx[n], &q_re_im_buf[n], old_wsp_fx[n], &q_old_wsp, pitch_fr_fx[n], voicing_fr_fx[n], &loc_harm[n], &cor_map_sum_fx[n], &vad_flag_dtx[n], enerBuffer_fx[n], &enerBuffer_fx_exp[n], fft_buff_fx[n], &fft_buff_fx_q[n], A_fx[0], lsp_new_fx[0], currFlatness_fx[n], tdm_ratio_idx, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, q_lf_E[n], localVAD_HE_SAD, -#ifdef NONBE_1211_DTX_BR_SWITCHING band_energies_LR_fx, q_band_energies_LR, 0, front_vad_flag, 0, 0, ivas_format, st_ivas->hMCT != NULL, st_ivas->hEncoderConfig->last_ivas_total_brate, ivas_total_brate, &Q_new[n] -#else - band_energies_LR_fx, q_band_energies_LR, 0, front_vad_flag, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate, &Q_new[n] -#endif #ifdef DEBUG_MODE_INFO , ( st_ivas->nSCE + ( cpe_id * CPE_CHANNELS ) + n ) @@ -1418,9 +1376,7 @@ ivas_error create_cpe_enc_fx( hCPE->input_mem_fx[n] = NULL; } } -#ifdef MSAN_FIX set16_fx( hCPE->q_input_mem, Q15, CPE_CHANNELS ); -#endif /*-----------------------------------------------------------------* * stereo classifier: allocate and initialize diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index db5ee872b..59447c022 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -52,11 +52,9 @@ static void computeIntensityVector_enc_fx( const Word16 enc_param_start_band, /* i : first band to process */ const Word16 num_frequency_bands, Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 q_cldfb, Word16 q_intensity_real[DIRAC_MAX_NBANDS] -#endif ); /*------------------------------------------------------------------------- @@ -761,7 +759,6 @@ void computeReferencePower_enc_fx_dirac( *dirac_mono_flag = ivas_dirac_get_mono_flag_fx( band_grouping, Cldfb_RealBuffer, Cldfb_ImagBuffer, e_Cldfb, nchan_ana, mono_frame_count ); /* Q0 */ move16(); } -#ifdef FIX_1127_IMPROVE_SBA_MLD Word16 gb = 0; move16(); FOR( i = 0; i < num_freq_bands; i++ ) @@ -774,7 +771,6 @@ void computeReferencePower_enc_fx_dirac( } e_reference_W = sub( 31, sub( add( shl( sub( 31, e_Cldfb ), 1 ), 1 ), gb ) ); e_reference_temp = e_reference_W; -#endif move16(); FOR( i = 0; i < num_freq_bands; i++ ) { @@ -791,14 +787,8 @@ void computeReferencePower_enc_fx_dirac( FOR( j = brange[0]; j < brange[1]; j++ ) { -#ifdef FIX_1127_IMPROVE_SBA_MLD reference_power_W[i] = W_add( reference_power_W[i], W_shr( W_mult_32_32( Cldfb_RealBuffer[0][j], Cldfb_RealBuffer[0][j] ), gb ) ); /* exp(2 * e_Cldfb) */ reference_power_W[i] = W_add( reference_power_W[i], W_shr( W_mult_32_32( Cldfb_ImagBuffer[0][j], Cldfb_ImagBuffer[0][j] ), gb ) ); /* exp(2 * e_Cldfb) */ -#else - reference_power_W[i] = W_mac_32_32( reference_power_W[i], Cldfb_RealBuffer[0][j], Cldfb_RealBuffer[0][j] ); - reference_power_W[i] = W_mac_32_32( reference_power_W[i], Cldfb_ImagBuffer[0][j], Cldfb_ImagBuffer[0][j] ); - e_reference_W = imult1616( (Word16) 2, e_Cldfb ); -#endif move64(); move64(); } @@ -810,14 +800,8 @@ void computeReferencePower_enc_fx_dirac( /* abs()^2 */ FOR( j = brange[0]; j < brange[1]; j++ ) { -#ifdef FIX_1127_IMPROVE_SBA_MLD reference_power_temp[i] = W_add( reference_power_temp[i], W_shr( W_mult_32_32( Cldfb_RealBuffer[ch_idx][j], Cldfb_RealBuffer[ch_idx][j] ), gb ) ); /* exp(2 * e_Cldfb) */ reference_power_temp[i] = W_add( reference_power_temp[i], W_shr( W_mult_32_32( Cldfb_ImagBuffer[ch_idx][j], Cldfb_ImagBuffer[ch_idx][j] ), gb ) ); /* exp(2 * e_Cldfb) */ -#else - reference_power_temp[i] = W_mac_32_32( reference_power_temp[i], Cldfb_RealBuffer[ch_idx][j], Cldfb_RealBuffer[ch_idx][j] ); - reference_power_temp[i] = W_mac_32_32( reference_power_temp[i], Cldfb_ImagBuffer[ch_idx][j], Cldfb_ImagBuffer[ch_idx][j] ); - e_reference_temp = imult1616( (Word16) 2, e_Cldfb ); -#endif move64(); move64(); } @@ -974,11 +958,7 @@ void ivas_dirac_param_est_enc_fx( Word32 *p_Cldfb_ImagBuffer_fx[DIRAC_MAX_ANA_CHANS]; Word16 cldfb_q; Word32 intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS]; -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 intensity_real_q[DIRAC_MAX_NBANDS]; -#else - Word16 intensity_real_q; -#endif Word32 direction_vector_fx[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS]; Word16 direction_vector_q; Word32 diffuseness_vector_fx[DIRAC_MAX_NBANDS]; @@ -1008,10 +988,6 @@ void ivas_dirac_param_est_enc_fx( cldfb_q = 0; move16(); -#ifndef NONBE_IMPROVE_DIRAC_INTENSITY_PREC - intensity_real_q = 0; - move16(); -#endif direction_vector_q = 0; move16(); @@ -1148,15 +1124,10 @@ void ivas_dirac_param_est_enc_fx( hDirAC->hConfig->enc_param_start_band, num_freq_bands, intensity_real_fx -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , cldfb_q, intensity_real_q -#endif ); -#ifndef NONBE_IMPROVE_DIRAC_INTENSITY_PREC - intensity_real_q = sub( shl( cldfb_q, 1 ), 31 ); // 2 * Q_Cldfb + 1 - 32; -#endif IF( !hodirac_flag ) { computeDirectionVectors_fixed( @@ -1168,13 +1139,8 @@ void ivas_dirac_param_est_enc_fx( direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2] -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , 31, intensity_real_q -#else - , - sub( 31, intensity_real_q ) -#endif ); direction_vector_q = Q30; @@ -1190,11 +1156,7 @@ void ivas_dirac_param_est_enc_fx( { /* only real part needed */ Copy32( intensity_real_fx[i], &( hDirAC->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); /* intensity_real_q */ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Copy( intensity_real_q, &hDirAC->buffer_intensity_real_q[i][index - 1][0], num_freq_bands ); -#else - set16_fx( &hDirAC->buffer_intensity_real_q[i][index - 1][0], intensity_real_q, num_freq_bands ); -#endif } Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); /* exp(reference_power_exp) */ FOR( i = 0; i < num_freq_bands; i++ ) @@ -1406,12 +1368,7 @@ void ivas_dirac_param_est_enc_fx( Scale_sig32( dir_v_fx, 3, -1 ); ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( dir_v_fx, -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Q29, -#else - - Q30, -#endif &q_direction->band_data[band_m_idx].azimuth_fx[block_m_idx], &q_direction->band_data[band_m_idx].elevation_fx[block_m_idx] ); } @@ -1506,11 +1463,9 @@ static void computeIntensityVector_enc_fx( const Word16 enc_param_start_band, /* i : first band to process Q0*/ const Word16 num_frequency_bands, /* Q0 */ Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] /* q_intensity_real */ -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , Word16 q_cldfb, Word16 q_intensity_real[DIRAC_MAX_NBANDS] -#endif ) { /* Reminder @@ -1520,20 +1475,16 @@ static void computeIntensityVector_enc_fx( Word16 i, j; Word32 real, img; Word16 brange[2]; -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 shift_value = sub( shl( q_cldfb, 1 ), 31 ); -#endif FOR( i = 0; i < num_frequency_bands; i++ ) { brange[0] = hDirAC->band_grouping[i + enc_param_start_band]; /* Q0 */ move16(); brange[1] = hDirAC->band_grouping[i + enc_param_start_band + 1]; /* Q0 */ move16(); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word16 num_bins = sub( brange[1], brange[0] ); Word16 gb = find_guarded_bits_fx( num_bins ); Word16 norm; -#endif intensity_real[0][i] = 0; move32(); intensity_real[1][i] = 0; @@ -1552,7 +1503,6 @@ static void computeIntensityVector_enc_fx( move32(); img = Cldfb_ImagBuffer[0][j]; move32(); -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC Word64 t1, t2, t3; t1 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), Cldfb_ImagBuffer[3][j], img ); /* 2 * q_cldfb + 1 */ t2 = W_mac_32_32( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), Cldfb_ImagBuffer[1][j], img ); /* 2 * q_cldfb + 1 */ @@ -1564,14 +1514,7 @@ static void computeIntensityVector_enc_fx( tmp_1 = W_add( tmp_1, t1 ); /* 2 * q_cldfb + 1 */ tmp_2 = W_add( tmp_2, t2 ); /* 2 * q_cldfb + 1 */ tmp_3 = W_add( tmp_3, t3 ); /* 2 * q_cldfb + 1 */ -#else - /* Intensity is XYZ order, audio is WYZX order. */ - tmp_1 = W_add( tmp_1, W_add( W_mult_32_32( Cldfb_RealBuffer[3][j], real ), W_mult_32_32( Cldfb_ImagBuffer[3][j], img ) ) ); - tmp_2 = W_add( tmp_2, W_add( W_mult_32_32( Cldfb_RealBuffer[1][j], real ), W_mult_32_32( Cldfb_ImagBuffer[1][j], img ) ) ); - tmp_3 = W_add( tmp_3, W_add( W_mult_32_32( Cldfb_RealBuffer[2][j], real ), W_mult_32_32( Cldfb_ImagBuffer[2][j], img ) ) ); -#endif } -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC norm = 63; move16(); IF( tmp_1 != 0 ) @@ -1593,15 +1536,6 @@ static void computeIntensityVector_enc_fx( intensity_real[2][i] = W_extract_h( W_shl( tmp_3, norm ) ); // shift_value - (gb - norm) q_intensity_real[i] = sub( shift_value, sub( gb, norm ) ); move16(); -#else - - intensity_real[0][i] = W_extract_h( tmp_1 ); // output Q= 2* input_q + 1 - 32 - move32(); - intensity_real[1][i] = W_extract_h( tmp_2 ); // output Q= 2* input_q + 1 - 32 - move32(); - intensity_real[2][i] = W_extract_h( tmp_3 ); // output Q= 2* input_q + 1 - 32 - move32(); -#endif } return; diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index b37e61829..a53e40ee6 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -621,11 +621,7 @@ ivas_error front_vad_spar_fx( corr_shift_fx = correlation_shift_fx( hFrontVad->hNoiseEst->totalNoise_fx ); /* Q15 */ -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx_ivas_fx( st, hEncoderConfig->last_ivas_total_brate, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8_fx, Q_inp_12k8 ); -#else - dtx_ivas_fx( st, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8_fx, Q_inp_12k8 ); -#endif /* linear prediction analysis */ alw_pitch_lag_12k8[0] = st->old_pitch_la; /* Q0 */ diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 6aba283be..b06acfbac 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -174,11 +174,7 @@ Word16 ivas_ism_dtx_enc_fx( ( EQ_16( nchan_ism, 2 ) && LE_32( ivas_total_brate, IVAS_48k ) ) || ( EQ_16( nchan_ism, 3 ) && LE_32( ivas_total_brate, IVAS_80k ) ) || ( EQ_16( nchan_ism, 4 ) && LE_32( ivas_total_brate, IVAS_96k ) ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD LT_16( lp_noise_max_fx, ( DTX_THR << 8 ) ) ) ) -#else - LT_16( lp_noise_max_fx, ( 15 << 8 ) ) ) ) -#endif { dtx_flag = 0; move16(); diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index c2f77c159..7f9962098 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -116,12 +116,10 @@ ivas_error ivas_ism_enc_fx( error = IVAS_ERR_OK; move32(); -#ifdef MSAN_FIX FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set16_zero_fx( old_inp_12k8_fx[i][0], L_INP_12k8 ); } -#endif set16_fx( q_re_im_buf, 0, MAX_NUM_OBJECTS ); @@ -247,11 +245,7 @@ ivas_error ivas_ism_enc_fx( error = pre_proc_front_ivas_fx( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8_fx[sce_id][0], old_inp_16k_fx[sce_id][0], &ener_fx[sce_id][0], &relE_fx[sce_id][0], A_fx[sce_id][0], Aw_fx[sce_id][0], epsP_fx[sce_id][0], &epsP_fx_q[sce_id][0], lsp_new_fx[sce_id][0], lsp_mid_fx[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer_fx[sce_id][0], imagBuffer_fx[sce_id][0], &q_re_im_buf[sce_id], old_wsp_fx[sce_id][0], &q_old_wsp, pitch_fr_fx[sce_id][0], voicing_fr_fx[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum_fx[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer_fx[sce_id][0], &enerBuffer_fx_exp[sce_id][0], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff_fx[sce_id][0], &fft_buff_fx_q[sce_id][0], A_fx[sce_id][0], lsp_new_fx[sce_id][0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[sce_id][0] -#else - fft_buff_fx[sce_id][0], &fft_buff_fx_q[sce_id][0], A_fx[sce_id][0], lsp_new_fx[sce_id][0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[sce_id][0] -#endif #ifdef DEBUG_MODE_INFO , st->id_element @@ -286,11 +280,7 @@ ivas_error ivas_ism_enc_fx( test(); IF( st_ivas->hSCE[j] && st_ivas->hSCE[j]->hCoreCoder[0] ) { -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st_ivas->hSCE[j]->hCoreCoder[0]->input_fx, st_ivas->hSCE[j]->hCoreCoder[0]->input32_fx, input_frame, sub( Q11, st_ivas->hSCE[j]->hCoreCoder[0]->q_inp ) ); /* Q11 */ -#else - Copy_Scale_sig_16_32_DEPREC( st_ivas->hSCE[j]->hCoreCoder[0]->input_fx, st_ivas->hSCE[j]->hCoreCoder[0]->input32_fx, input_frame, sub( Q11, st_ivas->hSCE[j]->hCoreCoder[0]->q_inp ) ); /* Q11 */ -#endif st_ivas->hSCE[j]->hCoreCoder[0]->q_inp32 = Q11; move16(); } diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index 8e6e0c93f..1efbb2123 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -314,10 +314,8 @@ ivas_error ivas_ism_metadata_enc_fx( } ELSE IF( EQ_16( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ) ) { -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; move16(); -#endif lowrate_metadata_flag[ch] = 1; move16(); hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; @@ -650,10 +648,8 @@ ivas_error ivas_ism_metadata_enc_fx( { hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); move16(); -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = s_min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); move16(); -#endif } ELSE { @@ -821,10 +817,8 @@ ivas_error ivas_ism_metadata_enc_fx( { hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); move16(); -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = s_min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); move16(); -#endif } ELSE { diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index da1f836df..080a62a9d 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -987,11 +987,7 @@ ivas_error ivas_masa_enc_config_fx( /* Setup importance weights for two-direction band selection. */ IF( EQ_16( hMasa->config.numberOfDirections, 2 ) ) { -#ifdef MSAN_FIX set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, MASA_FREQUENCY_BANDS ); -#else - set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, hMasa->config.numCodingBands ); -#endif IF( EQ_16( hMasa->config.numCodingBands, 5 ) ) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 17fefec7e..039bbdf98 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -1010,11 +1010,7 @@ static void ivas_param_mc_param_est_enc_fx( Cx_sum_e[cur_param_band][ref_channel_idx][ref_channel_idx], &ref_ener_e ); } L_tmp = Mpy_32_16_1( ref_ener_fx, hParamMC->hMetadataPMC.ild_factors_fx[k] ); -#ifdef FIX_ISSUE_1154 L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_add( L_tmp, EPSILLON_FX ), &tmp_e ) ); -#else - L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_tmp, &tmp_e ) ); -#endif tmp_e = add( sub( Nrg_e[h_ild_mapping->ild_index[k]], ref_ener_e ), tmp_e ); @@ -1392,11 +1388,7 @@ static void ivas_param_mc_quantize_ilds_fx( ref_ener_fx = BASOP_Util_Add_Mant32Exp( ref_ener_fx, ref_ener_e, Cx_fx[ref_channel_idx][ref_channel_idx], Cx_e[ref_channel_idx][ref_channel_idx], &ref_ener_e ); } ref_ener_fx = Mpy_32_16_1( ref_ener_fx, hParamMC->hMetadataPMC.ild_factors_fx[k] ); -#ifdef FIX_ISSUE_1154 L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], L_add( ref_ener_fx, EPSILLON_FX ), &tmp_e ) ); -#else - L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( Nrg_fx[h_ild_mapping->ild_index[k]], ref_ener_fx, &tmp_e ) ); -#endif tmp_e = add( sub( Nrg_e[h_ild_mapping->ild_index[k]], ref_ener_e ), tmp_e ); /*10 in Q21 = 1342177280*/ ILD_fx[k] = Mpy_32_32( 1342177280, BASOP_Util_Log10( L_tmp, tmp_e ) ); // Q21 diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c index fd5cb6217..cad29b146 100644 --- a/lib_enc/ivas_mc_paramupmix_enc_fx.c +++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c @@ -1040,12 +1040,6 @@ static ivas_error ivas_mc_paramupmix_param_est_enc_fx( IF( LT_16( maxbands, IVAS_MAX_NUM_BANDS ) ) { -#ifndef FIX_1133_IMPROVE_MC_MLD - *exp_alphas = 0; - move16(); - *exp_betas = 0; - move16(); -#endif FOR( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) { FOR( bnd = maxbands; bnd < IVAS_MAX_NUM_BANDS; bnd++ ) diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 22f21dceb..0071b67ea 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -940,13 +940,11 @@ void ivas_mcmasa_param_est_enc_fx( Word16 surroundingCoherence_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 numAnalysisChannels; -#ifdef MSAN_FIX FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) { set_zero_fx( Chnl_RealBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); set_zero_fx( Chnl_ImagBuffer_fx[i], DIRAC_NO_FB_BANDS_MAX ); } -#endif num_freq_bins = idiv1616( input_frame, MDFT_NO_COL_MAX ); num_freq_bands = hMcMasa->nbands; @@ -1181,10 +1179,8 @@ void ivas_mcmasa_param_est_enc_fx( direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], c_e -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Power and intensity estimation for diffuseness */ diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 71515571d..548a56717 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -270,7 +270,6 @@ void ivas_mct_core_enc_fx( nCPE = add( nCPE, 1 ); } -#ifdef MSAN_FIX FOR( ch = 0; ch < MCT_MAX_CHANNELS; ch++ ) { set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k ); @@ -278,7 +277,6 @@ void ivas_mct_core_enc_fx( move16(); set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX ); } -#endif // MSAN_FIX FOR( ch = 0; ch < nChannels; ch++ ) { set32_fx( inv_spectrum_long_fx[ch], 0, L_FRAME48k ); @@ -334,7 +332,6 @@ void ivas_mct_core_enc_fx( IF( switch_bw ) { -#ifdef FIX_USAN_ISSUES IF( sts[ch_core]->hIGFEnc == NULL ) { initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, @@ -345,10 +342,6 @@ void ivas_mct_core_enc_fx( initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); } -#else - initMdctStereoEncData_fx( hMCT->hBlockData[ch]->hStereoMdct, ivas_format, sts[ch_core]->element_mode, sts[ch_core]->element_brate, sts[ch_core]->bwidth, - sts[ch_core]->igf, sts[ch_core]->hIGFEnc->igfData.igfInfo.grid, 0 ); -#endif } IF( sts[ch_core]->igf ) @@ -653,11 +646,7 @@ void ivas_mct_core_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[ch], sub( Q31, q_powSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hIGFEnc->spec_be_igf_e = sub( 31, q_origSpec ); st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index a8ba9a320..78bf976d1 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -1116,11 +1116,7 @@ void mctStereoIGF_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[p_ch[ch]], sub( Q31, q_powerSpec[p_ch[ch]] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[p_ch[ch]][n], &q_spectrum, &powerSpec_fx[p_ch[ch]][n * L_subframeTCX], &exp_powerSpec[p_ch[ch]][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[p_ch[ch]][n], &q_spectrum, &powerSpec_fx[p_ch[ch]][n * L_subframeTCX], &exp_powerSpec[p_ch[ch]][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); move16(); @@ -1161,11 +1157,7 @@ void mctStereoIGF_enc_fx( q_spectrum = sub( 31, st->hTcxEnc->spectrum_e[n] ); set16_fx( exp_powerSpec[ch], sub( Q31, q_powerSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX ); -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#else ProcessIGF_ivas_fx( st, L_FRAME48k, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, sp_aud_decision0[ch], 0 ); -#endif st->hTcxEnc->spectrum_e[n] = sub( 31, q_spectrum ); move16(); diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 9f674473e..4b5b3fcbe 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -429,17 +429,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); -#ifdef MSAN_FIX Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 -#else - Scale_sig( &tcxTimeSignal[n - s], shl( s, 1 ), -Q1 ); // Q0 -> Q-1 -#endif wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 -#ifdef MSAN_FIX Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 -#else - Scale_sig( &tcxTimeSignal[n - s], shl( s, 1 ), Q1 ); // Q-1 -> Q0 -#endif Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); @@ -545,11 +537,7 @@ static void kernel_switch_update_transforms_fx( Copy_Scale_sig_32_16( windowedTimeSignal + 2, windowedTimeSignal_16 + 2, add( s, shr( add( leftOverlap, rightOverlap ), 1 ) ), -Q16 ); // *q_windowedTimeSignal - Q16 WindowSignal( hTcxCfg, shr( leftOverlap, 1 ), RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal_16 + 2, &s, tcx5Win, 0, 1 ); // *q_windowedTimeSignal - Q16 Copy_Scale_sig_16_32_no_sat( tcx5Win, tcx5Win_32, add( s, shr( add( leftOverlap, rightOverlap ), 1 ) ), Q16 ); // *q_windowedTimeSignal -#ifdef FIX_ISSUE_1157 q_shift = -Q8; -#else - q_shift = -Q7; -#endif move16(); scale_sig32( tcx5Win_32, add( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), q_shift ); // *q_windowedTimeSignal + q_shift kernel_switch_trafo_fx( tcx5Win_32, sigR, leftOverlap, sub( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), rightOverlap, kernelType ); // *q_windowedTimeSignal + q_shift @@ -579,11 +567,7 @@ static void kernel_switch_update_transforms_fx( ELSE /* tcxTransType != TCX_5 */ { Word16 q_shift, q_com, q_temp; -#ifdef FIX_ISSUE_1157 q_shift = -Q8; -#else - q_shift = -Q7; -#endif move16(); scale_sig32( windowedTimeSignal + 2, add( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), q_shift ); // *q_windowedTimeSignal + q_shift kernel_switch_trafo_fx( windowedTimeSignal + 2, sigR, leftOverlap, sub( s /* L_subfr. */, shr( add( leftOverlap, rightOverlap ), 1 ) ), rightOverlap, kernelType ); // *q_windowedTimeSignal + q_shift @@ -912,13 +896,8 @@ static UWord16 enc_ste_pre_mdct( absMagnR_fx = Sqrt32( L_add( Mpy_32_32( sigR1_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI1_fx[s], sigI1_fx[s] ) ), &absMagnR_e ); corr_fx = L_add( corr_fx, L_add( Mpy_32_32( sigR0_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI0_fx[s], sigI1_fx[s] ) ) ); // q_com*2 - 31 -#ifdef FIX_ISSUE_1092 sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 -#else - sumL_fx = L_add( sumL_fx, L_add( sigR0_fx[s], sigI0_fx[s] ) ); // q_com - sumR_fx = L_add( sumR_fx, L_add( sigR1_fx[s], sigI1_fx[s] ) ); // q_com -#endif sumMagnL_fx = BASOP_Util_Add_Mant32Exp( sumMagnL_fx, sumMagnL_e, absMagnL_fx, absMagnL_e, &sumMagnL_e ); sumMagnR_fx = BASOP_Util_Add_Mant32Exp( sumMagnR_fx, sumMagnR_e, absMagnR_fx, absMagnR_e, &sumMagnR_e ); sumPrdLR_fx = BASOP_Util_Add_Mant32Exp( sumPrdLR_fx, sumPrdLR_e, Mpy_32_32( absMagnL_fx, absMagnR_fx ), add( absMagnL_e, absMagnR_e ), &sumPrdLR_e ); @@ -930,11 +909,7 @@ static UWord16 enc_ste_pre_mdct( temp1 = L_shl( preproLen, x1 ); corr_fx = Mpy_32_32( corr_fx, temp1 ); x1 = sub( 62, add( shl( *q_com, 1 ), x1 ) ); -#ifdef FIX_ISSUE_1092 corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, shl( sub( *q_com, 1 ), 1 ) ), &x1 ); -#else - corr_fx = BASOP_Util_Add_Mant32Exp( corr_fx, x1, Mpy_32_32( sumL_fx, sumR_fx ), sub( 62, shl( *q_com, 1 ) ), &x1 ); -#endif IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( corr_fx, x1, -maxSqrValue_fx, 52 ), -1 ) ) { @@ -1181,7 +1156,6 @@ void ivas_mdct_core_whitening_enc_fx( push_wmops( "mdct_core_whitening" ); -#ifdef MSAN_FIX FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { FOR( i = 0; i < NB_DIV; i++ ) @@ -1195,7 +1169,6 @@ void ivas_mdct_core_whitening_enc_fx( set16_fx( orig_spectrum_e[ch], 0, NB_DIV ); } set16_fx( q_windowedSignal, Q31, CPE_CHANNELS ); -#endif q_com = Q31; q_min = 0; move16(); @@ -1235,9 +1208,7 @@ void ivas_mdct_core_whitening_enc_fx( orig_spectrum[ch][1] = orig_spectrum_long[ch] + N_TCX10_MAX; mdst_spectrum_fx[ch][0] = mdst_spectrum_long_fx[ch]; mdst_spectrum_fx[ch][1] = mdst_spectrum_long_fx[ch] + N_TCX10_MAX; -#ifdef MSAN_FIX set32_fx( temp_buffer, 0, 15 * L_FRAME48k / 8 ); -#endif } windowedSignal_fx[0] = orig_spectrum_long[0]; /* NOTE temporarily available */ diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index d31e6d53d..1433c988f 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1050,10 +1050,8 @@ static void ivas_omasa_param_est_enc_fx( move16(); /* Need to initialize renormalization_factors, and variables to be normalized */ -#ifdef MSAN_FIX set_zero_fx( &Foa_RealBuffer_fx[0][0], FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &Foa_ImagBuffer_fx[0][0], FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); -#endif set_zero_fx( renormalization_factor_diff_fx, hOMasa->nbands ); set_zero_fx( diffuseness_m_fx, hOMasa->nbands ); @@ -1202,10 +1200,8 @@ static void ivas_omasa_param_est_enc_fx( intensity_real_e = sub( add( 62, guard_bits ), shl( q, 1 ) ); computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Power estimation for diffuseness */ diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 0ca93e1a1..dbff29d68 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -77,11 +77,7 @@ static void ivas_merge_sba_transports_fx( { FOR( j = 0; j < input_frame; j++ ) { -#ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS data_out_f[i][j] = L_shr( L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ), Q1 ); -#else - data_out_f[i][j] = L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ); -#endif move32(); } } @@ -479,9 +475,6 @@ static void ivas_osba_render_ism_to_sba_fx( Word16 azimuth_fx, elevation_fx; Word32 gains_fx[MAX_INPUT_CHANNELS]; Word32 g1_fx, g2_fx; -#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS - Word32 output_gain_fx; -#endif Word16 nchan_sba; nchan_sba = imult1616( add( sba_analysis_order, 1 ), add( sba_analysis_order, 1 ) ); @@ -524,21 +517,6 @@ static void ivas_osba_render_ism_to_sba_fx( } *Q_data = sub( *Q_data, 2 ); -#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS - /* Gain with loudness-matching gains */ - // output_gain = 0.7499f; - output_gain_fx = 1610397988; // 0.7499f in Q31 - move32(); - FOR( j = 0; j < nchan_sba; j++ ) - { - FOR( k = 0; k < input_frame; k++ ) - { - // data_out_f[j][k] *= output_gain; - data_out_fx[j][k] = Mpy_32_32( data_out_fx[j][k], output_gain_fx ); - move32(); - } - } -#endif return; } diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 7de54c482..10380f422 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -2500,11 +2500,7 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( } ELSE { -#ifdef FIX_USAN_ISSUES avg_elevation_index = (UWord16) L_add( avg_elevation_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_elevation_offset ) ); -#else - avg_elevation_index = u_extract_l( UL_addNsD( avg_elevation_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_elevation_offset ) ) ); -#endif } // avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); avg_elevation_index = u_extract_l( UL_addNsD( avg_elevation_index, avg_elevation_alphabet ) % avg_elevation_alphabet ); @@ -2639,13 +2635,8 @@ static Word16 ivas_qmetadata_entropy_encode_dir_fx( FOR( avg_azimuth_offset = 0; avg_azimuth_offset < q_direction->cfg.search_effort; avg_azimuth_offset++ ) { set_zero_fx( avg_direction_vector, 3 ); -#ifdef FIX_USAN_ISSUES avg_azimuth_index = (UWord16) L_add( avg_azimuth_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_azimuth_offset ) ); avg_azimuth_index = (UWord16) ( L_add( avg_azimuth_index, avg_azimuth_alphabet ) % avg_azimuth_alphabet ); -#else - avg_azimuth_index = (UWord16) add( avg_azimuth_index_initial, ivas_qmetadata_dereorder_generic_fx( avg_azimuth_offset ) ); - avg_azimuth_index = (UWord16) ( add( avg_azimuth_index, avg_azimuth_alphabet ) % avg_azimuth_alphabet ); -#endif all_zero_dist_azimuth_indexes = 1; move16(); azimuth_bits_ec = ivas_qmetadata_encode_quasi_uniform_length_fx( ivas_qmetadata_reorder_generic_fx( sub( avg_azimuth_index, shr( avg_azimuth_alphabet, 1 ) ) ), avg_azimuth_alphabet ); @@ -5452,11 +5443,7 @@ static Word16 encode_surround_coherence_hr_fx( } ELSE { -#ifdef FIX_USAN_ISSUES no_idx16 = add( shr( nbits_fr, 4 ), 1 ); -#else - no_idx16 = shr_r( nbits_fr, 4 ); -#endif } /* write combined index */ @@ -5478,11 +5465,7 @@ static Word16 encode_surround_coherence_hr_fx( } ELSE { -#ifdef FIX_USAN_ISSUES no_idx16 = add( shr( nbits_fr1, 4 ), 1 ); -#else - no_idx16 = shr_r( nbits_fr1, 4 ); -#endif } assert( no_idx16 <= 4 ); diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 3a0f19c50..b2e0e9c69 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -120,9 +120,7 @@ ivas_error ivas_sce_enc_fx( * Initialization - general *-----------------------------------------------------------------*/ -#ifdef MSAN_FIX set16_zero_fx( old_inp_12k8_fx[0], L_INP_12k8 ); -#endif Copy32( data_fx, st->input32_fx, input_frame ); // Q(q_data_fx) q_input = sub( add( L_norm_arr( st->input32_fx, input_frame ), q_data_fx ), 16 ); @@ -253,11 +251,7 @@ ivas_error ivas_sce_enc_fx( &ener_fx[0], &relE_fx[0], A_fx[0], Aw_fx[0], epsP_fx[0], &epsP_fx_q[0], lsp_new_fx[0], lsp_mid_fx[0], &vad_hover_flag[0], &attack_flag[0], realBuffer_fx[0], imagBuffer_fx[0], &q_re_im_buf, old_wsp_fx[0], &q_old_wsp, pitch_fr_fx[0], voicing_fr_fx[0], &loc_harm[0], &cor_map_sum_fx[0], &vad_flag_dtx[0], enerBuffer_fx[0], &enerBuffer_fx_exp[0], fft_buff_fx[0], &fft_buff_fx_q[0], A_fx[0], lsp_new_fx[0], currFlatness_fx[0], 0, fr_bands_fx, q_fr_bands, Etot_LR_fx, lf_E_fx, 31, localVAD_HE_SAD, NULL, 31, flag_16k_smc, -#ifdef NONBE_1211_DTX_BR_SWITCHING st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[0] -#else - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->ivas_total_brate, &Q_new[0] -#endif #ifdef DEBUG_MODE_INFO , st->id_element diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c index 22cd98cad..b7de878a1 100644 --- a/lib_enc/ivas_sns_enc_fx.c +++ b/lib_enc/ivas_sns_enc_fx.c @@ -817,15 +817,10 @@ Word16 quantize_sns_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifdef MSAN_FIX FOR( k = 0; k < nSubframes; k++ ) { scale_sig32( snsQ_out_fx[ch][k], M, sub( sns_e_tmp[ch][k], sns_e ) ); // Q(31-sns_e_tmp[ch][k]) } -#else - scale_sig32( snsQ_out_fx[ch][0], M, sub( sns_e_tmp[ch][0], *sns_e ) ); - scale_sig32( snsQ_out_fx[ch][1], M, sub( sns_e_tmp[ch][1], *sns_e ) ); -#endif } /* get back to L/F representation */ test(); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index ef278d188..4a6543026 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -88,12 +88,8 @@ typedef struct stereo_itd_data_struct Word16 prev_sum_nrg_L_lb_fx_e; Word32 prev_xcorr_lb_fx[STEREO_DFT_XCORR_LB_MAX]; Word16 prev_xcorr_lb_fx_e; -#ifdef FIX_ISSUE_1092 Word32 E_band_n_fx[STEREO_DFT_ITD_VAD_BAND_NUM]; /*E_band_n_exp*/ Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM]; -#else - Word32 E_band_n_fx[STEREO_DFT_ITD_VAD_BAND_NUM]; /*Q0*/ -#endif Word32 xcorr_smooth_fx[STEREO_DFT_N_32k_ENC]; Word16 xcorr_smooth_fx_e[STEREO_DFT_N_32k_ENC]; Word32 lp_phat_peak_fx; /* low-pass GCC PHAT peak value */ // Q31 @@ -1183,11 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word32 isd_rate_s_fx; // Q31 -#else - Word16 isd_rate_s_fx; // Q15 -#endif Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 @@ -1228,11 +1220,7 @@ typedef struct stereo_dmx_evs_enc_data_structure STEREO_DMX_EVS_POC_HANDLE hPOC; STEREO_DMX_EVS_PHA_HANDLE hPHA; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx; // Q0 -#else - Word32 itd_fx; // Q16 -#endif Word32 pre_dmx_energy_fx[1]; Word16 pre_dmx_energy_fx_e[1]; diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 3e148a5ae..3e69a0ca6 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -1697,11 +1697,7 @@ static void edge_detect_fx( } } -#ifndef FIX_1297_OVERFLOW - *edge_str = extract_l( L_shr( edge_min, 10 ) ); // Q15 -#else *edge_str = extract_h( L_shl_sat( edge_min, 16 - 10 ) ); // Q15 -#endif move16(); *edge_type = et; // Q0 move16(); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 3eb6c0e82..cebbc2619 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -593,10 +593,8 @@ void stereo_dft_enc_reset_fx( move16(); hStereoDft->dmx_res_all_prev_fx = 1; move32(); -#ifdef MSAN_FIX hStereoDft->dmx_res_all_prev_fx_e = 31; move16(); -#endif hStereoDft->last_res_cod_mode_modify_flag = 0; move16(); hStereoDft->res_cod_sw_flag = 0; @@ -750,9 +748,7 @@ void stereo_enc_itd_init_fx( hItd->prev_xcorr_lb_fx_e = 0; move16(); set32_fx( hItd->E_band_n_fx, ITD_VAD_E_BAND_N_INIT, STEREO_DFT_ITD_VAD_BAND_NUM ); -#ifdef FIX_ISSUE_1092 set16_fx( hItd->E_band_n_exp, Q31, STEREO_DFT_ITD_VAD_BAND_NUM ); -#endif hItd->vad_frm_cnt = 0; move16(); hItd->pre_vad = 0; @@ -1102,11 +1098,7 @@ void stereo_dft_enc_analyze_fx( { FOR( n = 0; n < n_channels; n++ ) { -#ifdef MSAN_FIX Scale_sig( hStereoDft->input_mem_itd_fx[n], dft_ovl, sub( sts[n]->q_inp, hStereoDft->q_input_mem_itd[n] ) ); // Q(sts[n]->q_inp) -#else - Scale_sig( hStereoDft->input_mem_itd_fx[n], STEREO_DFT_OVL_MAX, sts[n]->q_inp - hStereoDft->q_input_mem_itd[n] ); -#endif // MSAN_FIX hStereoDft->q_input_mem_itd[n] = sts[n]->q_inp; move16(); Copy( hStereoDft->input_mem_itd_fx[n], input_mem[n], dft_ovl ); @@ -1657,11 +1649,7 @@ void stereo_dft_enc_process_fx( pDFT_L_fx = hStereoDft->DFT_fx[0]; pDFT_R_fx = hStereoDft->DFT_fx[1]; -#ifdef MSAN_FIX FOR( i = 0; i < hStereoDft->NFFT; i++ ) -#else - FOR( i = 0; i < STEREO_DFT_N_MAX_ENC; i++ ) -#endif // MSAN_FIX { tmp_e = norm_l( hStereoDft->DFT_fx[0][i] ); pDFT_L_fx[i] = L_shl( hStereoDft->DFT_fx[0][i], tmp_e ); diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index af10f7dea..b7429e2e7 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -203,12 +203,8 @@ static void stereo_dft_quantize_itd_fx( *-------------------------------------------------------------------------*/ static Word32 itd_vad_ms_snr_calc_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word32 *Spd, // Q(31-Spd_e) Word16 *Spd_e, Word32 *E_band, // Q(31-E_band_e) @@ -251,11 +247,7 @@ static Word32 itd_vad_ms_snr_calc_fx( // snr[i] = E_band[i] / E_band_n[i]; snr[i] = BASOP_Util_Divide3232_Scale_cadence( E_band[i], E_band_n[i], &snr_e[i] ); move32(); -#ifdef FIX_ISSUE_1092 snr_e[i] = add( snr_e[i], sub( E_band_e[i], E_band_n_exp[i] ) ); -#else - snr_e[i] = add( snr_e[i], sub( E_band_e[i], 31 ) ); -#endif move16(); // if ( snr[i] < 1 ) IF( BASOP_Util_Cmp_Mant32Exp( snr[i], snr_e[i], 1, 31 ) < 0 ) @@ -291,12 +283,8 @@ static Word32 itd_vad_ms_snr_calc_fx( * *-------------------------------------------------------------------------*/ static void itd_vad_background_update_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word16 *vad_frm_cnt, const Word32 ms_snr, // Q(31-ms_snr_e) const Word16 ms_snr_e, @@ -338,19 +326,10 @@ static void itd_vad_background_update_fx( Word16 q_temp = norm_l( *vad_frm_cnt ); L_temp = L_shl( *vad_frm_cnt, q_temp ); L_temp_e = sub( 31, q_temp ); -#ifdef FIX_ISSUE_1092 L_temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( E_band_n[i], L_temp ), add( E_band_n_exp[i], L_temp_e ), E_band[i], E_band_e[i], &L_temp_e ); -#else - L_temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( E_band_n[i], L_temp ), add( 31, L_temp_e ), E_band[i], E_band_e[i], &L_temp_e ); -#endif E_band_n[i] = BASOP_Util_Divide3232_Scale_cadence( L_temp, L_add( *vad_frm_cnt, 1 ), &E_band_n_e_tmp ); move32(); -#ifdef FIX_ISSUE_1092 E_band_n_exp[i] = add( E_band_n_e_tmp, sub( L_temp_e, 31 ) ); -#else - E_band_n_e_tmp = add( E_band_n_e_tmp, sub( L_temp_e, 31 ) ); - E_band_n[i] = L_shr_r( E_band_n[i], sub( 31, E_band_n_e_tmp ) ); // Q31 -#endif move16(); } } @@ -362,7 +341,6 @@ static void itd_vad_background_update_fx( FOR( i = 0; i < STEREO_DFT_ITD_VAD_BAND_NUM; i++ ) { // E_band_n[i] = 0.96f * E_band_n[i] + 0.04f * E_band[i]; -#ifdef FIX_ISSUE_1092 E_band_n[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( 2061584302 /*0.96 in Q31*/, E_band_n[i] ), E_band_n_exp[i], Mpy_32_32( 85899346 /*0.04 in Q31*/, E_band[i] ), E_band_e[i], &E_band_n_e_tmp ); move32(); E_band_n_exp[i] = E_band_n_e_tmp; @@ -375,20 +353,6 @@ static void itd_vad_background_update_fx( E_band_n_exp[i] = 0; move16(); } -#else - E_band_n[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( 2061584302, E_band_n[i] ), 31, Mpy_32_32( 85899346, E_band[i] ), E_band_e[i], &E_band_n_e_tmp ); - move32(); - // if ( E_band_n[i] < 1.0f ) - IF( BASOP_Util_Cmp_Mant32Exp( E_band_n[i], E_band_n_e_tmp, MAX_32, 0 ) < 0 ) - { - E_band_n[i] = MAX_32; - move32(); - E_band_n_e_tmp = 0; - move16(); - } - E_band_n[i] = L_shr_r( E_band_n[i], sub( 31, E_band_n_e_tmp ) ); // Q31 - move32(); -#endif } } } @@ -402,12 +366,8 @@ static void itd_vad_background_update_fx( *-------------------------------------------------------------------------*/ static Word16 stereo_dft_enc_itd_vad_fx( -#ifdef FIX_ISSUE_1092 Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // E_band_n_exp Word16 E_band_n_exp[STEREO_DFT_ITD_VAD_BAND_NUM], -#else - Word32 E_band_n[STEREO_DFT_ITD_VAD_BAND_NUM], // Q0 -#endif Word16 *vad_frm_cnt, Word32 *Spd_L, // Q(31-Spd_L_e) Word16 *Spd_L_e, @@ -434,17 +394,10 @@ static Word16 stereo_dft_enc_itd_vad_fx( Spd_e[i] = sub( Spd_e[i], 1 ); move16(); } -#ifdef FIX_ISSUE_1092 *mssnr = itd_vad_ms_snr_calc_fx( E_band_n, E_band_n_exp, Spd, Spd_e, E_band, E_band_e, mssnr_e ); move32(); itd_vad_background_update_fx( E_band_n, E_band_n_exp, vad_frm_cnt, *mssnr, *mssnr_e, E_band, E_band_e ); -#else - *mssnr = itd_vad_ms_snr_calc_fx( E_band_n, Spd, Spd_e, E_band, E_band_e, mssnr_e ); - move32(); - - itd_vad_background_update_fx( E_band_n, vad_frm_cnt, *mssnr, *mssnr_e, E_band, E_band_e ); -#endif // if ( *mssnr < ITD_VAD_THRSHOLD ) IF( BASOP_Util_Cmp_Mant32Exp( *mssnr, *mssnr_e, ITD_VAD_THRSHOLD_Q31, 0 ) < 0 ) { @@ -1476,11 +1429,7 @@ void stereo_dft_enc_compute_itd_fx( } // L_temp = sum2_32_fx( &Spd_L[1], 11, &L_temp_e ); sum_nrg_L_lb = BASOP_Util_Add_Mant32Exp( sum_nrg_L_lb, sum_nrg_L_lb_e, L_temp, L_temp_e, &sum_nrg_L_lb_e ); -#ifdef FIX_ISSUE_1092 vad_flag_itd = stereo_dft_enc_itd_vad_fx( hItd->E_band_n_fx, hItd->E_band_n_exp, &( hItd->vad_frm_cnt ), Spd_L, Spd_L_e, Spd_R, Spd_R_e, &mssnr, &mssnr_e ); -#else - vad_flag_itd = stereo_dft_enc_itd_vad_fx( hItd->E_band_n_fx, &( hItd->vad_frm_cnt ), Spd_L, Spd_L_e, Spd_R, Spd_R_e, &mssnr, &mssnr_e ); -#endif vad_flag_itd = vad_flag_itd && vad_flag_dtx[0]; // if ( sum_nrg_L < EPSILON ) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 933270c33..2ed17e25a 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -68,17 +68,11 @@ #define STEREO_DMX_EVS_ISD_THRES_L_Q31 1932735283 #define STEREO_DMX_EVS_ISD_DIST_THRES_IPD_Q15 ONE_IN_Q14 -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA #define STEREO_DMX_EVS_ISD_FORGETTING_Q31 2040109465 #define STEREO_DMX_EVS_ISD_1MFORGETTING_Q15 1638 #define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 773094113 #define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 923417968 #define STEREO_DMX_EVS_ISD_INVTHRES_H 1270700383 -#else -#define STEREO_DMX_EVS_ISD_FORGETTING_Q15 31129 -#define STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 11796 -#define STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 14090 -#endif #define STEREO_DMX_EVS_ICCR_FORGETTING_Q31 1503238554 #define STEREO_DMX_EVS_ICCR_HYST_L_Q31 1610612736 @@ -161,11 +155,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ -#else - Word32 itd[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( @@ -208,11 +198,7 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd */ -#else - Word32 itd_fx[], /* o : estimated itd */ -#endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio */ ); @@ -621,20 +607,12 @@ static void calc_poc_fx( Dr = L_add( specLr[i], specRr[i] ); // spec_e Di = L_add( specLi[i], specRi[i] ); // spec_e // if ( ( Nr * Nr + Ni * Ni ) > STEREO_DMX_EVS_ISD_THRES_H * ( Dr * Dr + Di * Di ) ) -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), STEREO_DMX_EVS_ISD_INVTHRES_H ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) -#else - IF( GT_32( Mpy_32_32_r( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), 1270700383 /*1/STEREO_DMX_EVS_ISD_THRES_H in Q31*/ ), L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) -#endif { isd_cnt_h = add( isd_cnt_h, 1 ); } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA W_tmp = W_add( W_mult0_32_32( Mpy_32_32_r( Dr, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Dr ), W_mult0_32_32( Mpy_32_32_r( Di, STEREO_DMX_EVS_ISD_THRES_L_Q31 ), Di ) ); // Q62 IF( LT_64( W_add( W_mult0_32_32( Nr, Nr ), W_mult0_32_32( Ni, Ni ) ), W_tmp ) ) // Q62 -#else - IF( LT_32( L_add( Mpy_32_32_r( Nr, Nr ), Mpy_32_32_r( Ni, Ni ) ), Mpy_32_32_r( STEREO_DMX_EVS_ISD_THRES_L_Q31, L_add( Mpy_32_32_r( Dr, Dr ), Mpy_32_32_r( Di, Di ) ) ) ) ) -#endif { isd_cnt_l = add( isd_cnt_l, 1 ); } @@ -643,19 +621,10 @@ static void calc_poc_fx( isd_rate = BASOP_Util_Divide1616_Scale( isd_cnt_h, freq_8k, &isd_rate_e ); // Saturation to handle values close to 1.0f isd_rate = shl_sat( isd_rate, isd_rate_e ); // Q15 -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->isd_rate_s_fx = L_add( Mpy_32_32_r( STEREO_DMX_EVS_ISD_FORGETTING_Q31, hPHA->isd_rate_s_fx ), L_mult( STEREO_DMX_EVS_ISD_1MFORGETTING_Q15, isd_rate ) ); move32(); -#else - hPHA->isd_rate_s_fx = add( mult_r( STEREO_DMX_EVS_ISD_FORGETTING_Q15, hPHA->isd_rate_s_fx ), mult_r( MAX_16 - STEREO_DMX_EVS_ISD_FORGETTING_Q15, isd_rate ) ); - move16(); -#endif -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q31 ) ) -#else - IF( GT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_H_Q15 ) ) -#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD ) ) { @@ -680,11 +649,7 @@ static void calc_poc_fx( hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; move32(); } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA ELSE IF( LT_32( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q31 ) ) -#else - ELSE IF( LT_16( hPHA->isd_rate_s_fx, STEREO_DMX_EVS_ISD_DIST_HYST_L_Q15 ) ) -#endif { IF( NE_32( hPHA->curr_pha, STEREO_DMX_EVS_PHA_IPD2 ) ) { @@ -752,7 +717,6 @@ static void calc_poc_fx( /* Energy */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA // Left W_tmp = W_add( W_mult0_32_32( specLr[i], specLr[i] ), W_mult0_32_32( specLi[i], specLi[i] ) ); // Q(62-(2*specL_e)) -> Q(63 - ((2*specL_e) +1)) @@ -773,12 +737,6 @@ static void calc_poc_fx( } tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], W_round64_L( W_tmp ), sub( shl( spec_e, 1 ), sub( L_tmp_e, 1 ) ), &tEr_e[n] ); move32(); -#else - tEl[n] = BASOP_Util_Add_Mant32Exp( tEl[n], tEl_e[n], L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &tEl_e[n] ); - move32(); - tEr[n] = BASOP_Util_Add_Mant32Exp( tEr[n], tEr_e[n], L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &tEr_e[n] ); - move32(); -#endif /* IPD */ // IPDr = L_add(Mpy_32_32_r(specLr[i], specRr[i]), Mpy_32_32_r(specLi[i], specRi[i])); //2*spec_e @@ -809,7 +767,6 @@ static void calc_poc_fx( tIPDr = L_sub( Mpy_32_32_r( specRr[i], IPDr ), Mpy_32_32_r( specRi[i], IPDi ) ); // spec_e tIPDi = L_add( Mpy_32_32_r( specRr[i], IPDi ), Mpy_32_32_r( specRi[i], IPDr ) ); // spec_e -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), 0, &Nr_e ); Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), 0, &Ni_e ); @@ -831,13 +788,6 @@ static void calc_poc_fx( W_tmp = W_shl( W_tmp, L_tmp_e ); } eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, W_round64_L( W_tmp ), sub( 1, L_tmp_e ), &eneR_e ); -#else - Nr = BASOP_Util_Add_Mant32Exp( Nr, Nr_e, L_add( Mpy_32_32_r( specLr[i], tIPDr ), Mpy_32_32_r( specLi[i], tIPDi ) ), shl( spec_e, 1 ), &Nr_e ); - Ni = BASOP_Util_Add_Mant32Exp( Ni, Ni_e, L_sub( Mpy_32_32_r( specLi[i], tIPDr ), Mpy_32_32_r( specLr[i], tIPDi ) ), shl( spec_e, 1 ), &Ni_e ); - - eneL = BASOP_Util_Add_Mant32Exp( eneL, eneL_e, L_add( Mpy_32_32_r( specLr[i], specLr[i] ), Mpy_32_32_r( specLi[i], specLi[i] ) ), shl( spec_e, 1 ), &eneL_e ); - eneR = BASOP_Util_Add_Mant32Exp( eneR, eneR_e, L_add( Mpy_32_32_r( specRr[i], specRr[i] ), Mpy_32_32_r( specRi[i], specRi[i] ) ), shl( spec_e, 1 ), &eneR_e ); -#endif } // Pn = (float) inv_sqrt( ( tPr * tPr + tPi * tPi ) + EPSILON ); @@ -857,19 +807,9 @@ static void calc_poc_fx( move32(); // Pn = (float) inv_sqrt( ( Pr[n] * Pr[n] + Pi[n] * Pi[n] ) + EPSILON ); -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Pn = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); Pn = BASOP_Util_Add_Mant32Exp( Pn, 1, EPSILON_FX_M, EPSILON_FX_E, &Pn_e ); Pn = Isqrt_lc( Pn, &Pn_e ); -#else - L_tmp = L_add( L_shr( Mpy_32_32_r( Pr[n], Pr[n] ), 1 ), L_shr( Mpy_32_32_r( Pi[n], Pi[n] ), 1 ) ); - L_tmp_e = 1; - move16(); - L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp_e ); - Pn_e = L_tmp_e; - move16(); - Pn = ISqrt32( L_tmp, &Pn_e ); -#endif Pr[n] = L_shl_sat( Mpy_32_32_r( Pr[n], Pn ), Pn_e ); // Q31 move32(); @@ -1076,17 +1016,7 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA - hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 -#else - -#ifdef FIX_ISSUE_1153 hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 -#else - hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 -#endif - -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA move32(); } @@ -1094,39 +1024,16 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); -#ifndef NONBE_FIX_1386_STEREO_DMX_EVS_PHA -#ifdef FIX_ISSUE_1153 - Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); - IF( shift ) - { - scale_sig32( hPHA->p_curr_taps_fx[n], hPHA->pha_len, 1 ); - shift = 1; - move16(); - } -#endif -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA - energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); -#else -#ifdef FIX_ISSUE_1153 - energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); -#else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); -#endif -#endif // NONBE_FIX_1386_STEREO_DMX_EVS_PHA } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); energy = ISqrt32( energy, &energy_e ); FOR( i = 0; i < hPHA->pha_len; i++ ) { -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), sub( energy_e, 1 ) ); // Q30 -#else - hPHA->p_curr_taps_fx[n][i] = L_shl_r( Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], energy ), energy_e ); // Q31 -#endif move32(); } } @@ -1229,11 +1136,7 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd_fx[], /* o : estimated itd Q0 */ -#else - Word32 itd_fx[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame, /* i : input frame length per channel */ const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) @@ -1545,11 +1448,7 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 itd[], /* o : estimated itd Q0 */ -#else - Word32 itd[], /* o : estimated itd Q16 */ -#endif const Word16 input_frame /* i : input frame length per channel */ ) { @@ -2090,9 +1989,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_prev_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25 } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 -#endif mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); move32(); } @@ -2117,9 +2014,7 @@ void stereo_dmx_evs_enc_fx( // ftmp += p_data_mem[n - m] * p_curr_taps[m]; fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25 } -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA fx_tmp = L_shl( fx_tmp, 1 ); // Q26 -#endif // dmx_pha_data[n] += ftmp * INV_SQRT_2; dmx_pha_data[n] = L_add( dmx_pha_data[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) ); // Q26 move32(); @@ -2149,11 +2044,7 @@ void stereo_dmx_evs_enc_fx( curr_prc = hStereoDmxEVS->hPHA->curr_prc; move32(); // if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA IF( GT_16( abs_s( hStereoDmxEVS->itd_fx ), hStereoDmxEVS->hPHA->prc_thres ) ) -#else - IF( GT_16( abs_s( round_fx( hStereoDmxEVS->itd_fx ) ), hStereoDmxEVS->hPHA->prc_thres ) ) -#endif { IF( NE_32( hStereoDmxEVS->hPHA->curr_prc, STEREO_DMX_EVS_PRC_POC ) ) { @@ -2276,15 +2167,9 @@ ivas_error stereo_dmx_evs_init_encoder_fx( STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS; Word16 n, input_frame; -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA Word16 m, len, pha_len, fad_len, fad_len2, rfft_ipd_coef_step, n0, input_frame_pha; Word32 *fad_g, fad_r, *ipd_ff; Word16 *win; -#else - Word16 m, len, pha_len, fad_len, fad_len2, trans_len /*, itrh*/, rfft_ipd_coef_step, n0, input_frame_pha; - Word32 *fad_g, fad_r /*, a_min, a_max, a_step*/, *ipd_ff; - Word16 *win, tmp_r; -#endif const Word16 *p_ipd_w; Word16 tmp_e; @@ -2516,7 +2401,6 @@ ivas_error stereo_dmx_evs_init_encoder_fx( fad_len = hStereoDmxEVS->hPHA->fad_len; move16(); -#ifdef NONBE_FIX_1386_STEREO_DMX_EVS_PHA set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q14*/, pha_len ); hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; move16(); @@ -2532,21 +2416,6 @@ ivas_error stereo_dmx_evs_init_encoder_fx( hStereoDmxEVS->hPHA->win_fx[sub( pha_len, 1 )] = 2816; /*0.1718f in Q14*/ move16(); } -#else - trans_len = idiv1616( pha_len, 20 ); - set16_fx( hStereoDmxEVS->hPHA->win_fx, 29491 /*1.8f in Q15*/, sub( pha_len, trans_len ) ); - hStereoDmxEVS->hPHA->win_fx[0] = ONE_IN_Q14; - move16(); - // tmp_r = 1.0f / ( ( trans_len * 2 ) + 1 ); - tmp_r = div_s( 1, add( shl( trans_len, 1 ), 1 ) ); - win = &( hStereoDmxEVS->hPHA->win_fx[pha_len - trans_len] ); - FOR( n = 0; n < trans_len; n++ ) - { - // win[n] = ( 0.5f * ( 1.0f + cosf( ( PI2 * ( n + 1 ) ) * tmp_r ) ) ) * 1.8f; - win[n] = mult_r( add( ONE_IN_Q14, getCosWord16R2( imult1616( add( n, 1 ), tmp_r ) ) ), 29491 /*1.8/2 in Q15*/ ); - move16(); - } -#endif fad_g = hStereoDmxEVS->hPHA->fad_g_fx; // fad_r = 1.0f / (float) ( fad_len + 1 ); diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 057798706..8410f7546 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1094,11 +1094,7 @@ static void corrStatsEst_fx( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], 429496730 /* 0.2 in Q31*/ ), hStereoTCA->delay_0_mem_exp, L_mult0( 26214 /* 0.8 in Q15*/, corrLagStats[0] ), Q16, &temp ); /* Q31-temp */ move32(); -#ifdef FIX_USAN_ISSUES Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, L_negate( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ -#else - Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, -hStereoTCA->delay_0_mem_fx[0], hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ -#endif inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 { @@ -1968,22 +1964,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ -#ifndef FIX_1300_ICA_SHIFT_QUANT_IMPROV - IF( temp_exp < 0 ) - { - scalar_value = shl( scalar_value, sub( temp_exp, Q3 ) ); // Q12 - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, ONE_IN_Q11, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ - move16(); - } - ELSE - { - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, shl( 1, sub( 14, temp_exp ) ), ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ - move16(); - } -#else scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ -#endif tempF_fx = tempF_16fx; move32(); @@ -2263,7 +2245,6 @@ static void unclr_calc_corr_features_fx( side_i = BASOP_Util_Add_Mant32Exp( L_shr( buf1[i], 1 ), sub( 31, q_com ), L_negate( L_shr( buf2[i], 1 ) ), sub( 31, q_com ), &exp ); /* Q31-exp */ ener_side = BASOP_Util_Add_Mant32Exp( ener_side, ener_side_exp, Mpy_32_32( side_i, side_i ), shl( exp, 1 ), &ener_side_exp ); /* Q31-ener_side_exp */ -#ifdef FIX_ISSUE_1125 Word16 n1, n2, prod_i_exp; Word32 x, y, prod_i; n1 = norm_l( buf1[i] ); @@ -2273,9 +2254,6 @@ static void unclr_calc_corr_features_fx( prod_i = Mpy_32_32( x, y ); // q: q_com * 2 + n1 + n2 - 31 prod_i_exp = sub( 62, add( shl( q_com, 1 ), add( n1, n2 ) ) ); sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, prod_i, prod_i_exp, &sum_prod_exp ); /* Q31-sum_prod_exp */ -#else - sum_prod = BASOP_Util_Add_Mant32Exp( sum_prod, sum_prod_exp, Mpy_32_32( buf1[i], buf2[i] ), sub( 62, shl( q_com, 1 ) ), &sum_prod_exp ); /* Q31-sum_prod_exp */ -#endif } /* average energy of L and R channels */ diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index ad038f0fa..25e2366dd 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -809,11 +809,7 @@ void stereo_icBWE_enc_ivas_fx( Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e set32_fx( shb_frame_ref_fx, 0, L_LOOK_16k + L_FRAME16k ); -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_ref_fx, shb_frame_ref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#else - Copy_Scale_sig_16_32_DEPREC( hStereoICBWE->mem_shb_speech_ref_fx, shb_frame_ref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#endif hStereoICBWE->mem_shb_speech_ref_e = max_e; shb_frame_ref_e = max_e; move16(); @@ -827,11 +823,7 @@ void stereo_icBWE_enc_ivas_fx( max_e = s_max( hStereoICBWE->mem_shb_speech_nonref_e, shb_speech_nonref_e ); Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e -#ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#else - Copy_Scale_sig_16_32_DEPREC( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e -#endif hStereoICBWE->mem_shb_speech_nonref_e = max_e; shb_frame_nonref_e = max_e; move16(); @@ -1233,9 +1225,7 @@ void stereo_icBWE_preproc_fx( Word32 gD_fx; Word32 input_Fs; -#ifdef MSAN_FIX set16_fx( temp_inp_fx, 0, L_FRAME48k ); -#endif /* initialization */ hStereoTCA = hCPE->hStereoTCA; /* Stereo TCA encoder handle */ diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index b68578542..4255980ad 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -178,10 +178,8 @@ void stereo_mdct_core_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -#ifdef MSAN_FIX set32_fx( mdst_spectrum_long_fx[ch], 0, N_MAX ); set32_fx( orig_spectrum_long_fx[ch], 0, N_MAX ); -#endif p_mdst_spectrum_long_fx[ch] = mdst_spectrum_long_fx[ch]; p_orig_spectrum_long_fx[ch] = orig_spectrum_long_fx[ch]; orig_spectrum_fx[ch][0] = orig_spectrum_long_fx[ch]; @@ -674,11 +672,7 @@ void stereo_mdct_core_enc_fx( q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] ); Scale_sig32( orig_spectrum_fx[ch][n], st->hIGFEnc->infoStopLine, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */ -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#else ProcessIGF_ivas_fx( st, N_MAX, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#endif } } } @@ -719,11 +713,7 @@ void stereo_mdct_core_enc_fx( Scale_sig32( orig_spectrum_fx[ch][n], st->hIGFEnc->infoStopLine, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */ -#ifndef MSAN_FIX - ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#else ProcessIGF_ivas_fx( st, N_MAX, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 ); -#endif } } } diff --git a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c index 851df60d5..6c3588cab 100644 --- a/lib_enc/ivas_stereo_mdct_igf_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_igf_enc_fx.c @@ -166,12 +166,10 @@ static void IGF_MsStereoDecision_fx( Word16 pc_target_e, pc_src_e; Word16 tmp1, tmp1_e, tmp2, tmp2_e; -#ifdef MSAN_FIX pc_target_e = 0; pc_src_e = 0; move16(); move16(); -#endif // MSAN_FIX Word16 coh_src = calcCoh_fx( &specL_fx[strt_cpy], &specR_fx[strt_cpy], q_spec, width, &cc_src_fx, &cc_src_e, &pc_src_fx, &pc_src_e ); Word16 coh_target = calcCoh_fx( &specL_fx[hGrid->swb_offset[sfb]], &specR_fx[hGrid->swb_offset[sfb]], q_spec, width, &cc_target_fx, &cc_target_e, &pc_target_fx, &pc_target_e ); diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 0a526561a..5f1208ba7 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -239,16 +239,12 @@ ivas_error stereo_memory_enc_fx( test(); IF( hCPE->hStereoTCA != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { -#ifdef FIX_1132_STACK_CORRUPTION Word16 tmp = extract_h( L_abs( hCPE->hStereoDft->hItd->itd_fx[1] ) ); if ( hCPE->hStereoDft->hItd->itd_fx[1] < 0 ) { tmp = negate( tmp ); } set16_fx( hCPE->hStereoTCA->prevCorrLagStats, tmp, 3 ); -#else - set16_fx( hCPE->hStereoTCA->prevCorrLagStats, extract_h( hCPE->hStereoDft->hItd->itd_fx[1] ), 3 ); -#endif IF( hCPE->hStereoDft->hItd->itd_fx[1] >= 0 ) { hCPE->hStereoTCA->prevRefChanIndx = L_CH_INDX; @@ -448,10 +444,8 @@ ivas_error stereo_memory_enc_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } /* allocate stereo CNG structure */ @@ -679,10 +673,8 @@ void stereo_switching_enc_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { Copy( sts[n]->input_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl ); /* sts[n]->q_inp */ -#ifdef FIX_ISSUE_1327 hCPE->q_input_mem[n] = sts[n]->q_inp; move16(); -#endif } } diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 44c08efa8..f9b6b0bf3 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -72,13 +72,8 @@ #define RATIO_MAX 1.5f /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ -#ifdef FIX_1301_CORRECT_TD_CNST #define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#else -#define RATIO_MAX_FX_Q24 ( 2516582 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q23 ( 1258291 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#endif #define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ #define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ #define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ @@ -260,11 +255,7 @@ Word16 stereo_tdm_ener_analysis_fx( rms_thd_fx = L_shr( rms_thd_fx, 2 ); /*Q16*/ /*rms_thd_fx *= 0.25f*/ test(); test(); -#ifdef FIX_1301_CORRECT_TD_CNST IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 4915200 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) -#else - IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 75 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) -#endif { rms_thd_fx = L_shr( rms_thd_fx, 5 ); /* Q16*/ /*rms_thd_fx *= 0.03125f*/ } @@ -338,10 +329,8 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } -#ifdef FIX_1301_CORRECT_TD_CNST rms_L_fx = L_shl( rms_L_fx, sub( Q16, q_rms_L ) ); /* All the following energy comparison are done in Q16 */ rms_R_fx = L_shl( rms_R_fx, sub( Q16, q_rms_R ) ); -#endif test(); IF( EQ_16( hStereoTD->prev_fr_LRTD_TD_dec, 1 ) && side_can_change == 0 ) { @@ -440,11 +429,7 @@ Word16 stereo_tdm_ener_analysis_fx( ELSE { /*ratio_L = ( 1.0f - cosf( EVS_PI * ratio_L / 2.0f ) ) / 2.0f;*/ -#ifdef FIX_1301_CORRECT_TD_CNST ratio_L_fx = L_deposit_h( sub_sat( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) -#else - ratio_L_fx = L_deposit_h( sub( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) -#endif } test(); @@ -650,22 +635,14 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } -#ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 -#else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 -#endif move32(); test(); IF( EQ_16( hStereoTD->tdm_SM_modi_flag, 1 ) && hStereoTD->tdm_LRTD_flag == 0 ) { idx = shr( add( hStereoTD->tdm_last_ratio_idx, add( LRTD_STEREO_MID_IS_PRIM, 1 ) ), 1 ); -#ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 -#else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 -#endif move32(); } @@ -756,10 +733,8 @@ Word16 stereo_tdm_ener_analysis_fx( hCPE->hStereoClassif->ratio_L_fx = ratio_L_fx; /* 31 - ratio_L_e */ move32(); -#ifdef FIX_ISSUE_1125 hCPE->hStereoClassif->ratio_L_e = 1; move16(); -#endif return idx; } @@ -1073,11 +1048,7 @@ static void NOOP_decision_fx( } ELSE { -#ifdef FIX_1301_CORRECT_TD_CNST if ( LT_32( sts[0]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) ) -#else - if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) -#endif { tdm_NOOP_switch_flag = 1; move16(); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 378068827..8f1d2d9c9 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -336,10 +336,8 @@ ivas_error stereo_set_tdm_fx( } fd_bwe_enc_init_fx( st->hBWE_FD ); -#ifdef MSAN_FIX st->Q_old_wtda = 0; move16(); -#endif } } diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index eabfe87b4..159012ac2 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -789,7 +789,6 @@ Word16 ivas_acelp_tcx20_switching_fx( L_frame = L_FRAME; move16(); } -#ifdef MSAN_FIX set16_fx( window_fx, 0, L_LOOK_16k ); set16_fx( xn_buf_fx, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); FOR( i = 0; i < L_LOOK_16k; i++ ) @@ -799,7 +798,6 @@ Word16 ivas_acelp_tcx20_switching_fx( window_p_fx[i].v.im = 0; move16(); } -#endif L_frame_tmp = L_frame; move16(); @@ -854,7 +852,6 @@ Word16 ivas_acelp_tcx20_switching_fx( overlap = st->hTcxCfg->tcx_mdct_window_delay; move16(); -#ifdef MSAN_FIX FOR( i = 0; i < st->hTcxCfg->tcx_mdct_window_length / 2; i++ ) { window_fx[st->hTcxCfg->tcx_mdct_window_length - 1 - i] = st->hTcxCfg->tcx_mdct_window[i].v.re; // Q15 @@ -862,15 +859,6 @@ Word16 ivas_acelp_tcx20_switching_fx( window_fx[i] = st->hTcxCfg->tcx_mdct_window[i].v.im; // Q15 move16(); } -#else - FOR( i = 0; i < L_LOOK_16k / 2; i++ ) - { - window_fx[L_LOOK_16k / 2 - 1 - i] = st->hTcxCfg->tcx_mdct_window[i].v.re; // Q15 - move16(); - window_fx[i] = st->hTcxCfg->tcx_mdct_window[i].v.im; // Q15 - move16(); - } -#endif } ELSE { @@ -1047,12 +1035,8 @@ Word16 ivas_acelp_tcx20_switching_fx( IF( LE_32( offset, 0xAA153 ) ) /* 0xAA153 -> 32.f * log2(10)/10 */ { -#ifdef FIX_USAN_ISSUES offset = (Word32) 0xFFD57AB5; /* 0xFFD57AB5 -> -128.f * log2(10)/10; */ move32(); -#else - offset = L_add( 0xFFD57AB5, 0 ); /* 0xFFD57AB5 -> -128.f * log2(10)/10; */ -#endif } offset_tcx = offset; move32(); @@ -1155,11 +1139,7 @@ Word16 ivas_acelp_tcx20_switching_fx( { *pt_ener_sfr = -668739840; /* 0xFFEC1185 -> log2(1e-6) in 6Q25 */ move32(); -#ifdef FIX_USAN_ISSUES tmp32 = (Word32) 0xFFEC1185; /* 0xFFEC1185 -> log2(1e-6) in 15Q16 */ -#else - tmp32 = 0xFFEC1185; /* 0xFFEC1185 -> log2(1e-6) in 15Q16 */ -#endif move32(); } ELSE diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index c959ef758..63cbb30e9 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -221,13 +221,9 @@ void encod_gen_2sbfr( LPD_state_HANDLE hLPDmem = st->hLPDmem; -#ifdef FIX_1320_LOWRATE_ACELP Word16 gcode16; Word32 Lgcode, Ltmp; -#endif -#ifdef MSAN_FIX set16_fx( cn, 0, 2 * L_SUBFR ); /* Target vector in residual domain */ -#endif /*------------------------------------------------------------------* * Initializations @@ -268,11 +264,7 @@ void encod_gen_2sbfr( Copy( &res[i_subfr], &exc[i_subfr], 2 * L_SUBFR ); // Q_new -#ifndef FIX_1320_LOWRATE_ACELP - find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); -#else find_targets_ivas_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); -#endif q_h1 = sub( 14, norm_s( h1[0] ) ); Copy_Scale_sig( h1, h2, 2 * L_SUBFR, sub( 11, q_h1 ) ); @@ -298,21 +290,13 @@ void encod_gen_2sbfr( * Gain clipping test to avoid unstable synthesis on frame erasure *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, Q_new ); // Q0 -#else clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0 -#endif /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ -#ifndef FIX_1320_LOWRATE_ACELP - lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#else lp_filt_exc_enc_ivas_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#endif /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 move16(); @@ -345,22 +329,15 @@ void encod_gen_2sbfr( gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); -#ifndef FIX_1320_LOWRATE_ACELP - hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); -#else Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); /*Q0*/ hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); /* Q15 */ -#endif move16(); /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - hLPDmem->mem_w0 = sub( sub( xn[2 * L_SUBFR - 1], mult_r( gain_pit, y1[2 * L_SUBFR - 1] ) ), mult_r( extract_h( gain_code ), y2[2 * L_SUBFR - 1] ) ); -#else Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ Ltmp = L_negate( Ltmp ); @@ -368,7 +345,6 @@ void encod_gen_2sbfr( Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ -#endif move16(); /*-----------------------------------------------------------------* @@ -376,15 +352,6 @@ void encod_gen_2sbfr( * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - FOR( i = 0; i < 2 * L_SUBFR; i++ ) - { - exc2[i + i_subfr] = mult( gain_pit, exc[i + i_subfr] ); - move16(); - exc[i + i_subfr] = add( exc2[i + i_subfr], mult( extract_h( gain_code ), code[i] ) ); - move16(); - } -#else FOR( i = 0; i < 2 * L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ @@ -397,7 +364,6 @@ void encod_gen_2sbfr( move16(); move16(); } -#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ @@ -411,11 +377,7 @@ void encod_gen_2sbfr( * Synthesize speech to update mem_syn_flt[]. * Update A(z) filters *-----------------------------------------------------------------*/ -#ifndef FIX_1320_LOWRATE_ACELP - E_UTIL_synthesis( 0, p_Aq, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1, M ); -#else Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1 ); -#endif p_Aw += 2 * ( M + 1 ); p_Aq += 2 * ( M + 1 ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 09e3efc84..877fc2045 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1166,11 +1166,7 @@ static ivas_error configureEncoder( test(); test(); test(); -#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH IF( hEncoderConfig->Opt_PCA_ON && !( ( EQ_16( hEncoderConfig->ivas_format, SBA_FORMAT ) || EQ_16( hEncoderConfig->ivas_format, SBA_ISM_FORMAT ) ) && EQ_32( hEncoderConfig->ivas_total_brate, PCA_BRATE ) && EQ_16( hEncoderConfig->sba_order, SBA_FOA_ORDER ) ) ) -#else - if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) -#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "PCA supported at SBA FOA 256 kbps only." ); } diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index 0851e4c17..e59ef07d9 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -923,9 +923,7 @@ void noise_est_fx( NOISE_EST_HANDLE hNoiseEst; SP_MUS_CLAS_HANDLE hSpMusClas; hSpMusClas = st_fx->hSpMusClas; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) ( ncharX ); -#endif /* Check if LR-VAD */ { diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index bcf7d33bb..b19fb7e56 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -80,9 +80,7 @@ Word16 pit_encode_fx( /* o : Fractional pitc Word16 pit_flag, delta, mult_Top, nBits; Word16 L_sufr_sft; Word16 T_op[2]; /* values for two half-frames */ -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING (void) tdm_Pitch_reuse_flag; -#endif L_sufr_sft = 6; move16(); diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 6844945c0..efecb33ed 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -1104,11 +1104,7 @@ void pre_proc_fx( test(); test(); test(); -#ifndef CR_2109_to_2112_cd0_ce0 - IF( ( ( ( st->tcxonly == 0 ) || !( st->core_brate != FRAME_NO_DATA || NE_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE2 ) ) || ( EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE1 ) ) ) -#else IF( ( ( ( st->tcxonly == 0 ) || !( st->core_brate != FRAME_NO_DATA && NE_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE2 ) ) || ( EQ_16( st->L_frame, L_FRAME16k ) && EQ_16( st->codec_mode, MODE1 ) ) ) -#endif { /* update signal buffers */ Copy( new_inp_resamp16k, st->buf_speech_enc + L_FRAME16k, L_FRAME16k ); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 042b5af90..f80373787 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -178,9 +178,7 @@ void dtx_fx( void dtx_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ -#endif const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ const Word16 vad, /* i : vad flag for DTX Q0*/ const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ @@ -1235,9 +1233,7 @@ void AVQ_cod_lpc_fx( void ProcessIGF_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ -#endif Word32 *pMDCTSpectrum, /* i : MDCT spectrum */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -1553,9 +1549,7 @@ void Mode2_pit_encode_fx( Word16 pit_res_max ); void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -#ifdef FIX_ISSUE_1165 void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -#endif void E_ACELP_4t_fx( Word16 dn[], /* Qdn */ @@ -3074,9 +3068,7 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | ); void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ -#endif const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/spec_flatness_fx.c b/lib_enc/spec_flatness_fx.c index c2451886d..d7bd9a6e9 100644 --- a/lib_enc/spec_flatness_fx.c +++ b/lib_enc/spec_flatness_fx.c @@ -221,11 +221,7 @@ void spec_flatness_fx( SFM_Qtmp = sub( SFM_Qtmp, SPEC_AMP_Q ); SFM_Qtmp = sub( SFM_Qtmp, SFM_Q ); -#ifdef FIX_ISSUE_1209 sSFM[1] = add_sat( mult( sSFM[1], 0x6ccc ), shr( mult( SFM, 0x1333 ), SFM_Qtmp ) ); -#else - sSFM[1] = add( mult( sSFM[1], 0x6ccc ), shr( mult( SFM, 0x1333 ), SFM_Qtmp ) ); -#endif move16(); /*sSFM3*/ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index e04f5172b..ff9e2d936 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -890,20 +890,12 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis tmp = div_s( tmp2, tmp1 ); /*Q(15+exp3) */ L_tmp = L_shl( tmp, sub( 1, exp3 ) ); /*Q16 */ -#ifdef FIX_ISSUE_1151 ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ -#else - ps_sta = L_add( ps_sta, L_tmp ); /*Q16 */ -#endif } } /**pFV++ = (float)log(ps_sta + 1e-5f);*/ -#ifdef FIX_ISSUE_1151 ps_sta = L_add_sat( ps_sta, 336 ); -#else - ps_sta = L_add( ps_sta, 336 ); -#endif e_tmp = norm_l( ps_sta ); f_tmp = Log2_norm_lc( L_shl( ps_sta, e_tmp ) ); e_tmp = sub( 30 - 16, e_tmp ); @@ -1617,16 +1609,8 @@ Word16 ivas_smc_gmm_fx( Word16 flag_odv; Word32 lps_fx, lpm_fx, lpn_fx; Word32 ps_fx[N_SMC_MIXTURES], pm_fx[N_SMC_MIXTURES], pn_fx[N_SMC_MIXTURES]; -#ifndef DOT_PROD_CHOLESKY_64BIT - Word32 lprob_fx; - Word16 lprob_exp = 0; -#else Word64 wprob_fx; -#endif Word32 fvm_fx[N_PCA_COEF]; -#ifndef DOT_PROD_CHOLESKY_64BIT - Word16 fvm_exp = 0; -#endif Word32 sum_PS_fx, ps_diff_fx, ps_sta_fx; Word32 dlp_fx, wrelE_fx, wdrop_fx, wght_fx; Word32 wrise_fx; @@ -2213,38 +2197,16 @@ Word16 ivas_smc_gmm_fx( FOR( m = 0; m < N_SMC_MIXTURES; m++ ) { v_sub32_fx( FV_fx, &means_speech_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - fvm_exp = sub( 31, Qfact_FV ); - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_speech_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); v_sub32_fx( FV_fx, &means_music_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); v_sub32_fx( FV_fx, &means_noise_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); -#ifndef DOT_PROD_CHOLESKY_64BIT - lprob_exp = 0; - move16(); - lprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF, fvm_exp, 31 - 28, &lprob_exp ); - pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), L_shl( lprob_fx, sub( Q18 - 1, sub( Q31, lprob_exp ) ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#else wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 -#endif move32(); } @@ -2258,21 +2220,12 @@ Word16 ivas_smc_gmm_fx( *high_lpn_flag = 1; move32(); } -#ifndef FIX_1297_OVERFLOW - hSpMusClas->lpm_fx = extract_l( L_shr( lpm_fx, 11 ) ); // Q7 - move16(); - hSpMusClas->lps_fx = extract_l( L_shr( lps_fx, 11 ) ); // Q7 - move16(); - hSpMusClas->lpn_fx = extract_l( L_shr( lpn_fx, 11 ) ); // Q7 - move16(); -#else hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lps_fx = extract_h( L_shl_sat( lps_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lpn_fx = extract_h( L_shl_sat( lpn_fx, 16 - 11 ) ); // Q7 move16(); -#endif /* determine HQ Generic speech class */ IF( st->hHQ_core != NULL ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 7ca996af5..64ab13ea2 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -701,9 +701,6 @@ typedef struct sp_mus_clas_structure typedef struct lpd_state_structure { -#ifndef MSAN_FIX - Word16 nbits; /* number of bits used by ACELP or TCX */ -#endif /* signal memory */ Word16 syn[1 + M]; /* Synthesis memory (non-pe) */ @@ -1012,9 +1009,7 @@ typedef struct td_bwe_enc_structure typedef struct fd_bwe_enc_structure { Word16 new_input_hp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS )]; // Q_new_input_hp -#ifdef FIX_ISSUE_1230 Word16 Q_new_input_hp; -#endif Word16 old_input_fx[NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS )]; // q0 Word16 old_input_wb_fx[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )]; /* Q(-1) */ Word16 old_input_lp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS )]; // st->hBWE_FD->prev_Q_input_lp diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index e0d846458..26c8382ca 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -307,9 +307,7 @@ void swb_bwe_enc_ivas_fx( move32(); #endif Word16 fb_band_begin; -#ifdef FIX_ISSUE_1230 Word16 q_new_input_hp; -#endif FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; @@ -385,7 +383,6 @@ void swb_bwe_enc_ivas_fx( Copy( old_input_16k_fx + L_INP_MEM + L_FRAME16k - Sample_Delay_LP, hBWE_FD->old_input_lp_fx, Sample_Delay_LP ); } -#ifdef FIX_ISSUE_1230 q_new_input_hp = s_min( Q_shb_speech, hBWE_FD->Q_new_input_hp ); IF( LT_16( Q_shb_speech, hBWE_FD->Q_new_input_hp ) ) { @@ -400,10 +397,6 @@ void swb_bwe_enc_ivas_fx( hBWE_FD->Q_new_input_hp = Q_shb_speech; move16(); -#else - Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP ); - Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP ); -#endif Copy( shb_speech_fx + L_FRAME16k - Sample_Delay_HP, hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); new_input_fx = old_input_fx + Sample_Delay_SWB_BWE; Copy( hBWE_FD->old_input_fx, old_input_fx, Sample_Delay_SWB_BWE ); @@ -513,11 +506,7 @@ void swb_bwe_enc_ivas_fx( { Q_shb = sub( Q_synth_hf, 4 ); } -#ifdef FIX_ISSUE_1230 Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, q_new_input_hp ) ); -#else - Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, Q_shb_speech ) ); -#endif /* FB BWE encoding */ IF( EQ_16( st_fx->extl, FB_BWE ) ) @@ -3229,11 +3218,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); -#ifdef FIX_ISSUE_1156 den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); -#else - den = round_fx( L_shl( WB_tenv_syn_fx, expd ) ); -#endif expd = sub( sub( 30, expd ), sub( shl( Q_insig_lp, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); @@ -4145,17 +4130,11 @@ void fd_bwe_enc_init_fx( ) { set16_fx( hBWE_FD->new_input_hp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ) ); -#ifdef FIX_ISSUE_1230 hBWE_FD->Q_new_input_hp = 0; move16(); -#endif set16_fx( hBWE_FD->old_input_fx, 0, NS2SA( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) ); set16_fx( hBWE_FD->old_input_wb_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ) ); -#ifndef MSAN_FIX - set16_fx( hBWE_FD->old_input_lp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_SWB_TBE_16k_NS ) ); -#else set16_fx( hBWE_FD->old_input_lp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ) ); -#endif set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); hBWE_FD->prev_mode = NORMAL; move16(); diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index b73b0f992..c49c32e03 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1263,11 +1263,7 @@ void swb_pre_proc_ivas_fx( thr = icbwe_thr_TDM_fx; regV = icbwe_regressionValuesTDM_fx; -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, 0, st->cldfbSynTd ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, st->cldfbSynTd ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); *Q_shb_spch = 0; move16(); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 9b4f15dc5..2b8f487bd 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -1391,11 +1391,7 @@ void wb_tbe_enc_ivas_fx( move32(); } -#ifdef FIX_ISSUE_1165 lpc2lsp_ivas_fx( &lpc_wb_32_fx[1], lsp_wb_temp_fx, st_fx->prev_lsp_wb_temp_fx, LPC_SHB_ORDER_WB ); -#else - lpc2lsp_fx( &lpc_wb_32_fx[1], lsp_wb_temp_fx, st_fx->prev_lsp_wb_temp_fx, LPC_SHB_ORDER_WB ); -#endif FOR( i = 0; i < LPC_SHB_ORDER_WB; i++ ) { diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 19afa8243..25a3bdee7 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -536,11 +536,7 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ -#ifdef FIX_ISSUE_1150 g = shr( sub_o( g, 0x1000, &Overflow ), 13 ); -#else - g = shr( sub( g, 0x1000 ), 13 ); -#endif g = s_max( g, -1 ); *gain_index = g; diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index ce7f0e6a6..c84843384 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3785,9 +3785,7 @@ void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) *---------------------------------------------------------------------*/ void ProcessIGF_ivas_fx( Encoder_State *st, /* i : Encoder state */ -#ifdef MSAN_FIX Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ -#endif Word32 *pMDCTSpectrum, /* i : MDCT spectrum (*q_spectrum) */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -3834,11 +3832,7 @@ void ProcessIGF_ivas_fx( IGFSaveSpectrumForITF_ivas_fx( hIGFEnc, igfGridIdx, pITFMDCTSpectrum, sub( Q31, *q_spectrum ) ); -#ifndef MSAN_FIX - IGFEncApplyMono_ivas_fx( st, igfGridIdx, pMDCTSpectrum, sub( Q31, *q_spectrum ), pPowerSpectrum, exp_powerSpec, isTCX20, st->hTcxEnc->fUseTns[frameno], sp_aud_decision0, vad_hover_flag ); -#else IGFEncApplyMono_ivas_fx( st, powerSpec_len, igfGridIdx, pMDCTSpectrum, sub( Q31, *q_spectrum ), pPowerSpectrum, exp_powerSpec, isTCX20, st->hTcxEnc->fUseTns[frameno], sp_aud_decision0, vad_hover_flag ); -#endif curr_order = 0; move16(); diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index cf6e5dd64..05b35813a 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -229,11 +229,7 @@ Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig, assert( n < (Word16) ( sizeof( tmpbuf ) / sizeof( Word16 ) ) ); FOR( i = 0; i < n; i++ ) { -#ifdef FIX_ISSUE_1147 tmpbuf[i] = round_fx_sat( L_shl( pSpectrum[iStartLine + i], shift ) ); -#else - tmpbuf[i] = round_fx( L_shl( pSpectrum[iStartLine + i], shift ) ); -#endif move16(); } diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 44bd8cc3c..92f01b5dd 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -678,18 +678,13 @@ void RunTransientDetection_ivas_fx( IF( GT_16( sub( q_input, pSubblockEnergies->q_firState ), shift ) ) { Scale_sig( input_fx, length, add( sub( pSubblockEnergies->q_firState, q_input ), shift ) ); // q_firState + shift -#ifdef FIX_ISSUE_1186 q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift -#endif pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift move16(); pSubblockEnergies->firState2 = shl( pSubblockEnergies->firState2, shift ); // q_firState + shift move16(); pSubblockEnergies->q_firState = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift move16(); -#ifndef FIX_ISSUE_1186 - q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift -#endif } ELSE { @@ -715,11 +710,7 @@ void RunTransientDetection_ivas_fx( } /* Update subblock energies. */ -#ifdef MSAN_FIX Scale_sig( filteredInput_fx, length, sub( 0, q_input ) ); // q0 -#else - Scale_sig( filteredInput_fx, L_FRAME_MAX, 8 ); -#endif UpdateSubblockEnergies_ivas_fx( filteredInput_fx, length, pSubblockEnergies ); /* Run transient detectors. */ diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 9911d766a..7fe813d12 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -213,11 +213,7 @@ void transition_enc_fx( { /* this is called only to compute unused bits */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, -#else - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, -#endif st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } @@ -329,11 +325,7 @@ void transition_enc_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, -#else - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, -#endif unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* @@ -1042,11 +1034,7 @@ void transition_enc_ivas_fx( { /* this is called only to compute unused bits */ config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, -#else - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, -#endif st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } @@ -1158,11 +1146,7 @@ void transition_enc_ivas_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { config_acelp1( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, -#ifdef NONBE_FIX_GSC_BSTR st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, -#else - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, -#endif unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index be86281ef..fb3a89350 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -72,10 +72,8 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #define INV_TAN30_FX 28377 // Q14 #define EPSILON_MANT 1180591621 /* 1e-12 = 0.5497558*(2^-39) in Q70 */ #define EPSILON_EXP ( -39 ) -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC #define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ #define ONE_DIV_EPSILON_EXP ( 40 ) -#endif #define ADAPT_HTPROTO_ROT_LIM_1 0.8f #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ @@ -135,10 +133,8 @@ static void matrixTransp2Mul_fx( Word32 Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word32 Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_B*/, Word16 *q_B, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx Word32 Ascale, Word32 Bscale, -#endif Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] /*q_out*/, Word16 *q_out ); @@ -813,12 +809,9 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( hDiracDecBin->useTdDecorr ) { -#ifdef FIX_ISSUE_1185 Word32 tmp_arr[60]; -#endif FOR( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { -#ifdef FIX_ISSUE_1185 q_cldfb[ch][slot] = sub( q_input, 1 ); move16(); @@ -836,15 +829,6 @@ static void ivas_dirac_dec_binaural_internal_fx( scale_sig32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, sub( st_ivas->cldfbAnaDec[ch]->p_filter_length, st_ivas->cldfbAnaDec[ch]->no_channels ), sub( q_input, st_ivas->cldfbAnaDec[ch]->Q_cldfb_state ) ); st_ivas->cldfbAnaDec[ch]->Q_cldfb_state = q_input; move16(); -#else - q_cldfb[ch][slot] = q_input; - move16(); - cldfbAnalysis_ts_fx_fixed_q( - &( st_ivas->hTcBuffer->tc_fx[ch][nBins * slot + offsetSamples] ), - Cldfb_RealBuffer_in_fx[ch][slot], - Cldfb_ImagBuffer_in_fx[ch][slot], - nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); -#endif /*FIX_ISSUE_1185*/ test(); test(); @@ -886,10 +870,8 @@ static void ivas_dirac_dec_binaural_internal_fx( { scale_sig32( Cldfb_RealBuffer_in_fx[cha][slot], 60, sub( q_inp, q_cldfb[cha][slot] ) ); // Q6 scale_sig32( Cldfb_ImagBuffer_in_fx[cha][slot], 60, sub( q_inp, q_cldfb[cha][slot] ) ); // Q6 -#ifdef FIX_ISSUE_1185 q_cldfb[cha][slot] = 6; move16(); -#endif } } @@ -1983,10 +1965,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( matrixMul_fx( Mre_fx, Mim_fx, &q_M, CxRe_fx, CxIm_fx, &q_Cx, tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp ); matrixTransp2Mul_fx( tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp, Mre_fx, Mim_fx, &q_M, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif resultMtxRe_fx, resultMtxIm_fx, &q_res ); /* When below the frequency limit where decorrelation is applied, we inject the decorrelated @@ -2151,23 +2131,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( tmp1 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), missingOutputEne_fx, sub( 31, q_missingOutputEne ), &exp1 ); -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT { tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp2 ); tmp2 = ISqrt32( tmp2, &exp2 ); gain_fx = Mpy_32_32( tmp2, Sqrt32( tmp1, &exp1 ) ); q_gain = sub( 31, add( exp2, exp1 ) ); } -#else - { - Word16 exp_temp; - tmp2 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - tmp2 = BASOP_Util_Divide3232_Scale_cadence( tmp1, tmp2, &exp ); - exp2 = add( exp, sub( exp1, exp_temp ) ); - } - gain_fx = Sqrt32( tmp2, &exp2 ); - q_gain = sub( 31, exp2 ); -#endif // 1073741824 = 4 in Q28 @@ -2610,11 +2579,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotRePr_fx = &( outSlotRe_fx[0] ); outSlotImPr_fx = &( outSlotIm_fx[0] ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); move16(); } @@ -3260,7 +3225,6 @@ static void eig2x2_fx( /* Numeric case, when input is practically zeros */ // IF( D_fx[0] < EPSILON_FX ) -#ifdef FIX_1326_SUBSTITUTE_CMPMANT32EXP IF( LT_32( L_shl_sat( D_fx[0], sub( sub( 31, *q_D ), EPSILON_EXP ) ), EPSILON_MANT ) ) { Ure_fx[0][0] = ONE_IN_Q31; @@ -3272,19 +3236,6 @@ static void eig2x2_fx( return; } -#else - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( D_fx[0], *q_D, EPSILON_MANT, EPSILON_EXP ), -1 ) ) - { - Ure_fx[0][0] = ONE_IN_Q31; - move32(); - Ure_fx[1][1] = ONE_IN_Q31; - move32(); - *q_U = Q31; - move16(); - - return; - } -#endif /* Numeric case, when input is near an identity matrix with a gain */ tmp1 = Mpy_32_32( 2147484, add_fx ); // 2147484 = 1e-3f in Q31 @@ -3493,7 +3444,6 @@ static void eig2x2_fx( move16(); } } -#ifdef FIX_1326_SPEEDUP_eig2x2_fx if ( q_U_1 != 0 ) { *q_U = q_U_1; @@ -3505,17 +3455,6 @@ static void eig2x2_fx( *q_U = q_U_2; move16(); } -#else - IF( q_U_1 != 0 ) - { - *q_U = q_U_1; - } - ELSE - { - *q_U = q_U_2; - } - move16(); -#endif return; } @@ -3570,11 +3509,6 @@ static void matrixMul_fx( Word16 chA, chB; Word16 min_q_shift1, min_q_shift2; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND -#ifndef IVAS_ENH64_CADENCE_CHANGES - Word32 tmp1, tmp2; -#endif -#endif min_q_shift1 = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); min_q_shift2 = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); @@ -3603,7 +3537,6 @@ static void matrixMul_fx( outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ) ) ); move32(); #else -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Msub_32_32( Msub_32_32( Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ), Are_fx[chA][1], Bre_fx[1][chB] ), Aim_fx[chA][0], Bim_fx[0][chB] ), @@ -3614,106 +3547,6 @@ static void matrixMul_fx( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ); move32(); -#else - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); - } - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bim_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); - } - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); - } - outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) - { - tmp1 = Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ); - } - ELSE - { - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); - } - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) - { - tmp2 = Mpy_32_32( Are_fx[chA][1], Bim_fx[1][chB] ); - } - ELSE - { - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); - } - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } @@ -3742,15 +3575,11 @@ static void matrixTransp1Mul_fx( { Word16 chA, chB; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND - Word32 tmp1, tmp2; -#endif FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ), Aim_fx[0][chA], Bim_fx[0][chB] ), @@ -3761,74 +3590,6 @@ static void matrixTransp1Mul_fx( Aim_fx[0][chA], Bre_fx[0][chB] ), Aim_fx[1][chA], Bre_fx[1][chB] ); move32(); -#else - test(); - test(); - test(); - IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Are_fx[1][chA], Bre_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - test(); - test(); - test(); - IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Aim_fx[1][chA], Bim_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_sub( tmp1, tmp2 ) ); - move32(); - - test(); - test(); - test(); - IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Aim_fx[1][chA], Bre_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); - outIm_fx[chA][chB] = L_sub( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) - tmp1 = Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); - test(); - test(); - test(); - IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) - tmp2 = Mpy_32_32( Are_fx[1][chA], Bim_fx[1][chB] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif } } *q_out = sub( add( q_A, q_B ), 31 ); @@ -3850,10 +3611,8 @@ static void matrixTransp2Mul_fx( Word32 Bre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word32 Bim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_B*/ Word16 *q_B, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx Word32 Ascale, Word32 Bscale, -#endif Word32 outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word32 outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], /*q_out*/ Word16 *q_out ) @@ -3861,15 +3620,8 @@ static void matrixTransp2Mul_fx( Word16 chA, chB; Word16 min_q_shift; Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ); -#ifndef FIX_1113_OPT_DIRAC_BIN_REND -#ifndef IVAS_ENH64_CADENCE_CHANGES - Word32 tmp1, tmp2; -#endif -#endif -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx IF( Ascale == 1 ) -#endif { min_q_shift = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 ); scale_sig32( Are_fx[0], size, min_q_shift ); @@ -3878,9 +3630,7 @@ static void matrixTransp2Mul_fx( move16(); } -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx IF( Bscale == 1 ) -#endif { min_q_shift = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); scale_sig32( Bre_fx[0], size, min_q_shift ); @@ -3903,7 +3653,6 @@ static void matrixTransp2Mul_fx( outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], W_extract_h( W_mac_32_32( W_mult_32_32( Are_fx[chA][0], L_negate( Bim_fx[chB][0] ) ), Are_fx[chA][1], L_negate( Bim_fx[chB][1] ) ) ) ); move32(); #else -#ifdef FIX_1113_OPT_DIRAC_BIN_REND outRe_fx[chA][chB] = Madd_32_32( Madd_32_32( Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ), Are_fx[chA][1], Bre_fx[chB][1] ), Aim_fx[chA][0], Bim_fx[chB][0] ), @@ -3914,75 +3663,6 @@ static void matrixTransp2Mul_fx( Are_fx[chA][0], Bim_fx[chB][0] ), Are_fx[chA][1], Bim_fx[chB][1] ); move32(); -#else - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) - tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) - tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); - outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Aim_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) - tmp1 = Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Aim_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) - tmp2 = Mpy_32_32( Aim_fx[chA][1], -Bim_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); - outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); - - test(); - test(); - test(); - IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) - tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) - tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); - outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); - move32(); - - test(); - test(); - test(); - IF( ( Are_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Are_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) - tmp1 = Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ); - ELSE - tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); - test(); - test(); - test(); - IF( ( Are_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Are_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) - tmp2 = Mpy_32_32( Are_fx[chA][1], -Bim_fx[chB][1] ); - ELSE - tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); - outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); - move32(); -#endif #endif /* #ifdef IVAS_ENH64_CADENCE_CHANGES */ } } @@ -4057,15 +3737,6 @@ static void chol2x2_fx( } ELSE { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[0][0], &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); - - outIm[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_im, outRe[0][0], &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); -#else Word32 denom; Word16 den_exp; Word32 my_outRe, my_outIm; @@ -4091,7 +3762,6 @@ static void chol2x2_fx( outIm[1][0] = Mpy_32_32( denom, my_outIm ); move32(); q_im = sub( q_im, den_exp ); -#endif } if ( outRe[1][0] == 0 ) { @@ -4110,16 +3780,11 @@ static void chol2x2_fx( // 4611686 = Q62 IF( e1 == 0 ) { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); - q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); -#else Word16 norm = norm_l( temp ); temp = L_shl( temp, norm ); q_tmp = add( q_tmp, norm ); temp = Mpy_32_32( temp, ONE_DIV_EPSILON_MANT ); q_tmp = sub( q_tmp, ONE_DIV_EPSILON_EXP ); -#endif } ELSE { @@ -4168,16 +3833,6 @@ static void chol2x2_fx( // 4611686 = Q62 IF( outRe[1][1] == 0 ) { -#if !defined( FIX_1072_REDUCE_DIVS ) - outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); - - outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, 4611686, &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); - -#else // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); Word32 tmp1 = 1953125005; /* 1/4611686 Q62 */ exp = 9; @@ -4190,19 +3845,9 @@ static void chol2x2_fx( outIm[0][1] = Mpy_32_32( tmp1, -c_im ); move32(); q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); -#endif } ELSE { -#if !defined( FIX_1072_REDUCE_DIVS ) - outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); - move32(); - q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); - - outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, outRe[1][1], &exp ); - move32(); - q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); -#else { // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); Word32 tmp1 = BASOP_Util_Divide3232_Scale_cadence( 0x7FFFFFFF, outRe[1][1], &exp ); @@ -4215,7 +3860,6 @@ static void chol2x2_fx( move32(); q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); } -#endif } if ( outRe[0][1] == 0 ) { @@ -4380,15 +4024,10 @@ static void formulate2x2MixingMatrix_fx( // 4611686 = Q62 IF( maxEne_fx == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC maxEneDiv_fx = ONE_DIV_EPSILON_MANT; move32(); q_maxEneDiv = 31 - ONE_DIV_EPSILON_EXP; move16(); -#else - maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12f in Q62 - q_maxEneDiv = add( sub( 31, exp ), sub( Q30, 62 ) ); -#endif } ELSE { @@ -4448,7 +4087,6 @@ static void formulate2x2MixingMatrix_fx( IF( temp == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC IF( E_out1 == 0 ) { Ghat_fx[0] = 0; @@ -4462,10 +4100,6 @@ static void formulate2x2MixingMatrix_fx( exp = sub( exp, sub( q_eout, 62 ) ); Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp } -#else - temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, 4611686, &exp ); // 4611686 = Q62 - exp = sub( exp, sub( q_eout, 62 ) ); -#endif } ELSE { @@ -4473,20 +4107,14 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp -#endif } -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp -#endif move32(); temp = Mpy_32_32( E_in1, 2147484 ); // 2147484 = 0.001f in Q31 temp = L_max( temp, E_in2 ); // q_ein IF( temp == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC IF( E_out2 == 0 ) { /* We can set hard-coded results */ Ghat_fx[1] = 0; @@ -4499,10 +4127,6 @@ static void formulate2x2MixingMatrix_fx( exp1 = sub( exp1, sub( q_eout, 62 ) ); Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 } -#else - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, 4611686, &exp1 ); // 4611686 = Q62 - exp1 = sub( exp1, sub( q_eout, 62 ) ); -#endif } ELSE { @@ -4510,13 +4134,8 @@ static void formulate2x2MixingMatrix_fx( temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif } -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 -#endif move32(); q_Ghat = sub( 31, s_max( exp, exp1 ) ); @@ -4565,15 +4184,10 @@ static void formulate2x2MixingMatrix_fx( IF( D_fx[0] == 0 ) { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 - exp = sub( exp, sub( Q30, 62 ) ); -#else temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ move32(); exp = ONE_DIV_EPSILON_EXP; move16(); -#endif } ELSE { @@ -4583,7 +4197,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp move32(); -#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT // Sqrt(1) div_fx[1] = L_add( 0, 2047986068 ); // Q = 31 - exp1 exp1 = add( 0, 20 ); @@ -4594,25 +4207,6 @@ static void formulate2x2MixingMatrix_fx( div_fx[1] = ISqrt32( D_fx[1], &exp1 ); move32(); } -#else - IF( D_fx[1] == 0 ) - { -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp1 ); // 4611686 = 1e-12 in Q62 - exp1 = sub( exp1, sub( Q30, 62 ) ); -#else - temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */ - exp1 = ONE_DIV_EPSILON_EXP; -#endif - } - ELSE - { - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[1], &exp1 ); - exp1 = sub( exp1, sub( Q30, q_D ) ); - } - div_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 - move32(); -#endif q_div = sub( 31, s_max( exp, exp1 ) ); div_fx[0] = L_shr( div_fx[0], sub( sub( 31, exp ), q_div ) ); // q_div @@ -4704,10 +4298,8 @@ static void formulate2x2MixingMatrix_fx( } matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */ /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ @@ -4718,7 +4310,6 @@ static void formulate2x2MixingMatrix_fx( { IF( Sx_fx[chB] == 0 ) { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Pre_fx[chA][chB] = Mpy_32_32( Pre_fx[chA][chB], ONE_DIV_EPSILON_MANT ); // q_Pre[chA][chB] = add(sub(31, q_P), 31 - ONE_DIV_EPSILON_EXP); q_Pre[chA][chB] = sub( 62 - ONE_DIV_EPSILON_EXP, q_P ); @@ -4727,26 +4318,12 @@ static void formulate2x2MixingMatrix_fx( Pim_fx[chA][chB] = Mpy_32_32( Pim_fx[chA][chB], ONE_DIV_EPSILON_MANT ); // q_Pim[chA][chB] = add(sub(31, q_P), 31 - ONE_DIV_EPSILON_EXP); q_Pim[chA][chB] = sub( 62 - ONE_DIV_EPSILON_EXP, q_P ); -#else - Pre_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pre_fx[chA][chB], 4611686, &exp ); // 4611686 = 1e-12 in Q62 - q_Pre[chA][chB] = add( sub( q_P, 62 ), sub( 31, exp ) ); - Pim_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pim_fx[chA][chB], 4611686, &exp ); // 4611686 = 1e-12 in Q62 - q_Pim[chA][chB] = add( sub( q_P, 62 ), sub( 31, exp ) ); -#endif } ELSE { -#ifdef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC Word16 Pre_shift, Pim_shift; -#endif temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); -#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC - Pre_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pre_fx[chA][chB], temp, &exp ); - q_Pre[chA][chB] = add( sub( q_P, sub( 31, exp_temp ) ), sub( 31, exp ) ); - Pim_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pim_fx[chA][chB], temp, &exp ); - q_Pim[chA][chB] = add( sub( q_P, sub( 31, exp_temp ) ), sub( 31, exp ) ); -#else temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); Pre_shift = norm_l( Pre_fx[chA][chB] ); Pim_shift = norm_l( Pim_fx[chA][chB] ); @@ -4755,7 +4332,6 @@ static void formulate2x2MixingMatrix_fx( q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); q_Pre[chA][chB] = add( q_temp, Pre_shift ); q_Pim[chA][chB] = add( q_temp, Pim_shift ); -#endif } if ( Pre_fx[chA][chB] == 0 ) { @@ -4858,10 +4434,8 @@ static void formulate2x2MixingMatrix_fx( matrixMul_fx( KyRe_fx, KyIm_fx, &q_ky, Pre_fx, Pim_fx, &q_P, tmpRe_fx, tmpIm_fx, &q_temp ); matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux, -#ifdef FIX_1072_SPEEDUP_matrixTransp2Mul_fx 1 /*int Ascale*/, 0 /*int Bscale*/, -#endif Mre_fx, Mim_fx, q_M ); return; } diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 1ffe0da74..1afac99c4 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -55,12 +55,10 @@ #define DIRAC_DUCK_ALPHA_FX 1717986944 /* Q31 */ #define ONE_M_DIRAC_DUCK_ALPHA 429496736 /* Q31 */ -#ifdef FIX_1110_OPTIM_DIRAC_DECORR_PROC /* Maximal useful q-format, represents range of 2^-126 (float min) */ #define MAX_Q_FX 157 -#endif /*------------------------------------------------------------------------- * Local function prototypes *------------------------------------------------------------------------*/ @@ -590,18 +588,6 @@ void ivas_dirac_dec_decorr_process_fx( Word16 decorr_buff_tot_len = imult1616( imult1616( shl( decorr_buffer_len, 1 ), max_band_decorr ), num_channels ); guarded_bits = 0; -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - FOR( Word16 i = 0; i < decorr_buff_tot_len; i++ ) - { - IF( h_freq_domain_decorr_ap_state->decorr_buffer_fx[i] != 0 ) - { - guarded_bits = s_max( find_guarded_bits_fx( 2 ), 3 ); - } - } - q_shift = sub( getScaleFactor32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ), guarded_bits ); - Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, q_shift ); - q_decorr_buf = add( q_decorr_buf, q_shift ); -#else Flag is_zero = is_zero_arr( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ); if ( is_zero == 0 ) { @@ -617,7 +603,6 @@ void ivas_dirac_dec_decorr_process_fx( q_decorr_buf = add( q_decorr_buf, q_shift ); } } -#endif q_shift = getScaleFactor32( aux_buffer_fx, imult1616( imult1616( 2, num_protos_dir ), max_band_decorr_temp ) ); Word16 buf_len = shl( imult1616( num_protos_dir, max_band_decorr_temp ), 1 ); @@ -681,15 +666,8 @@ void ivas_dirac_dec_decorr_process_fx( /* MA part of filter impulse response */ FOR( l = 0; l < filter_length; l++ ) { -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_ma_fx[2 * l] = Mpy_32_16_1( input_real_fx, filter_coeff_num_real_fx[l] ); // Q_qux -3 = q_deorr - // frame_ma_fx[2 * l] = L_shr(frame_ma_fx[2 * l],3); // scaling to q_decorr_buf - frame_ma_fx[add( shl( l, 1 ), 1 )] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr - // frame_ma_fx[2 * l + 1] = L_shr(frame_ma_fx[2 * l + 1], 3); // scaling to q_decorr_buf -#else frame_ma_fx[2 * l] = Mpy_32_16_1( input_real_fx, filter_coeff_num_real_fx[l] ); // Q_qux -3 = q_deorr frame_ma_fx[2 * l + 1] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr -#endif move32(); move32(); } @@ -705,32 +683,14 @@ void ivas_dirac_dec_decorr_process_fx( filter_frame_real_fx = decorr_buffer_ptr_fx[0]; // q_decorr filter_frame_imag_fx = decorr_buffer_ptr_fx[1]; // q_decorr -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - decorr_buffer_ptr_fx += shl( decorr_buffer_step, 1 ); -#else Word16 decorr_buffer_step2x = shl( decorr_buffer_step, 1 ); decorr_buffer_ptr_fx += decorr_buffer_step2x; move16(); -#endif FOR( l = 1; l < filter_length; l++ ) { // q adjustment needed// -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ); // q_decorr - Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_1 = L_shl( temp_1, 3 ); // q_decorr - decorr_buffer_ptr_fx[0] = L_sub( decorr_buffer_ptr_fx[0], temp_1 ); // q_deocor - decorr_buffer_ptr_fx[1] = L_add( decorr_buffer_ptr_fx[1], frame_ma_fx[add( shl( l, 1 ), 1 )] ); // q_decorr - Word32 temp_2 = Mpy_32_16_1( filter_frame_imag_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_2 = L_shl( temp_2, 3 ); // q_decorr - decorr_buffer_ptr_fx[1] = L_sub( decorr_buffer_ptr_fx[1], temp_2 ); // q_decorr - decorr_buffer_ptr_fx += imult1616( 2, decorr_buffer_step ); - move32(); - move32(); - move32(); -#else Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 temp_1 = L_shl( temp_1, 3 ); // q_decorr decorr_buffer_ptr_fx[0] = L_sub( L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ), temp_1 ); // q_deocor @@ -743,7 +703,6 @@ void ivas_dirac_dec_decorr_process_fx( decorr_buffer_ptr_fx += decorr_buffer_step2x; move16(); -#endif } } } @@ -764,7 +723,6 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // scaling to get max precision for aux_buffer values// -#ifdef MSAN_FIX q_shift = Q31; move16(); offset = shl( max_band_decorr, 1 ); @@ -777,10 +735,6 @@ void ivas_dirac_dec_decorr_process_fx( { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], offset, q_shift ); } -#else - q_shift = L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ); - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); -#endif q_frame_f = add( q_frame_f, q_shift ); @@ -802,24 +756,8 @@ void ivas_dirac_dec_decorr_process_fx( q_direct_energy = q_aux_buffer; move16(); -#ifdef FIX_1110_OPTIM_DIRAC_DECORR_PROC /* Attention: this loop reports norm=0, whenever any data is 0. */ /* Therefore, useful left-shifts are skipped, accuracy is lost. */ -#endif -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - /* calculate the power of the decorrelated signal */ - FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) - { - offset1 = shl( imult1616( ch_idx, num_freq_bands ), 1 ); - offset2 = shl( imult1616( ch_idx, max_band_decorr ), 1 ); - FOR( Word16 i = 0; i < 2 * max_band_decorr; i++ ) - { - aux_64[add( offset2, i )] = W_mult0_32_32( frame_dec_fx[add( offset1, i )], frame_dec_fx[add( offset1, i )] ); - move64(); - norm = s_min( norm, W_norm( aux_64[add( offset2, i )] ) ); - } - } -#else /* calculate the power of the decorrelated signal */ Word64 *m64_aux = aux_64; move32(); @@ -849,7 +787,6 @@ void ivas_dirac_dec_decorr_process_fx( move32(); } norm = W_norm( min64 ); -#endif norm = sub( norm, 1 /*find_guarded_bits_fx( 2 )*/ ); FOR( Word16 i = 0; i < 2 * num_channels * max_band_decorr; i++ ) { @@ -866,34 +803,6 @@ void ivas_dirac_dec_decorr_process_fx( /* smooth energies */ -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - v_multc_fixed( aux_buffer_fx, ONE_M_DIRAC_DUCK_ALPHA, aux_buffer_fx, imult1616( num_channels, max_band_decorr ) ); // q_aux_buffer - - v_multc_fixed( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) ); // same-q - - v_add_fixed_me( aux_buffer_fx, sub( 31, q_aux_buffer ), h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, e_reverb_energy_smooth, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, &e_reverb_energy_smooth, imult1616( num_channels, max_band_decorr ), 0 ); - h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = sub( 31, e_reverb_energy_smooth ); - - v_multc_fixed( direct_energy_fx, ONE_M_DIRAC_DUCK_ALPHA, direct_energy_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q - - v_multc_fixed( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q - - v_add_fixed_me( direct_energy_fx, sub( 31, q_direct_energy ), h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, e_direct_energy_smooth, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, &e_direct_energy_smooth, imult1616( num_protos_dir, max_band_decorr ), 0 ); - h_freq_domain_decorr_ap_state->q_direct_energy_smooth = sub( 31, e_direct_energy_smooth ); - move16(); - - // scaling energy buffers for better precision for higher values// - q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); - 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 ) ); - 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(); -#else Word16 len = imult1616( num_channels, max_band_decorr ); Word16 aux_e = sub( 31, q_aux_buffer ); Word16 max_e = s_max( aux_e, e_reverb_energy_smooth ); @@ -950,13 +859,11 @@ void ivas_dirac_dec_decorr_process_fx( } 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 ); -#endif e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // this step is b/c we are left shifting frame_dec_fx at the end of below for loop/ -#ifdef MSAN_FIX q_shift = Q31; move16(); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -969,10 +876,6 @@ void ivas_dirac_dec_decorr_process_fx( { Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); } -#else - q_shift = sub( L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ), 2 ); - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); -#endif q_frame_f = add( q_frame_f, q_shift ); FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) @@ -1006,13 +909,8 @@ void ivas_dirac_dec_decorr_process_fx( duck_gain = shl( duck_gain, sub( e_duck_gain, 1 ) ); // Q14 -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f - frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 1 ); // q_frame_f -#else frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 1 ); // q_frame_f -#endif move32(); move32(); } @@ -1029,13 +927,8 @@ void ivas_dirac_dec_decorr_process_fx( } */ duck_gain = shl_sat( duck_gain, sub( e_duck_gain, 1 ) ); // Q14 -#ifndef FIX_1110_OPTIM_DIRAC_DECORR_PROC - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 2 ); // q_frame_dec - frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 2 ); // q_frame_dec -#else frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_dec frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 1 ); // q_frame_dec -#endif move32(); move32(); } @@ -1061,27 +954,19 @@ void ivas_dirac_dec_decorr_process_fx( q_shift = sf; move16(); // scaling it to sf -#ifdef MSAN_FIX FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); } -#else - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q -#endif q_frame_f = add( q_frame_f, sf ); } ELSE IF( q_shift < 0 ) { // scaling it to input q -#ifdef MSAN_FIX FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); } -#else - Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q -#endif q_frame_f = q_input_frame; q_if_local = 0; move16(); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index d42340ca1..7d3379ae7 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -1097,7 +1097,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( 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 ) ) { -#ifdef FIX_1072_SPEEDUP_gainpanning /*is there any difference in any bitstream?*/ Word16 temp_q1 = sub( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); FOR( Word16 kk = 0; kk < tmp16; kk++ ) { @@ -1106,17 +1105,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); -#else - 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_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*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 } -#ifdef FIX_1072_SPEEDUP_gainpanning 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++ ) { @@ -1126,11 +1115,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word32 aux; IF( temp_q1 < 0 ) { -#ifdef FIX_USAN_ISSUES Word32 temp_q1_equiv = L_lshl( (Word32) 0x80000000, temp_q1 ); -#else - Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); -#endif FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); @@ -1160,25 +1145,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } -#else - FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, - &h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); /*temp_q*/ - - IF( NE_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) - { - Scale_sig32( aux_buf, num_freq_bands, sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ) ); /*temp_q->(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ - } - - v_add_fixed( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], - num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ - } -#endif /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index cd5c5d281..6eec3ca40 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -778,9 +778,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->frame_dec_f_fx, 2 * num_outputs_diff * num_freq_bands ); -#endif hDirAC_mem->frame_dec_f_len = imult1616( imult1616( 2, num_outputs_diff ), num_freq_bands ); } } @@ -824,12 +822,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; move16(); -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size_ho ); -#else - set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size ); - hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; -#endif IF( NE_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { @@ -881,9 +874,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_protos_dir ), num_freq_bands ); -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len ); -#endif move16(); hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = Q31; move16(); @@ -907,9 +898,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirAC_mem->proto_diffuse_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_outputs_diff ), num_freq_bands ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->proto_diffuse_buffer_f_fx, hDirAC_mem->proto_diffuse_buffer_f_len ); -#endif } } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx = hDirAC_mem->proto_direct_buffer_f_fx; @@ -983,9 +972,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->onset_filter_fx, imult1616( num_outputs_diff, num_freq_bands ) ); -#endif } } } @@ -1007,9 +994,7 @@ ivas_error ivas_dirac_alloc_mem_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef MSAN_FIX set_zero_fx( hDirAC_mem->onset_filter_fx, imult1616( 2, num_freq_bands ) ); -#endif } } @@ -1803,11 +1788,7 @@ void protoSignalComputation2_fx( 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 ); -#ifdef MSAN_FIX 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 ) ) ); -#else - q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ), L_norm_arr( ImagBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ) ); -#endif // MSAN_FIX temp_q_shift = s_min( temp_q_shift, q_shift ); } @@ -3160,13 +3141,8 @@ void ivas_dirac_dec_compute_diffuse_proto_fx( Word16 new_diff_e = s_max( diff_e, old_diff_e ); Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx, diffuse_start, sub( old_diff_e, new_diff_e ) ); // 31-new_diff_e -#ifdef MSAN_FIX Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, i_mult( shl( num_freq_bands_diff, 1 ), hDirACRend->hOutSetup.nchan_out_woLFE ), sub( diff_e, new_diff_e ) ); // 31-new_diff_e -#else - Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, - sub( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_len, diffuse_start ), sub( diff_e, new_diff_e ) ); -#endif h_dirac_output_synthesis_state->proto_diffuse_buffer_f_q = sub( 31, new_diff_e ); move16(); @@ -3357,10 +3333,8 @@ void ivas_masa_init_stereotype_detection_fx( move16(); stereo_type_detect->target_power_y_smooth_fx = 0; move32(); -#ifdef MSAN_FIX stereo_type_detect->q_target_power_y_smooth = 31; move16(); -#endif stereo_type_detect->lr_total_bb_ratio_db_fx = 0; move32(); @@ -4875,11 +4849,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // q_cldfb } Word16 out_size = imult1616( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, 0, hMasaExtRend->cldfbSynRend[idx_in] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, hMasaExtRend->cldfbSynRend[idx_in] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ scale_sig32( &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, sub( 11, q_out ) ); // q11 idx_in++; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index f3b4d1755..d5df77045 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -754,10 +754,8 @@ void ivas_mcmasa_param_est_ana_fx( computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ) -#ifdef NONBE_IMPROVE_DIRAC_INTENSITY_PREC , NULL -#endif ); /* Q direction_vector_fx = Q30*/ /* Power and intensity estimation for diffuseness */ diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index 01e35efe1..30bf8f00a 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -393,9 +393,7 @@ static void GenerateITD_fx( Word16 num_az_idx, num_ev_idx; Word16 BM_idx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; Word16 itdMod_e; -#ifdef MSAN_FIX set16_fx( AzIdx, 0, HRTF_MODEL_BSPLINE_NUM_COEFFS ); -#endif // MSAN_FIX /* Wrap the requested azimuth to the range of the BSplines */ azim_fx = L_add( azim_fx, model->azimKSeq_fx[0] ); diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index 5787ded3f..7e35b80b2 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -573,10 +573,8 @@ static void TDREND_SRC_SPATIAL_Init_fx( TDREND_SPATIAL_VecInit_fx( SrcSpatial_p->Front_p_fx + nC * 3, 0, 0, ONE_IN_Q30 ); /*Assuming Q30*/ } -#ifdef MSAN_FIX SrcSpatial_p->q_Pos_p = Q31; move16(); -#endif /* Source directional attenuation */ SrcSpatial_p->DirAttenEnabled = FALSE; // Q0 diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 8beb5a0ec..3b01f62ca 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -1,9 +1,7 @@ #include "ivas_prot_fx.h" #include "ivas_prot_rend_fx.h" -#ifdef FIX_DISCLAIMER #include -#endif Word16 ivas_get_nchan_buffers_dec_ivas_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -161,7 +159,6 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( return nchan_out_buff; } -#ifdef FIX_DISCLAIMER /*---------------------------------------------------------------------* * get_channel_config() * @@ -272,4 +269,3 @@ ivas_error get_channel_config( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index a5ee232df..983c814aa 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -81,12 +81,10 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( const Word32 ivas_total_brate /* i : total IVAS bitrate */ ); -#ifdef FIX_DISCLAIMER ivas_error get_channel_config( const AUDIO_CONFIG config, /* i : audio configuration */ Word8 *str /* o : string with the configuration name */ ); -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 870f8795d..9b149940c 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1529,9 +1529,7 @@ ivas_error ivas_reverb_open_fx( params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter; params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0]; params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0]; -#ifdef MSAN_FIX set32_fx( pState->fft_filter_color_1.fft_spectrum_fx, 0, RV_FILTER_MAX_FFT_SIZE ); -#endif /* Note: these temp buffers can only be used before the final step of the FFT filter design : */ /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */ @@ -1647,18 +1645,11 @@ ivas_error ivas_reverb_open_fx( IF( pState->do_corr_filter ) { /* Computing correlation filters on the basis of target IA coherence */ -#ifdef MSAN_FIX FOR( i = 0; i < shl( sub( nr_fc_fft_filter, 1 ), 1 ); i++ ) { pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ move32(); } -#else - FOR( i = 0; i < RV_FILTER_MAX_FFT_SIZE; i++ ) - { - pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ - } -#endif // MSAN_FIX Word32 *pHrtf_inter_aural_coherence_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 ) ); FOR( i = 0; i < nr_fc_fft_filter; i++ ) diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index aebb80a54..e6f8f2653 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -2271,12 +2271,10 @@ void SHrotmatgen_fx( Word16 R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; -#ifdef MSAN_FIX FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { set16_fx( R_lm1[i], 0, HEADROT_SHMAT_DIM ); } -#endif Word16 R_l[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; Word32 result; SHrotmat[0][0] = ONE_IN_Q14; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 378ae7aad..0515e4038 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -683,11 +683,7 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx Word32 ***filterStatesLeftReal_fx; Word32 ***filterStatesLeftImag_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStatesLeft; -#else /* OPT_BASOP_ADD_v1 */ - Word16 ***Q_filterStatesLeft; -#endif /* OPT_BASOP_ADD_v1 */ Word16 numTapsArray[BINAURAL_CONVBANDS]; Word16 numTaps; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 31110fe26..a25037153 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8557,7 +8557,6 @@ static void intermidiate_ext_dirac_render( } } -#ifdef FIX_DISCLAIMER static ivas_error printConfigInfo_rend( IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ ) @@ -8650,4 +8649,3 @@ void IVAS_REND_PrintDisclaimer( void ) return; } -#endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 0a489600a..e837daa4f 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -324,7 +324,6 @@ void IVAS_REND_Close( ); -#ifdef FIX_DISCLAIMER /* Disclaimer and info printing */ void IVAS_REND_PrintInputConfig( @@ -338,7 +337,6 @@ ivas_error IVAS_REND_PrintConfig( void IVAS_REND_PrintDisclaimer( void ); -#endif /* clang-format on */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index e667dcfe5..c2e3d8a2a 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1201,11 +1201,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); -#ifdef MSAN_FIX floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); -#else - floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); -#endif } } } -- GitLab From 85432c38684fba09d6e9b7978a71e3f0bb3ae957 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 16:13:40 +0530 Subject: [PATCH 236/358] Clang formatting --- lib_com/bits_alloc_fx.c | 96 ++++++------ lib_com/cldfb.c | 8 +- lib_com/gs_inact_switching_fx.c | 22 +-- lib_com/ivas_dirac_com_fx.c | 3 +- lib_com/ivas_prot_fx.h | 3 +- lib_com/ivas_qmetadata_com_fx.c | 2 - lib_com/prot_fx.h | 130 ++++++++-------- lib_com/swb_bwe_com_fx.c | 4 +- lib_com/tools_fx.c | 50 +++--- lib_dec/FEC_HQ_phase_ecu_fx.c | 8 +- lib_dec/acelp_core_dec_ivas_fx.c | 38 ++--- lib_dec/fd_cng_dec_fx.c | 4 +- lib_dec/ivas_binRenderer_internal_fx.c | 3 - lib_dec/ivas_core_dec_fx.c | 10 +- lib_dec/ivas_mdct_core_dec_fx.c | 10 +- lib_dec/ivas_spar_decoder_fx.c | 2 +- lib_dec/ivas_stat_dec.h | 2 +- lib_dec/ivas_stereo_icbwe_dec_fx.c | 10 +- lib_dec/ivas_svd_dec_fx.c | 145 +++++++++--------- lib_enc/acelp_core_enc_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 1 - lib_enc/core_enc_init_fx.c | 4 +- lib_enc/dtx_fx.c | 10 +- lib_enc/enc_acelpx_fx.c | 2 +- lib_enc/hq_core_enc_fx.c | 4 +- lib_enc/igf_enc.c | 4 +- lib_enc/ivas_core_pre_proc_front_fx.c | 14 +- lib_enc/ivas_dirac_enc_fx.c | 21 +-- lib_enc/ivas_mcmasa_enc_fx.c | 6 +- lib_enc/ivas_mdct_core_enc_fx.c | 12 +- lib_enc/ivas_omasa_enc_fx.c | 6 +- lib_enc/ivas_stat_enc.h | 2 +- lib_enc/ivas_stereo_dmx_evs_fx.c | 20 +-- lib_enc/ivas_stereo_ica_enc_fx.c | 8 +- lib_enc/ivas_stereo_icbwe_enc_fx.c | 2 +- lib_enc/ivas_stereo_td_analysis_fx.c | 14 +- lib_enc/ivas_td_low_rate_enc_fx.c | 4 +- lib_enc/prot_fx_enc.h | 18 +-- lib_enc/speech_music_classif_fx.c | 12 +- lib_enc/tcx_utils_enc_fx.c | 4 +- lib_enc/transient_detection_fx.c | 4 +- .../ivas_dirac_dec_binaural_functions_fx.c | 6 +- lib_rend/ivas_mcmasa_ana_fx.c | 6 +- 43 files changed, 355 insertions(+), 381 deletions(-) diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index cb71f0f28..8162a98d3 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -762,31 +762,31 @@ static ivas_error acelp_FCB_allocator_ivas( *--------------------------------------------------------------------*/ ivas_error config_acelp1( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signalling_bits, /* i : number of signalling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signalling_bits, /* i : number of signalling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, bits, nb_subfr; @@ -1887,31 +1887,31 @@ ivas_error config_acelp1( *--------------------------------------------------------------------*/ ivas_error config_acelp1_IVAS( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signaling_bits, /* i : number of signaling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signaling_bits, /* i : number of signaling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, bits, nb_subfr; diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 408580169..845ec1f11 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1097,10 +1097,10 @@ void cldfbAnalysis_ts_fx_fixed_q( * Conduct inverse multple overlap cmplex low delay MDCT *--------------------------------------------------------------------*/ void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ const Word16 shift, /* i : scale for state buffer */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index 421b2a705..54fef9e37 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -158,18 +158,18 @@ void Inac_swtch_ematch_fx( void Inac_switch_ematch_ivas_fx( - Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ - Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ - const Word16 coder_type, /* i : Coding mode */ + Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ + Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ + const Word16 coder_type, /* i : Coding mode */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 L_frame, /* i : Frame lenght */ - const Word16 Q_exc, /* i : input and output format of exc2 */ - const Word16 bfi, /* i : frame lost indicator */ - const Word16 last_core, /* i : Last core used */ - const Word16 last_codec_mode, /* i : Last codec mode */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const Word16 element_mode /* i : element mode */ + const Word16 L_frame, /* i : Frame lenght */ + const Word16 Q_exc, /* i : input and output format of exc2 */ + const Word16 bfi, /* i : frame lost indicator */ + const Word16 last_core, /* i : Last core used */ + const Word16 last_codec_mode, /* i : Last codec mode */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const Word16 element_mode /* i : element mode */ ) { Word16 Ener_per_bd[MBANDS_GN16k]; diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 7d481d181..b16b94f1d 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -610,8 +610,7 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_z, /* o: Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ , - Word16 *i_e_band -) + Word16 *i_e_band ) { Word16 i; Word32 intensityNorm; diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index fab166b6d..246f4d297 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3237,8 +3237,7 @@ void computeDirectionVectors_fixed( Word32 *direction_vector_z, /*Q30*/ Word16 i_e /*Exponent of all the intensity buffers*/ , - Word16 *i_e_band -); + Word16 *i_e_band ); UWord8 ivas_masa_surrcoh_signicant_fx( diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c index ee11f2b02..a5fbf9e83 100644 --- a/lib_com/ivas_qmetadata_com_fx.c +++ b/lib_com/ivas_qmetadata_com_fx.c @@ -446,8 +446,6 @@ ivas_error only_reduce_bits_direction_fx( } } } - - } *reduce_bits_out = negate( reduce_bits ); diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 71c1590c2..d7ed9a140 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4851,31 +4851,31 @@ Word16 BITS_ALLOC_config_acelp( const Word16 nb_subfr ); ivas_error config_acelp1( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signalling_bits, /* i : number of signalling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signalling_bits, /* i : number of signalling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); Word16 set_ACELP_flag( @@ -5846,18 +5846,18 @@ void Inac_swtch_ematch_fx( ); void Inac_switch_ematch_ivas_fx( - Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ - Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ - const Word16 coder_type, /* i : Coding mode */ + Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/ + Word16 dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + Word16 lt_ener_per_band[], /* i/o: Long term energy per band Q12 */ + const Word16 coder_type, /* i : Coding mode */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 L_frame, /* i : Frame lenght */ - const Word16 Q_exc, /* i : input and output format of exc2 */ - const Word16 bfi, /* i : frame lost indicator */ - const Word16 last_core, /* i : Last core used */ - const Word16 last_codec_mode, /* i : Last codec mode */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const Word16 element_mode /* i : element mode */ + const Word16 L_frame, /* i : Frame lenght */ + const Word16 Q_exc, /* i : input and output format of exc2 */ + const Word16 bfi, /* i : frame lost indicator */ + const Word16 last_core, /* i : Last core used */ + const Word16 last_codec_mode, /* i : Last codec mode */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const Word16 element_mode /* i : element mode */ ); // igf_base_fx.c @@ -9740,10 +9740,10 @@ void cldfbAnalysis_ivas_fx( ); void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ const Word16 shift, /* i : scale for state buffer */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); @@ -10973,31 +10973,31 @@ void lsf_syn_mem_backup_ivas_fx( Word16 *pstreaklen ); ivas_error config_acelp1_IVAS( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 core_brate_inp, /* i : core bitrate */ - const Word16 core, /* i : core */ - const Word16 extl, /* i : extension layer */ - const Word32 extl_brate, /* i : extension layer bitrate */ - const Word16 L_frame, /* i : frame length at internal Fs */ - const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const Word16 signaling_bits, /* i : number of signaling bits */ - const Word16 coder_type, /* i : coder type */ + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 total_brate, /* i : total bitrate */ + const Word32 core_brate_inp, /* i : core bitrate */ + const Word16 core, /* i : core */ + const Word16 extl, /* i : extension layer */ + const Word32 extl_brate, /* i : extension layer bitrate */ + const Word16 L_frame, /* i : frame length at internal Fs */ + const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const Word16 signaling_bits, /* i : number of signaling bits */ + const Word16 coder_type, /* i : coder type */ const Word16 inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const Word16 tc_subfr, /* i : TC subfr ID */ - const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - Word16 *unbits, /* o : number of unused bits */ - const Word16 element_mode, /* i : element mode */ - Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const Word16 idchan, /* i : stereo channel ID */ - const Word16 active_cnt, /* i : Active frame counter */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tc_subfr, /* i : TC subfr ID */ + const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + Word16 *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + Word16 *unbits, /* o : number of unused bits */ + const Word16 element_mode, /* i : element mode */ + Word16 *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const Word16 idchan, /* i : stereo channel ID */ + const Word16 active_cnt, /* i : Active frame counter */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); ivas_error push_next_indice( @@ -11051,8 +11051,8 @@ void calculate_hangover_attenuation_gain_ivas_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void core_coder_reconfig_ivas_fx( diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 228d43247..11da78c46 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2534,7 +2534,7 @@ void hq_generic_decoding_fx( { exp = norm_l( L_tmp ); frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ - tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ + tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ fenvL_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /*Q1 */ @@ -3082,7 +3082,7 @@ void hq_generic_decoding_ivas_fx( { exp = norm_l( L_tmp ); frac = round_fx_sat( L_shl( L_tmp, exp ) ); /*cs+exp-16 */ - tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ + tmp = div_s( 16384, frac ); /*15 + 14 - (cs+exp-16) */ exp = sub( add( cs, exp ), 30 ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /*Q31 - exp */ fenvL_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /*Q1 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index d403c583d..5219d076c 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -487,13 +487,13 @@ void Copy( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move16(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move16(); + } - return; + return; } /*-------------------------------------------------------------------* * Copy64: @@ -519,13 +519,13 @@ void Copy64( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move64(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move64(); + } - return; + return; } void set64_fx( @@ -566,15 +566,15 @@ void Copy_pword( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i].v.im = x[i].v.im; - y[i].v.re = x[i].v.re; - move16(); - move16(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i].v.im = x[i].v.im; + y[i].v.re = x[i].v.re; + move16(); + move16(); + } - return; + return; } /*-------------------------------------------------------------------* * Copy32: @@ -599,11 +599,11 @@ void Copy32( return; } - FOR( i = L - 1; i >= 0; i-- ) - { - y[i] = x[i]; - move32(); - } + FOR( i = L - 1; i >= 0; i-- ) + { + y[i] = x[i]; + move32(); + } } void set8_fx( diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 74f1bfc09..b8c16474e 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1590,7 +1590,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( *pPlocs ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1601,7 +1601,7 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && EQ_16( *pPlocs, 1 ) ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[*pPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( *pPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1647,7 +1647,7 @@ static void ivas_spec_ana_fx( IF( EQ_16( currPlocs, ( sub( Lprot2_1, DELTA_CORR_F0_INT ) ) ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ { - Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 1], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( currPlocs, 1 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); @@ -1661,7 +1661,7 @@ static void ivas_spec_ana_fx( * whould point */ IF( n > 0 ) /* fs/2 which makes special case . */ { - Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 + Copy_Scale_sig_16_32_no_sat( &xfp[currPlocs - 2], xfp_32, 3, Q15 ); // Q + 15 acc = L_deposit_h( sub( currPlocs, 2 ) ); // Q16 *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 5807f2c67..ea82f09de 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -77,21 +77,21 @@ ivas_error acelp_core_dec_ivas_fx( { Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/; - Word16 old_exc_fx[L_EXC_DEC], *exc_fx; /* excitation signal buffer */ - Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx; /* synthesis signal buffer */ - Word16 output_frame; /* frame length at output sampling freq. */ - Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ - Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ - Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ - Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ - Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ - Word32 enr_q_fx; /* E information for FER protection */ - Word16 tmp_noise_fx; /* Long term temporary noise energy */ - Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ - Word16 FEC_pitch_fx; /* FEC pitch */ + Word16 old_exc_fx[L_EXC_DEC], *exc_fx; /* excitation signal buffer */ + Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx; /* synthesis signal buffer */ + Word16 output_frame; /* frame length at output sampling freq. */ + Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ + Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ + Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ + Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ + Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ + Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ + Word32 enr_q_fx; /* E information for FER protection */ + Word16 tmp_noise_fx; /* Long term temporary noise energy */ + Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ + Word16 FEC_pitch_fx; /* FEC pitch */ Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ - Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ + Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ Word16 i, j, int_fs; Word16 tc_subfr; Word16 allow_cn_step; @@ -1810,7 +1810,7 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) + scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); @@ -1892,13 +1892,13 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) + scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn ); - scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 + scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); @@ -1988,12 +1988,12 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) + scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn ); - Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 + Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index df18d3dba..c1289b8a3 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -5270,7 +5270,7 @@ void generate_stereo_masking_noise_fx( { hFdCngCom = st->hFdCngDec->hFdCngCom; Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, Ns_fx, shr( hFdCngCom->frameSize, 1 ), sub( Q6, st->Q_syn ) ); /*Q6*/ - Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ + Copy32( hFdCngCom->olapBufferSynth2_fx, Np_fx, shr( hFdCngCom->frameSize, 1 ) ); /*st->Q_syn*/ set32_fx( &Np_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); set32_fx( &Ns_fx[( hFdCngCom->frameSize / 2 )], 0, shr( hFdCngCom->frameSize, 1 ) ); @@ -5278,7 +5278,7 @@ void generate_stereo_masking_noise_fx( IF( !fadeOut ) { Copy_Scale_sig_16_32_no_sat( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, sub( Q15, st->Q_syn ) ); /*Q15*/ - generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 + generate_masking_noise_ivas_fx( N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); // N1_fx Q6 /* Generate masking noise for secondary channel */ IF( flag_sec_CNA ) { diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index f78f14e8e..c05b8beb2 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -339,7 +339,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - } } /* set memories */ @@ -1264,7 +1263,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; - } free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); @@ -1272,7 +1270,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; - } free( hBinRenConvModule->filterStatesLeftReal_fx ); diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 4e654030b..588640d0a 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -524,7 +524,7 @@ ivas_error ivas_core_dec_fx( } Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11 - Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 + Scale_sig( output_16_fx[n], L_FRAME48k, negate( st->Q_syn2 ) ); // Q0 IF( st->cldfbAna ) { scale_sig32( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, Q10 - Q11 ); /* 9 * (Word16)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f) , Q10 */ @@ -630,8 +630,8 @@ ivas_error ivas_core_dec_fx( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_output ) ); // Q11 - Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 - Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 + Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 + Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 } /*---------------------------------------------------------------------* @@ -1147,8 +1147,8 @@ ivas_error ivas_core_dec_fx( q = 2; move16(); - Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 - Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 + Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -( Q11 ) ); // Q0 + Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, output_frame, negate( add( Q11, q ) ) ); // Q0 Scale_sig( hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, hBWE_TD->prev_Q_bwe_syn ) ); // Q8 Copy_Scale_sig_32_16( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, ( 2 * ALLPASSSECTIONS_STEEP ), sub( hBWE_TD->prev_Q_bwe_syn2, Q11 ) ); // prev_Q_bew_syn2 diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 71839557a..7d5f7d737 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1172,13 +1172,13 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_syn_Overl_TDAC ) ); // st->hTcxDec->Q_syn_Overl_TDAC -> q_win Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_old_syn_Overl ) ); // Q(-1 - st->Q_syn) -> q_win st->hTcxDec->Q_old_syn_Overl = q_win; - Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win - Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win - Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win - Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win + Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win + Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win - Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win + Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win FOR( k = 0; k < nSubframes[ch]; k++ ) { init_tcx_info_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], k, bfi, &tcx_offset[ch], diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index c3e2ad096..a7b66ff87 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -1352,7 +1352,7 @@ static void ivas_spar_calc_smooth_facs_fx( smooth_long_avg_fx[b] = L_add( smooth_long_avg_fx[b], smooth_buf_fx[b][i] ); // Q0 move32(); } - smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 + smooth_short_avg_fx[b] = Mpy_32_32( smooth_short_avg_fx[b], 357913941 /*(1/6 in Q31)*/ ); // Q0 move32(); smooth_long_avg_fx[b] = Mpy_32_32( smooth_long_avg_fx[b], 107374182 /*(1/20 in Q31)*/ ); // Q0 move32(); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 429a99ca4..891be05be 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -961,7 +961,7 @@ typedef struct decoder_tc_buffer_structure Word32 *tc_buffer_fx; /* the buffer itself */ Word16 tc_buff_len; /*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV - Word16 no_channels; /*Stores no of channels in tc_fx with values*/ + Word16 no_channels; /*Stores no of channels in tc_fx with values*/ Word16 q_tc_fx; TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ Word16 nchan_transport_jbm; /* number of TCs after TC decoding */ diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 1c2ecffaf..c9f7cac92 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -718,8 +718,8 @@ void stereo_icBWE_dec_fx( IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) { temp1_fx = 0; @@ -813,7 +813,7 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prev_Q_fsout = tmp; move16(); } - Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ + Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ *Q_syn = sub( *Q_syn, 1 ); @@ -877,8 +877,8 @@ void stereo_icBWE_dec_fx( IF( LE_16( ratio_L_fx, 29490 /* 0.9 in Q15*/ ) ) { tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 IF( LT_16( tmp, 4096 /* 0.5 in Q13*/ ) ) { temp1_fx = 0; diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index dd9859504..8a9224ffa 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -294,7 +294,6 @@ Word16 svd_fx( push_wmops( "svd_fx" ); - /* Collecting Values */ FOR( iCh = 0; iCh < nChannelsL; iCh++ ) { @@ -385,11 +384,11 @@ static Word16 BidagonalDiagonalisation_fx( Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) singularValues_fx_e*/ Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: secDiag_fx_e*/ Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ - Word16 *secDiag_new_e, /* i/o: */ - const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ - const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ - const Word32 eps_x, /* i : eps_x_e*/ - const Word16 eps_x_e /* i : */ + Word16 *secDiag_new_e, /* i/o: */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ + const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed Q0*/ + const Word32 eps_x, /* i : eps_x_e*/ + const Word16 eps_x_e /* i : */ ) { Word16 kCh, nCh, iCh, jCh, split; @@ -898,52 +897,52 @@ static void biDiagonalReductionLeft_fx( secDiag_e[currChannel] = *sig_x_e; move16(); -/* Setting values to 0 */ -( *sig_x ) = 0; -move32(); -( *g ) = 0; -move32(); - -IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ -{ - idx = currChannel; - move16(); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ - } + /* Setting values to 0 */ + ( *sig_x ) = 0; + move32(); + ( *g ) = 0; + move32(); - IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ { - Word16 invVal_e; - Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); - norm_x = 0; - move32(); - norm_x_e = 0; + idx = currChannel; move16(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { + ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ + } + + IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + { + Word16 invVal_e; + Word32 invVal; + invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); + norm_x = 0; + move32(); + norm_x_e = 0; + move16(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); move16(); 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) */ - } - IF( GT_16( norm_x_e, 0 ) ) - { - norm_x = MAX_32; - move32(); - norm_x_e = 0; + } + IF( GT_16( norm_x_e, 0 ) ) + { + norm_x = MAX_32; + move32(); + norm_x_e = 0; + move16(); + } + L_temp_e = norm_x_e; move16(); - } - L_temp_e = norm_x_e; - move16(); - L_temp = Sqrt32( norm_x, &L_temp_e ); - L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 - //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); + L_temp = Sqrt32( norm_x, &L_temp_e ); + L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 + //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); if ( singularVectors[currChannel][idx] >= 0 ) { L_temp = L_negate( L_temp ); @@ -951,52 +950,51 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ ( *g ) = L_temp; move32(); - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ - move32(); + r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ + singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ + move32(); - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); - FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ - { - norm_x = 0; - move32(); - norm_x_e = 0; - move16(); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { + 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) */ - } + } - f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */ + 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 ) ); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] ); - move32(); + move32(); + } } - } - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ - move32(); + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ + move32(); singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e ); - move16(); + move16(); + } } + // rescaling block + singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */ + move32(); + singularValues_e[currChannel] = *sig_x_e; + move16(); } - // rescaling block - singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */ - move32(); - singularValues_e[currChannel] = *sig_x_e; - move16(); -} - -return; + return; } /*------------------------------------------------------------------------- @@ -1108,7 +1106,7 @@ static void biDiagonalReductionRight_fx( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { - singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ + singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ move32(); } } @@ -1120,9 +1118,6 @@ static void biDiagonalReductionRight_fx( singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); move16(); } - - - } } @@ -1230,7 +1225,7 @@ static void singularVectorsAccumulationLeft_fx( { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { - singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ + singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], singularVectors_Left_e[nCh][iCh] ); /* Q31 */ move32(); } } diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index a93690738..f9f941dbd 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -1430,7 +1430,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); IF( st->element_mode > EVS_MONO && st->hTcxEnc != NULL ) { - Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn + Copy( syn1_fx + shr( st->L_frame, 1 ), st->hTcxEnc->Txnq, shr( st->L_frame, 1 ) ); // st->Q_syn Scale_sig( st->hTcxEnc->Txnq + shr( st->L_frame, 1 ), sub( L_FRAME32k / 2 + 64, shr( st->L_frame, 1 ) ), sub( st->Q_syn, st->hTcxEnc->q_Txnq ) ); // st->Q_syn st->hTcxEnc->q_Txnq = st->Q_syn; move16(); diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 54f57b287..bb35cf037 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4525,7 +4525,6 @@ void coder_tcx_fx( n, st, hm_cfg ); - } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 405b3ac2b..14dbd5962 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -943,8 +943,8 @@ static void init_modes_fx( void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 44be8dcc6..9a66572ab 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -60,12 +60,12 @@ static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, /* _ None */ /*==================================================================================*/ void dtx_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word16 vad, /* i : vad flag for DTX Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word16 vad, /* i : vad flag for DTX Q0*/ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ) { Word16 alpha, i, j, Q_speech2; diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index 9612696ed..240f9859c 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -781,7 +781,7 @@ void E_ACELP_4tsearchx_ivas_fx( alp = shr( alp, 1 ); Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/ Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ - Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ + Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ } diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 6bc466e3d..ff19cfebc 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -481,8 +481,8 @@ void hq_core_enc_ivas_fx( TCX_MDCT( wtda_audio_fx16, t_audio_fx, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); Q_audio = sub( Q31, Q_audio ); Copy_Scale_sig_16_32_no_sat( wtda_audio_fx16, wtda_audio_fx32, 2 * L_FRAME48k, sub( Q_audio, q ) ); /* Q_audio */ - inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ - L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ + inner_frame = inner_frame_tbl[st->bwidth]; /* Q0 */ + L_spec = l_spec_ext_tbl[st->bwidth]; /* Q0 */ is_transient = 0; move16(); move16(); diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index d5f071784..2680bd9f6 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2517,8 +2517,8 @@ void IGFEncResetTCX10BitCounter_ivas_fx( *-------------------------------------------------------------------*/ void IGFEncApplyMono_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */ const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index bf7c36eef..96c1b168f 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -125,14 +125,14 @@ ivas_error pre_proc_front_ivas_fx( const Word16 localVAD_HE_SAD_LR[], /* i : HE-SAD flag without hangover, LR channels Q0*/ Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN (band_energies_LR_fx_q)*/ Word16 band_energies_LR_fx_q, - const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ - const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ - const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ - const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ + const Word16 front_vad_flag, /* i : front-VAD flag to overwrite VAD decision Q0*/ + const Word16 force_front_vad, /* i : flag to force VAD decision Q0*/ + const Word16 front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision Q0*/ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ + const Word32 ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX Q0*/ Word16 *Q_new #ifdef DEBUG_MODE_INFO , diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index 59447c022..615a6f4b6 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -51,11 +51,9 @@ static void computeIntensityVector_enc_fx( Word32 Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], const Word16 enc_param_start_band, /* i : first band to process */ const Word16 num_frequency_bands, - Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] - , + Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS], Word16 q_cldfb, - Word16 q_intensity_real[DIRAC_MAX_NBANDS] -); + Word16 q_intensity_real[DIRAC_MAX_NBANDS] ); /*------------------------------------------------------------------------- * ivas_dirac_enc_open() @@ -1123,11 +1121,9 @@ void ivas_dirac_param_est_enc_fx( Cldfb_ImagBuffer_fx, hDirAC->hConfig->enc_param_start_band, num_freq_bands, - intensity_real_fx - , + intensity_real_fx, cldfb_q, - intensity_real_q - ); + intensity_real_q ); IF( !hodirac_flag ) { computeDirectionVectors_fixed( @@ -1138,10 +1134,8 @@ void ivas_dirac_param_est_enc_fx( num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], - direction_vector_fx[2] - , - 31, intensity_real_q - ); + direction_vector_fx[2], + 31, intensity_real_q ); direction_vector_q = Q30; move16(); @@ -1465,8 +1459,7 @@ static void computeIntensityVector_enc_fx( Word32 intensity_real[DIRAC_NUM_DIMS][DIRAC_MAX_NBANDS] /* q_intensity_real */ , Word16 q_cldfb, - Word16 q_intensity_real[DIRAC_MAX_NBANDS] -) + Word16 q_intensity_real[DIRAC_MAX_NBANDS] ) { /* Reminder * X = a + ib; Y = c + id diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c index 0071b67ea..7a5718e99 100644 --- a/lib_enc/ivas_mcmasa_enc_fx.c +++ b/lib_enc/ivas_mcmasa_enc_fx.c @@ -1178,10 +1178,8 @@ void ivas_mcmasa_param_est_enc_fx( num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], - direction_vector_fx[2], c_e - , - NULL - ); + direction_vector_fx[2], c_e, + NULL ); /* Power and intensity estimation for diffuseness */ computeIntensityVector_enc_fx( diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 4b5b3fcbe..f7da231a3 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -429,11 +429,11 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 - Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 - scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 + Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 + scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); tmp = BASOP_Util_Divide1616_Scale( NORM_MDCT_FACTOR, s, &exp_tmp ); @@ -896,8 +896,8 @@ static UWord16 enc_ste_pre_mdct( absMagnR_fx = Sqrt32( L_add( Mpy_32_32( sigR1_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI1_fx[s], sigI1_fx[s] ) ), &absMagnR_e ); corr_fx = L_add( corr_fx, L_add( Mpy_32_32( sigR0_fx[s], sigR1_fx[s] ), Mpy_32_32( sigI0_fx[s], sigI1_fx[s] ) ) ); // q_com*2 - 31 - sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 - sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 + sumL_fx = L_add( sumL_fx, L_add( L_shr( sigR0_fx[s], 1 ), L_shr( sigI0_fx[s], 1 ) ) ); // q_com -1 + sumR_fx = L_add( sumR_fx, L_add( L_shr( sigR1_fx[s], 1 ), L_shr( sigI1_fx[s], 1 ) ) ); // q_com - 1 sumMagnL_fx = BASOP_Util_Add_Mant32Exp( sumMagnL_fx, sumMagnL_e, absMagnL_fx, absMagnL_e, &sumMagnL_e ); sumMagnR_fx = BASOP_Util_Add_Mant32Exp( sumMagnR_fx, sumMagnR_e, absMagnR_fx, absMagnR_e, &sumMagnR_e ); sumPrdLR_fx = BASOP_Util_Add_Mant32Exp( sumPrdLR_fx, sumPrdLR_e, Mpy_32_32( absMagnL_fx, absMagnR_fx ), add( absMagnL_e, absMagnR_e ), &sumPrdLR_e ); diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 1433c988f..f1187bc6c 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1199,10 +1199,8 @@ static void ivas_omasa_param_est_enc_fx( computeIntensityVector_enc_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx, guard_bits ); intensity_real_e = sub( add( 62, guard_bits ), shl( q, 1 ) ); - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e - , - NULL - ); + computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], intensity_real_e, + NULL ); /* Power estimation for diffuseness */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 4a6543026..f421fd034 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1179,7 +1179,7 @@ typedef struct stereo_dmx_evs_correlation_filter_structure { Word16 init_frmCntr; - Word32 isd_rate_s_fx; // Q31 + Word32 isd_rate_s_fx; // Q31 Word32 iccr_s_fx; // Q31 Word32 ipd_ff_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 Word32 Pr_fx[STEREO_DMX_EVS_NB_SUBBAND_MAX]; // Q31 diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 2ed17e25a..625ff8ee9 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -155,8 +155,8 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word16 itd[], /* o : estimated itd Q0 */ - const Word16 input_frame /* i : input frame length per channel */ + Word16 itd[], /* o : estimated itd Q0 */ + const Word16 input_frame /* i : input frame length per channel */ ); static void adapt_gain_fx( const Word32 src_fx[], /* i : input signal Q16 */ @@ -198,9 +198,9 @@ static void create_M_signal_fx( ); static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word16 itd_fx[], /* o : estimated itd */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio */ + Word16 itd_fx[], /* o : estimated itd */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio */ ); /*-------------------------------------------------------------------* * estimate_itd_wnd_fft() @@ -1136,9 +1136,9 @@ static void calc_poc_fx( *-------------------------------------------------------------------*/ static Word32 find_poc_peak_fx( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - Word16 itd_fx[], /* o : estimated itd Q0 */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word32 ratio_fixed /* i : adapting ratio Q31 */ + Word16 itd_fx[], /* o : estimated itd Q0 */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word32 ratio_fixed /* i : adapting ratio Q31 */ ) { Word16 itd_cand[CPE_CHANNELS], i, n, cnt[CPE_CHANNELS], Lh, peak_range, *on, *itdLR, prev_off[CPE_CHANNELS], eps_fx; @@ -1448,8 +1448,8 @@ static ivas_error estimate_itd_fx( STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const Word32 srcL[], /* i : Lch input signal Q16 */ const Word32 srcR[], /* i : Rch input signal Q16 */ - Word16 itd[], /* o : estimated itd Q0 */ - const Word16 input_frame /* i : input frame length per channel */ + Word16 itd[], /* o : estimated itd Q0 */ + const Word16 input_frame /* i : input frame length per channel */ ) { Word32 specLr[L_FRAME48k / 2 + 1], specLi[L_FRAME48k / 2 + 1], specRr[L_FRAME48k / 2 + 1], specRi[L_FRAME48k / 2 + 1]; diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 8410f7546..78ea50d7e 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1095,8 +1095,8 @@ static void corrStatsEst_fx( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], 429496730 /* 0.2 in Q31*/ ), hStereoTCA->delay_0_mem_exp, L_mult0( 26214 /* 0.8 in Q15*/, corrLagStats[0] ), Q16, &temp ); /* Q31-temp */ move32(); Word32 inpp = L_abs( BASOP_Util_Add_Mant32Exp( reg_prv_corr_fx, reg_prv_corr_exp, L_negate( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_exp, &exp ) ); /* Q31-exp */ - inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ - IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 + inpp = L_shl_sat( inpp, sub( exp, 5 ) ); /* Q26 */ + IF( GT_32( inpp, 1677721600 ) ) // 25 in Q26 { set32_fx( &( hStereoTCA->delay_0_mem_fx[0] ), hStereoTCA->delay_0_mem_fx[MAX_DELAYREGLEN - 1], MAX_DELAYREGLEN - 1 ); hStereoTCA->delay_0_mem_exp = temp; @@ -1964,8 +1964,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ - scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ + scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ + hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ tempF_fx = tempF_16fx; move32(); diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 25e2366dd..02d20543b 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -822,7 +822,7 @@ void stereo_icBWE_enc_ivas_fx( set32_fx( shb_frame_nonref_fx, 0, L_LOOK_16k + L_FRAME16k ); max_e = s_max( hStereoICBWE->mem_shb_speech_nonref_e, shb_speech_nonref_e ); - Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e + Copy_Scale_sig( hStereoICBWE->mem_shb_speech_nonref_fx, hStereoICBWE->mem_shb_speech_nonref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ) ); // mem_shb_speech_ref_e Copy_Scale_sig_16_32_no_sat( hStereoICBWE->mem_shb_speech_nonref_fx, shb_frame_nonref_fx, L_LOOK_16k, add( negate( sub( max_e, hStereoICBWE->mem_shb_speech_nonref_e ) ), Q16 ) ); // mem_shb_speech_ref_e hStereoICBWE->mem_shb_speech_nonref_e = max_e; shb_frame_nonref_e = max_e; diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index f9b6b0bf3..6ffd05c0c 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -71,13 +71,13 @@ #define RATIO_MAX 1.5f /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ -#define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ -#define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ -#define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ -#define B_ADAP_FX_Q16 ( 10486 ) /* 0.16f in Q16 */ +#define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ +#define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ +#define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ +#define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ +#define B_ADAP_FX_Q16 ( 10486 ) /* 0.16f in Q16 */ #define PC_LIMIT 64 #define RATIO_PG_HR 0.94f diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index 63cbb30e9..bdc39e797 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -338,8 +338,8 @@ void encod_gen_2sbfr( * Update memory of the weighting filter *-----------------------------------------------------------------*/ - Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ - Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ + Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ + Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ Ltmp = L_negate( Ltmp ); Ltmp = L_mac( Ltmp, xn[2 * L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index f80373787..3f7f17fe7 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -177,12 +177,12 @@ void dtx_fx( ); void dtx_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate Q0*/ - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word16 vad, /* i : vad flag for DTX Q0*/ - const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ - Word16 Q_speech /* i : Q factor for speech */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word16 vad, /* i : vad flag for DTX Q0*/ + const Word16 speech[], /* i : Pointer to the speech frame Q_speech*/ + Word16 Q_speech /* i : Q factor for speech */ ); Word16 dtx_hangover_addition_fx( @@ -1232,8 +1232,8 @@ void AVQ_cod_lpc_fx( ); void ProcessIGF_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ Word32 *pMDCTSpectrum, /* i : MDCT spectrum */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ @@ -3067,8 +3067,8 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | Word16 last_core_acelp /**< in: Q0 | indictaor if last frame was acelp coded */ ); -void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ - Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ +void IGFEncApplyMono_ivas_fx( Encoder_State *st, /* i : Encoder state */ + Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx*/ const Word16 igfGridIdx, /* i : IGF grid index */ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */ Word16 e_mdct, /* i : exponent of pMDCTspectrum */ diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index ff9e2d936..b9f47136f 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -890,7 +890,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis tmp = div_s( tmp2, tmp1 ); /*Q(15+exp3) */ L_tmp = L_shl( tmp, sub( 1, exp3 ) ); /*Q16 */ - ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ + ps_sta = L_add_sat( ps_sta, L_tmp ); /*Q16 */ } } @@ -2201,12 +2201,12 @@ Word16 ivas_smc_gmm_fx( ps_fx[m] = L_sub( L_sub( L_add( log_weights_speech_compute[m], log_det_chol_speech_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_music_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 - pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 + wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_music_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + pm_fx[m] = L_sub( L_sub( L_add( log_weights_music_compute[m], log_det_chol_music_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); v_sub32_fx( FV_fx, &means_noise_fx[m * N_PCA_COEF], fvm_fx, N_PCA_COEF ); - wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 - pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 + wprob_fx = dot_product_cholesky_fixed( fvm_fx, &prec_chol_noise_fx[m * ( N_PCA_COEF * N_PCA_COEF + N_PCA_COEF ) / 2], N_PCA_COEF ); // Q10 + pn_fx[m] = L_sub( L_sub( L_add( log_weights_noise_compute[m], log_det_chol_noise_fx[m] ), W_extract_l( W_shr( wprob_fx, Q10 ) ) ), HALF_N_PCA_COEF_LOG_P12_Q18 ); // Q18 move32(); } @@ -2220,7 +2220,7 @@ Word16 ivas_smc_gmm_fx( *high_lpn_flag = 1; move32(); } - hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 + hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 move16(); hSpMusClas->lps_fx = extract_h( L_shl_sat( lps_fx, 16 - 11 ) ); // Q7 move16(); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index c84843384..e0a944981 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3784,8 +3784,8 @@ void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) * *---------------------------------------------------------------------*/ void ProcessIGF_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ + Encoder_State *st, /* i : Encoder state */ + Word16 powerSpec_len, /* i : length of pPowerSpectrum buffer */ Word32 *pMDCTSpectrum, /* i : MDCT spectrum (*q_spectrum) */ const Word32 *pITFMDCTSpectrum, /* i : MDCT spectrum fir ITF */ Word16 *q_spectrum, /* i/o: Q of spectrum */ diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 92f01b5dd..60d661db4 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -678,8 +678,8 @@ void RunTransientDetection_ivas_fx( IF( GT_16( sub( q_input, pSubblockEnergies->q_firState ), shift ) ) { Scale_sig( input_fx, length, add( sub( pSubblockEnergies->q_firState, q_input ), shift ) ); // q_firState + shift - q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift - pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift + q_input = add( pSubblockEnergies->q_firState, shift ); // q_firState + shift + pSubblockEnergies->firState1 = shl( pSubblockEnergies->firState1, shift ); // q_firState + shift move16(); pSubblockEnergies->firState2 = shl( pSubblockEnergies->firState2, shift ); // q_firState + shift move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index fb3a89350..2376babcd 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -72,9 +72,9 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #define INV_TAN30_FX 28377 // Q14 #define EPSILON_MANT 1180591621 /* 1e-12 = 0.5497558*(2^-39) in Q70 */ #define EPSILON_EXP ( -39 ) -#define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ -#define ONE_DIV_EPSILON_EXP ( 40 ) -#define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#define ONE_DIV_EPSILON_MANT 1953125000 /* 1e+12 = 0.9094947*(2^40) */ +#define ONE_DIV_EPSILON_EXP ( 40 ) +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index d5df77045..cfdd43116 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -753,10 +753,8 @@ void ivas_mcmasa_param_est_ana_fx( /* Direction estimation */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /* Q intensity_real_fx = 2*inp_q-31, e = 31 - 2*inp_q + 31 = 62 - 2*inp_q = 2*(31-inp_q)=2*c_e */ - computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ) - , - NULL - ); /* Q direction_vector_fx = Q30*/ + computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], shl( c_e, 1 ), + NULL ); /* Q direction_vector_fx = Q30*/ /* Power and intensity estimation for diffuseness */ computeIntensityVector_ana_fx( hMcMasa->band_grouping, FoaEven_RealBuffer_fx, FoaEven_ImagBuffer_fx, num_freq_bands, intensity_even_real_fx ); /*2*inp_q-31*/ -- GitLab From 901841d9134342fbc700ef1ef23f23d12b65c2dc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 20 Mar 2025 18:50:36 +0530 Subject: [PATCH 237/358] Fix for 3GPP issue 1339: Artifact in IGF part for first active frame after DTX period in MDCT-Stereo Link #1339 --- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 4255980ad..804bcff5c 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -358,6 +358,32 @@ void stereo_mdct_core_enc_fx( } q_spec = sub( Q31, q_spec ); + /*find headroom to increase precision*/ + Word16 hdrm_min = MAX_16; + move16(); + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + IF( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + { + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + } + ELSE + { + length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + } + FOR( k = 0; k <= ( ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV ) - 1; k++ ) + { + hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[k], length ) ); + hdrm_min = s_min( hdrm_min, L_norm_arr( mdst_spectrum_fx[ch][k], length ) ); + } + } + + IF( hdrm_min != 0 ) + { + q_spec = sub( add( hdrm_min, q_spec ), 1 ); /*1 guard bit to avoid over-flows*/ + } + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; -- GitLab From fb6609bed16f25f93d4ef85ab3d946b924d7bbd1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 17:25:41 +0530 Subject: [PATCH 238/358] Fix for 3GPP issue 1414: ApplyFdCng_ivas_fx() called twice Link #1414 --- lib_dec/acelp_core_dec_ivas_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index ea82f09de..bd8c6ec93 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -660,7 +660,7 @@ ivas_error acelp_core_dec_ivas_fx( STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ); move32(); } - ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + Word16 new_sidNoiseEstExp = 31 - Q4; move16(); Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) ); // Q(31-sidNoiseEstExp) -- GitLab From b731e4cf2d5033fe8ebd04c93f69a191a6be7041 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 21 Mar 2025 10:57:19 +0530 Subject: [PATCH 239/358] Fix for 3GPP issue 1404: Stereo LTV signal at 24.4kbps and 32kbps: Modulated noise in BWE region for one-sided signal Link #1404 --- lib_com/rom_com.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 551a84feb..a5c8a3b7c 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -22038,27 +22038,8 @@ const Word32 sigma_BWE_fx[] = {//Q31 40792208 }; /* for 3 bits first stage */ -const Word16 inv_modified_sigma_BWE_fx[] = {//Q1 - 259, -254, -267, -266, -293, -315, -598, -622, -288, -288, -297, -297, -319, -346, -598, -622 -}; - -const Word16 modified_sigma_BWE_fx[] =//Q(log2(2.56) -{ 323, +const Word16 inv_modified_sigma_BWE_fx[] = {//x2.56 +323, 329, 313, 314, @@ -22073,8 +22054,27 @@ const Word16 modified_sigma_BWE_fx[] =//Q(log2(2.56) 262, 242, 140, -134 }; +134 +}; +const Word16 modified_sigma_BWE_fx[] =//Q15 +{ 259, +254, +267, +266, +293, +315, +598, +622, +288, +288, +297, +297, +319, +346, +598, +622 }; + const Word16 SHB_LSF_mean_fx[10] = {//Q15 1353, 2646, 4046, -- GitLab From bd8ebe21c053e3cd3f389009e459808bddf55488 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 24 Mar 2025 09:18:10 +0530 Subject: [PATCH 240/358] Q-factor of synthesis memory buffers of LPDmem struct updates --- lib_com/lsf_tools_fx.c | 8 ++++---- lib_enc/cod_tcx_fx.c | 4 ++-- lib_enc/core_enc_init_fx.c | 6 ++++++ lib_enc/init_enc_fx.c | 14 ++++---------- lib_enc/ivas_tcx_core_enc_fx.c | 16 ++-------------- lib_enc/ivas_td_low_rate_enc_fx.c | 1 + lib_enc/tcx_utils_enc_fx.c | 9 ++++++++- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 54f0ae3ed..5f0b3b57b 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -3044,11 +3044,11 @@ void lsf_syn_mem_backup_ivas_fx( /* back-up memories */ FOR( i = 0; i < M; i++ ) { - mem_syn_bck[i] = hLPDmem->mem_syn[i]; // Q: ( 15 - st_fx->hLPDmem->e_mem_syn ) + mem_syn_bck[i] = hLPDmem->mem_syn[i]; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); } - *mem_w0_bck = hLPDmem->mem_w0; // ( 15 - st_fx->hLPDmem->e_mem_syn ) + *mem_w0_bck = hLPDmem->mem_w0; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); @@ -3263,12 +3263,12 @@ void lsf_syn_mem_restore_ivas_fx( } /* restoring memories */ - hLPDmem->mem_w0 = mem_w0_bck; // Q(15 - st_fx->hLPDmem->e_mem_syn ) + hLPDmem->mem_w0 = mem_w0_bck; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); FOR( i = 0; i < M; i++ ) { - hLPDmem->mem_syn[i] = mem_syn_bck[i]; // Q(15 - st_fx->hLPDmem->e_mem_syn ) + hLPDmem->mem_syn[i] = mem_syn_bck[i]; // Q( st_fx->hLPDmem->q_mem_syn ) move16(); } diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index bb35cf037..4bb44eae2 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -3743,7 +3743,7 @@ void QuantizeTCXSpectrum_fx( } /* Quantize original spectrum */ - sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e ); + sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e ); tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); @@ -4730,7 +4730,7 @@ void InternalTCXDecoder_fx( } ELSE { - mdct_shaping( spectrum_fx, L_frame, gainlpc_fx, gainlpc_e ); + mdct_noiseShaping_ivas_fx( spectrum_fx, spectrum_e, L_frame, gainlpc_fx, gainlpc_e ); } /*-----------------------------------------------------------* * Apply gain * diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 14dbd5962..05f838a3a 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1561,6 +1561,10 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { set16_fx( hLPDmem->syn, 0, 1 + M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); + hLPDmem->q_lpd_syn = Q15; + hLPDmem->q_mem_syn = Q15; + move16(); + move16(); } IF( st->hTcxEnc != NULL ) @@ -1591,6 +1595,8 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); set16_fx( hLPDmem->syn, 0, M ); hLPDmem->q_lpd_syn = Q15; + hLPDmem->q_mem_syn = Q15; + move16(); move16(); } IF( st->hTcxEnc != NULL ) diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 1d695659c..ea944dd75 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -998,16 +998,18 @@ void LPDmem_enc_init_ivas_fx( set16_fx( hLPDmem->mem_syn2, 0, M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); set16_fx( hLPDmem->mem_syn3, 0, M ); + hLPDmem->q_lpd_old_exc = Q15; + move16(); hLPDmem->q_lpd_syn = Q15; move16(); + hLPDmem->q_mem_syn = Q15; + move16(); hLPDmem->mem_w0 = 0; move16(); hLPDmem->tilt_code = 0; move16(); hLPDmem->gc_threshold = 0; move32(); - hLPDmem->q_mem_syn = Q15; - move16(); hLPDmem->dm_fx.prev_state = 0; move16(); /* This corresponds to st_fx->dispMem in FLP */ hLPDmem->dm_fx.prev_gain_code = 0; @@ -1019,14 +1021,6 @@ void LPDmem_enc_init_ivas_fx( move16(); } - hLPDmem->q_lpd_syn = Q15; - move16(); - hLPDmem->q_lpd_old_exc = Q15; - move16(); - hLPDmem->q_mem_syn = Q15; - move16(); - - return; } diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 159012ac2..8dbd4731c 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -562,9 +562,9 @@ void stereo_tcx_core_enc( } Scale_sig( st->synth, st->L_frame, s ); /* st->Q_syn + s */ Scale_sig( st->hLPDmem->syn, M + 1, s ); /* st->Q_syn + s */ + st->hLPDmem->q_lpd_syn = add( st->hLPDmem->q_lpd_syn, s ); Q_new = add( Q_new, s ); move16(); - move16(); coder_tcx_post_ivas_fx( st, st->hLPDmem, st->hTcxCfg, st->synth, A_q_fx, Aw_fx, st->wspeech_enc, Q_new ); @@ -688,19 +688,7 @@ void stereo_tcx_core_enc( { set16_fx( pitch_buf_fx, L_SUBFR * ONE_IN_Q6, NB_SUBFR16k ); /* Q6 */ } - /* Memory scaling to keep everything in common q */ - Word16 curr_q_syn = sub( shl( Q_new, 1 ), 1 ); - Scale_sig( st->hLPDmem->mem_syn_r, L_SYN_MEM, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn2, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), curr_q_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - st->hLPDmem->mem_w0 = shl_sat( st->hLPDmem->mem_w0, sub( s_min( Q_new, st->hLPDmem->q_mem_syn ), Q_new ) ); /* s_min( Q_new, st->hLPDmem->q_mem_syn ) */ - move16(); - Scale_sig( st->hLPDmem->mem_syn1_fx, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - Scale_sig( st->hLPDmem->mem_syn3, M, sub( s_min( curr_q_syn, st->hLPDmem->q_mem_syn ), st->hLPDmem->q_mem_syn ) ); /* s_min( curr_q_syn, st->hLPDmem->q_mem_syn ) */ - st->hLPDmem->q_mem_syn = s_min( curr_q_syn, st->hLPDmem->q_mem_syn ); - move16(); - st->hLPDmem->q_lpd_syn = Q_new; - move16(); + IF( st->hTdCngEnc != NULL ) { FOR( Word16 ii = 0; ii < HO_HIST_SIZE; ii++ ) diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index bdc39e797..77ddb35aa 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -157,6 +157,7 @@ void tdm_low_rate_enc( { E_UTIL_synthesis( 0, p_Aq, &exc_wo_nf_fx[i_subfr], &synth[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1, M ); /* Q_new */ p_Aq += ( M + 1 ); + scale_sig( hLPDmem->mem_syn, M, sub( hLPDmem->q_mem_syn, Q_new ) ); // Q_new -> hLPDmem->q_mem_syn } /*--------------------------------------------------------------------------------------* diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index e0a944981..7d268b92a 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2799,12 +2799,14 @@ void tcx_encoder_memory_update_ivas_fx( Copy( xn_buf, synth, L_frame_glob ); Copy( synth + sub( L_frame_glob, M + 1 ), LPDmem->syn, M + 1 ); + LPDmem->q_lpd_syn = Q_new; + move16(); IF( st->tcxonly == 0 ) { /* Update weighted synthesis */ Residu3_fx( Ai + imult1616( sub( st->nb_subfr, 1 ), ( M + 1 ) ), synth + sub( L_frame_glob, 1 ), &tmp, 1, 0 ); - LPDmem->mem_w0 = sub_sat( wsig[sub( L_frame_glob, 1 )], tmp ); + LPDmem->mem_w0 = sub_sat( wsig[L_frame_glob - 1], tmp ); move16(); } @@ -2817,6 +2819,11 @@ void tcx_encoder_memory_update_ivas_fx( Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn, M ); Copy( synth + sub( L_frame_glob, M ), LPDmem->mem_syn2, M ); Copy( synth + sub( L_frame_glob, L_SYN_MEM ), LPDmem->mem_syn_r, L_SYN_MEM ); + + /* Aligning the Q-factor of the remaining synthesis memory buffers */ + Scale_sig( LPDmem->mem_syn1_fx, M, sub( Q_new, LPDmem->q_mem_syn ) ); + Scale_sig( LPDmem->mem_syn3, M, sub( Q_new, LPDmem->q_mem_syn ) ); + LPDmem->q_mem_syn = Q_new; // resultant q of synth after E_UTIL_f_preemph2 move16(); -- GitLab From 8302f02911824df48f138cddee6b5aa0baeb2115 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 24 Mar 2025 13:53:09 +0100 Subject: [PATCH 241/358] Use L_norm_arr instead of getScaleFactor32. Add assert checking proto_power_smooth q values. --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 7d3379ae7..baed49498 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2190,6 +2190,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(); + assert(h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q); + IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { p_power_smooth_prev++; -- GitLab From 33cd00b10ccefc173ebe33c35b67b6b655559deb Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 24 Mar 2025 14:04:05 +0100 Subject: [PATCH 242/358] Re enable FIX_867_CLDFB_NRG_SCALE --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 76bfee2ae..f100e4c98 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -69,4 +69,5 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ +#define FIX_867_CLDFB_NRG_SCALE #endif -- GitLab From 5515664eb74a2a88ecbe36e28c3242c3d36d0959 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 24 Mar 2025 14:09:20 +0100 Subject: [PATCH 243/358] clang format --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index baed49498..6f8557dfb 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2190,7 +2190,7 @@ 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(); - assert(h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q); + assert( h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q ); IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { -- GitLab From 63b5aab706fbd9d46d767949901e9278515c61a3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 14 Mar 2025 17:46:57 +0530 Subject: [PATCH 244/358] LTV crash fix --- lib_com/swb_tbe_com_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 2a2841966..4c91b0c7b 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -930,7 +930,7 @@ static void Calc_st_filt_tbe_ivas_enc_fx( { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } - g0 = extract_h( L_shl( L_g0, 14 ) ); + g0 = extract_h( L_shl_sat( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) -- GitLab From b7437cd508a5b06fd9b51eff92be8e52e1f3826e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 09:35:30 +0530 Subject: [PATCH 245/358] Fix for 3GPP issue 1348: Increased noise level in BASOP decoder for band-limited input from float encoder Link #1348 --- lib_dec/dec_tcx_fx.c | 4 ++-- lib_dec/ivas_mdct_core_dec_fx.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index e2ea02dcc..af80ee1f5 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -2636,10 +2636,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 + 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 FOR( Word16 ind = 0; ind < overlap; ind++ ) { - old_syn_overl_fx[ind] = extract_l( L_shl_sat( Mpy_32_32( old_syn_overl_fx[ind], fac ), hTcxDec->conceal_eof_gain_e ) ); // Q(-2) + 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) move16(); } } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 7d5f7d737..fabebede4 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1623,6 +1623,8 @@ void ivas_mdct_core_tns_ns_fx( } q_2 = q_x; move16(); + Word16 length2 = length; + move16(); sns_shape_spectrum_fx( x_fx[ch][k], &q_x, st->hTcxCfg->psychParamsCurrent, sns_int_scf_fx, q_sns_int_scf, st->hTcxCfg->psychParamsCurrent->nBins, &length ); IF( LT_16( q_2, add( q_x, 1 ) ) ) /*scaling to q_2*/ { @@ -1632,7 +1634,7 @@ void ivas_mdct_core_tns_ns_fx( } ELSE /*scaling to q_x+1*/ { - Scale_sig32( &x_fx[ch][k][0] + length, sub( L_spec[ch], length ), sub( add( q_x, 1 ), q_2 ) ); + Scale_sig32( &x_fx[ch][k][0] + length, sub( length2, length ), sub( add( q_x, 1 ), q_2 ) ); q_x = add( q_x, 1 ); } x_e[ch][k] = sub( 31, q_x ); -- GitLab From d47ab7007a46d6c7a6c853de24123b9523bf69af Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 25 Mar 2025 10:19:20 +0100 Subject: [PATCH 246/358] Reactivate FIX_867_CLDFB_NRG_SCALE. --- lib_com/options.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4f818e0c3..c56ce1153 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -67,6 +67,8 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif +#define FIX_867_CLDFB_NRG_SCALE + /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ -- GitLab From af758d0a32499efb520411f89da34eddfd05bf78 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 25 Mar 2025 10:45:27 +0100 Subject: [PATCH 247/358] Correct assert. --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index a837a79f0..0aee3c133 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2259,8 +2259,12 @@ 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++; -- GitLab From 9917716df2d97438400d205f0c0678e3384c0cf7 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 25 Mar 2025 13:40:49 +0100 Subject: [PATCH 248/358] Correct assert. --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 0aee3c133..6149ab390 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -4292,21 +4292,20 @@ 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; + 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 - assert( q_reference_power[0] <= q_reference_power[1] ); - Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); - q_cy_auto_diff_smooth_new = q_reference_power[0]; - move16(); - IF( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) + 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] ) ); + q_cy_auto_diff_smooth_new = q_diffuse_power; + IF( LT_16( *q_cy_auto_diff_smooth, q_diffuse_power ) ) { - assert( *q_cy_auto_diff_smooth <= q_reference_power[0] ); - Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); + Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_cy_auto_diff_smooth_new ) ); q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; move16(); } @@ -4317,10 +4316,9 @@ static void computeTargetPSDs_diffuse_subframe_fx( cur_idx = imult1616( ch_idx, num_freq_bands ); #ifdef FIX_867_CLDFB_NRG_SCALE - IF( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) + IF( GT_16( *q_cy_auto_diff_smooth, q_diffuse_power ) ) { - assert( q_reference_power[0] <= *q_cy_auto_diff_smooth ); - Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *q_cy_auto_diff_smooth ) ); + 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 -- GitLab From 4daa1e064ea7bfb832467d3454c1f64bea014a54 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 20:26:54 +0530 Subject: [PATCH 249/358] Fix for 3GPP issue 1437: Decoder crash for McMASA 5.1 at 32kbps JBM decoding in ivas_fec_noise_filling_fx() Link #1437 --- lib_dec/FEC_HQ_phase_ecu_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index b8c16474e..ef09c3de3 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -4565,13 +4565,13 @@ static void ivas_fec_noise_filling_fx( pt6 = &p_mdct_ola[0]; FOR( k = 0; k < tmp_fx; k++ ) { - L_tmp = L_mult( *sinq_tab, *sinq_tab ); /*Q30 */ + L_tmp = L_mult( *sinq_tab, *sinq_tab ); /*Q31 */ sinq_tab++; - q2 = round_fx( L_sub( 2147483647, L_tmp ) ); /*Q15 */ - q1 = round_fx( L_tmp ); /*Q15 */ - L_tmp = L_mult( ( *pt1 ), q1 ); /*Qsynth+16 */ - L_tmp = L_add( L_tmp, L_shr( Mpy_32_16_1( L_deposit_h( *pt6++ ), q2 ), Q_old_out ) ); /*Qsynth+16 */ - ( *pt1++ ) = round_fx( L_tmp ); /*Qsynth */ + q2 = round_fx( L_sub( 2147483647, L_tmp ) ); /*Q15 */ + q1 = round_fx( L_tmp ); /*Q15 */ + L_tmp = L_mult( ( *pt1 ), q1 ); /*Qsynth+16 */ + L_tmp = L_add_sat( L_tmp, L_shr_sat( Mpy_32_16_1( L_deposit_h( *pt6++ ), q2 ), Q_old_out ) ); /*Qsynth+16 */ + ( *pt1++ ) = round_fx_sat( L_tmp ); /*Qsynth */ move16(); } -- GitLab From 95f5e56bdd38560e3edbaa979827f9fc19cd335e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 20:30:08 +0530 Subject: [PATCH 250/358] Fix for 3GPP issue 1436: Decoder crash for ParamMC at 48kbps FER mono/stereo decoding at 32 and 48 kHz in ivas_ls_setup_conversion_process_mdct_param_mc_fx() Link #1436 --- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index cd7e92f71..890e5fc9e 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -469,6 +469,14 @@ void stereo_mdct_core_dec_fx( move16(); move16(); + 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(); + } + } 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 ); } -- GitLab From 690a6fe1305f27f94501c7c1bf8609110bb35002 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 20:34:27 +0530 Subject: [PATCH 251/358] Bug fix in tcx_ltp_enc and swb_tbe_enc --- lib_enc/swb_tbe_enc_fx.c | 4 ++-- lib_enc/tcx_ltp_enc_fx.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 2b8f487bd..c5d5e651e 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -3835,8 +3835,8 @@ void swb_tbe_enc_ivas_fx( 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 */ + 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(); } diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index 25a3bdee7..84f83a311 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -931,9 +931,9 @@ void tcx_ltp_encode_ivas_fx( { hTcxEnc->tcxltp_pitch_int_past = L_frame; move16(); - hTcxEnc->tcxltp_pitch_int_past = 0; + hTcxEnc->tcxltp_pitch_fr_past = 0; move16(); - hTcxEnc->tcxltp_pitch_int_past = 0; + hTcxEnc->tcxltp_gain_past = 0; move16(); } -- GitLab From 0d92e4ff01548c56e8f3638544878cc00c661a74 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 12:42:25 +0530 Subject: [PATCH 252/358] Fix for 3GPP issue 1434: [regression] Encoder crash for MDCT Stereo at 80 kbps and above in stereo_mdct_core_enc_fx() Link #1434 --- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 804bcff5c..3becb30d9 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -363,26 +363,24 @@ void stereo_mdct_core_enc_fx( move16(); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - IF( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) - { - length = sts[ch]->hTcxEnc->L_frameTCX; - move16(); - } - ELSE + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + if ( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); } - FOR( k = 0; k <= ( ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV ) - 1; k++ ) + + hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[0], length ) ); + hdrm_min = s_min( hdrm_min, L_norm_arr( mdst_spectrum_fx[ch][0], length ) ); + + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { - hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[k], length ) ); - hdrm_min = s_min( hdrm_min, L_norm_arr( mdst_spectrum_fx[ch][k], length ) ); + hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[1], length ) ); + hdrm_min = s_min( hdrm_min, L_norm_arr( mdst_spectrum_fx[ch][1], length ) ); } } - IF( hdrm_min != 0 ) - { - q_spec = sub( add( hdrm_min, q_spec ), 1 ); /*1 guard bit to avoid over-flows*/ - } + q_spec = sub( add( hdrm_min, q_spec ), 2 ); /* 2 guard bits to avoid over-flows (1 for stereo_coder_tcx_fx and other for power spectrum calculation )*/ FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -- GitLab From fa18e7dff4ca45f79b937fbf4ad5b23a3cc143ad Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 26 Mar 2025 09:38:56 +0530 Subject: [PATCH 253/358] Fix for 3GPP issue 1408: Decoder crash for ParamMC 5.1 at 48/64/80 kbps decoding to mono in ivas_ls_setup_conversion_fx() Link #1408 --- lib_dec/ivas_out_setup_conversion_fx.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index fc69d3919..93a7c204e 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -657,6 +657,7 @@ void ivas_ls_setup_conversion_process_mdct_fx( Word16 transform_type[MAX_CICP_CHANNELS][2]; Word16 frameSize; Word32 targetEnergy[MAX_SFB + 2], dmxEnergy[MAX_SFB + 2]; + Word16 dmxEnergy_exp[MAX_SFB + 2], dmxEnergy_exp_temp; Word32 dmxCoeff; Word32 dmxSignalReal[L_FRAME48k], dmxSignalImag[L_FRAME48k]; Word32 eqGain; @@ -739,6 +740,9 @@ void ivas_ls_setup_conversion_process_mdct_fx( set32_fx( targetEnergy, 0, MAX_SFB + 2 ); set32_fx( dmxEnergy, 0, MAX_SFB + 2 ); + set16_fx( dmxEnergy_exp, 0, MAX_SFB + 2 ); + dmxEnergy_exp_temp = 0; + move16(); FOR( chOutIdx = 0; chOutIdx < outChannels; chOutIdx++ ) { @@ -829,6 +833,7 @@ void ivas_ls_setup_conversion_process_mdct_fx( FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ ) { Word32 tmpReal, tmpImag, DMXEne; + Word16 DMXEne_exp; start = hLsSetUpConversion->sfbOffset[bandIdx]; move16(); @@ -838,6 +843,8 @@ void ivas_ls_setup_conversion_process_mdct_fx( /* Loop over all the bins in the band */ DMXEne = 0; move32(); + DMXEne_exp = 0; + move16(); FOR( binIdx = start; binIdx < stop; binIdx++ ) { tmpReal = dmxSignalReal[binIdx]; @@ -845,13 +852,20 @@ void ivas_ls_setup_conversion_process_mdct_fx( tmpImag = dmxSignalImag[binIdx]; move32(); - DMXEne = L_add( DMXEne, L_add( Mpy_32_32( tmpReal, tmpReal ), Mpy_32_32( tmpImag, tmpImag ) ) ); + DMXEne = BASOP_Util_Add_Mant32Exp( DMXEne, DMXEne_exp, L_add( Mpy_32_32( tmpReal, tmpReal ), Mpy_32_32( tmpImag, tmpImag ) ), sub( 40, shl( q_output, 1 ) ), &DMXEne_exp ); } - dmxEnergy[bandIdx] = L_add( dmxEnergy[bandIdx], DMXEne ); + dmxEnergy[bandIdx] = BASOP_Util_Add_Mant32Exp( dmxEnergy[bandIdx], dmxEnergy_exp[bandIdx], DMXEne, DMXEne_exp, &dmxEnergy_exp[bandIdx] ); move32(); + dmxEnergy_exp_temp = s_max( dmxEnergy_exp_temp, dmxEnergy_exp[bandIdx] ); } } /* end of out channel loop */ + /* Scaling to common exponent */ + FOR( bandIdx = 0; bandIdx < MAX_SFB + 2; bandIdx++ ) + { + dmxEnergy[bandIdx] = L_shl( dmxEnergy[bandIdx], sub( dmxEnergy_exp[bandIdx], dmxEnergy_exp_temp ) ); + move32(); + } /* Step 3: Peform energy smoothing */ Word16 te_scale = getScaleFactor32( hLsSetUpConversion->targetEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt ); @@ -860,13 +874,13 @@ void ivas_ls_setup_conversion_process_mdct_fx( scale_sig32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, dmx_sacle ); Word16 te_max_e = s_max( sub( 40, shl( q_output, 1 ) ), sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ); - Word16 dmx_max_e = s_max( sub( 40, shl( q_output, 1 ) ), sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ); + Word16 dmx_max_e = s_max( dmxEnergy_exp_temp, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ); FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ ) { targetEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( targetEnergy[bandIdx], sub( te_max_e, sub( 40, shl( q_output, 1 ) ) ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], sub( te_max_e, sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ) ) ) ); move32(); - dmxEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( dmxEnergy[bandIdx], sub( dmx_max_e, sub( 40, shl( q_output, 1 ) ) ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], sub( dmx_max_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ) ) ) ); + dmxEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( dmxEnergy[bandIdx], sub( dmx_max_e, dmxEnergy_exp_temp ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], sub( dmx_max_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ) ) ) ); move32(); hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx] = targetEnergy[bandIdx]; /* te_prev_exp = 40 - 2*q_output */ move32(); -- GitLab From 92576ecee5692b22a8f2f9f514b296ad703f26b7 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 26 Mar 2025 10:12:28 +0530 Subject: [PATCH 254/358] Fix for 3GPP issue 1424: Audible differences in the CNG generated at SBA 32 kbps and 16.4 kbps, DTX ON Link #1424 --- lib_enc/ivas_front_vad_fx.c | 39 +++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index a53e40ee6..25a936566 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -666,14 +666,45 @@ ivas_error front_vad_spar_fx( old_pitch = st->pitch[1]; move16(); - Scale_sig( wsp_fx, 368, sub( Q8, Q_inp_12k8 ) ); // Q8 - pitch_ol_ivas_fx( st->pitch, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift_fx, &st->old_thres_fx, &st->delta_pit, st->old_wsp2_fx, wsp_fx, st->mem_decim2_fx, relE_fx, st->clas, st->input_bwidth, st->Opt_SC_VBR, Q8 ); + Word16 shift, Q_wsp; + Word16 shift1 = norm_arr( old_wsp_fx, L_WSP_MEM ); + Word16 shift2 = norm_arr( wsp_fx, L_WSP - L_WSP_MEM ); + maximum_abs_16_fx( old_wsp_fx, L_WSP_MEM, &shift ); + if ( !shift ) + { + shift1 = Q15; + move16(); + } + maximum_abs_16_fx( wsp_fx, L_WSP - L_WSP_MEM, &shift ); + if ( !shift ) + { + shift2 = Q15; + move16(); + } + + shift = s_min( Q15, s_min( add( Q_inp_12k8, shift1 ), add( Q_inp_12k8, shift2 ) ) ); + shift = s_min( shift, add( norm_arr( st->mem_decim2_fx, 3 ), st->Q_old_wsp2 ) ); + shift = s_min( shift, add( norm_arr( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM ), st->Q_old_wsp2 ) ); + + scale_sig( old_wsp_fx, L_WSP_MEM, sub( shift, Q_inp_12k8 ) ); + scale_sig( wsp_fx, L_WSP - L_WSP_MEM, sub( shift, Q_inp_12k8 ) ); + + Q_wsp = shift; + move16(); + + scale_sig( st->mem_decim2_fx, 3, sub( Q_wsp, st->Q_old_wsp2 ) ); // Q( mem_decim ) = Q( old_wsp2 ) + scale_sig( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM, sub( Q_wsp, st->Q_old_wsp2 ) ); // Q_wsp + + st->Q_old_wsp2 = Q_wsp; + move16(); + + pitch_ol_ivas_fx( st->pitch, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift_fx, &st->old_thres_fx, &st->delta_pit, st->old_wsp2_fx, wsp_fx, st->mem_decim2_fx, relE_fx, st->clas, st->input_bwidth, st->Opt_SC_VBR, Q_wsp ); /* Updates for adaptive lag window memory */ st->old_pitch_la = st->pitch[2]; /* Q0 */ move16(); - Scale_sig( wsp_fx, 368, Q9 - Q8 ); /* Q9 */ - StableHighPitchDetect_ivas_fx( &flag_spitch, st->pitch, st->voicing_fx, wsp_fx, st->localVAD, &st->voicing_sm_fx, &st->voicing0_sm_fx, &st->LF_EnergyRatio_sm_fx, &st->predecision_flag, &st->diff_sm_fx, &st->energy_sm_fx, Q12, st->lgBin_E_fx ); + + StableHighPitchDetect_ivas_fx( &flag_spitch, st->pitch, st->voicing_fx, wsp_fx, st->localVAD, &st->voicing_sm_fx, &st->voicing0_sm_fx, &st->LF_EnergyRatio_sm_fx, &st->predecision_flag, &st->diff_sm_fx, &st->energy_sm_fx, Q_wsp, st->lgBin_E_fx ); IF( st->hSpMusClas != NULL ) { Word16 dummy_int; -- GitLab From 552d615d6e4ee3a56636be80b55a79721c0445fc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 26 Mar 2025 12:09:08 +0530 Subject: [PATCH 255/358] Synth state buffer scaling/rescaling cleanup --- lib_com/cldfb.c | 113 +++++++++++++----- lib_com/options.h | 1 + lib_com/prot_fx.h | 13 +- lib_dec/acelp_core_dec_ivas_fx.c | 29 ++++- lib_dec/acelp_core_switch_dec_fx.c | 9 ++ lib_dec/core_switching_dec_fx.c | 8 ++ lib_dec/ivas_dirac_dec_fx.c | 17 ++- lib_dec/ivas_ism_param_dec_fx.c | 4 + lib_dec/ivas_mc_param_dec_fx.c | 5 + lib_dec/ivas_mc_paramupmix_dec_fx.c | 18 ++- lib_dec/ivas_spar_decoder_fx.c | 12 ++ lib_enc/swb_pre_proc_fx.c | 4 + .../ivas_dirac_dec_binaural_functions_fx.c | 4 + lib_rend/ivas_dirac_rend_fx.c | 4 + 14 files changed, 202 insertions(+), 39 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 845ec1f11..720ee37a0 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -399,18 +399,28 @@ void cldfbAnalysis_ts_fx( /* folding + pre modulation of DST IV */ rr12_fx = L_sub( r1_fx, r2_fx ); // q -1 ri12_fx = L_negate( L_add( i1_fx, i2_fx ) ); // q - 1 - /*cplxMult(&rBuffer[2*k],&rBuffer[2*k+1],rr12,ri12,rot_vctr_re[k],rot_vctr_im[k]);*/ - rBuffer_fx[2 * k] = L_sub( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_im_fx[k] ) ); // q - 3 - rBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_re_fx[k] ) ); // q - 3 + /*cplxMult(&rBuffer[2*k],&rBuffer[2*k+1],rr12,ri12,rot_vctr_re[k],rot_vctr_im[k]);*/ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + rBuffer_fx[2 * k] = Msub_32_32( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), ri12_fx, rot_vctr_im_fx[k] ); // q - 3 + rBuffer_fx[2 * k + 1] = Madd_32_32( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), ri12_fx, rot_vctr_re_fx[k] ); // q - 3 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + rBuffer_fx[2 * k] = L_sub( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_im_fx[k] ) ); // q - 3 + rBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_re_fx[k] ) ); // q - 3 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); ///* folding + pre modulation of DCT IV */ ir12_fx = L_add( r1_fx, r2_fx ); // q - 1 ii12_fx = L_sub( i1_fx, i2_fx ); // q - 1 - /*cplxMult(&iBuffer[2*k],&iBuffer[2*k+1],ir12,ii12,rot_vctr_re[k],rot_vctr_im[k]);*/ - iBuffer_fx[2 * k] = L_sub( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_im_fx[k] ) ); // q - 3 - iBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_re_fx[k] ) ); // q - 3 + /*cplxMult(&iBuffer[2*k],&iBuffer[2*k+1],ir12,ii12,rot_vctr_re[k],rot_vctr_im[k]);*/ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + iBuffer_fx[2 * k] = Msub_32_32( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), ii12_fx, rot_vctr_im_fx[k] ); // q - 3 + iBuffer_fx[2 * k + 1] = Madd_32_32( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), ii12_fx, rot_vctr_re_fx[k] ); // q - 3 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + iBuffer_fx[2 * k] = L_sub( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_im_fx[k] ) ); // q - 3 + iBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_re_fx[k] ) ); // q - 3 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); } @@ -450,18 +460,28 @@ void cldfbAnalysis_ts_fx( /* folding + pre modulation of DST IV */ rr12_fx = L_add( r1_fx, r2_fx ); // q - 1 ri12_fx = L_sub( i1_fx, i2_fx ); // q - 1 - /*cplxMult(&rBuffer[2*k],&rBuffer[2*k+1],rr12,ri12,rot_vctr_re[k],rot_vctr_im[k]);*/ - rBuffer_fx[2 * k] = L_sub( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_im_fx[k] ) ); // q - 3 - rBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_re_fx[k] ) ); // q - 3 + /*cplxMult(&rBuffer[2*k],&rBuffer[2*k+1],rr12,ri12,rot_vctr_re[k],rot_vctr_im[k]);*/ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + rBuffer_fx[2 * k] = Msub_32_32( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), ri12_fx, rot_vctr_im_fx[k] ); // q - 3 + rBuffer_fx[2 * k + 1] = Madd_32_32( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), ri12_fx, rot_vctr_re_fx[k] ); // q - 3 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + rBuffer_fx[2 * k] = L_sub( Mpy_32_32( rr12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_im_fx[k] ) ); // q - 3 + rBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( rr12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ri12_fx, rot_vctr_re_fx[k] ) ); // q - 3 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); /* folding + pre modulation of DCT IV */ ir12_fx = L_sub( r1_fx, r2_fx ); // q - 1 ii12_fx = L_add( i1_fx, i2_fx ); // q - 1 - /*cplxMult(&iBuffer[2*k],&iBuffer[2*k+1],ir12,ii12,rot_vctr_re[k],rot_vctr_im[k]);*/ - iBuffer_fx[2 * k] = L_sub( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_im_fx[k] ) ); // q - 3 - iBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_re_fx[k] ) ); // q - 3 + /*cplxMult(&iBuffer[2*k],&iBuffer[2*k+1],ir12,ii12,rot_vctr_re[k],rot_vctr_im[k]);*/ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + iBuffer_fx[2 * k] = Msub_32_32( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), ii12_fx, rot_vctr_im_fx[k] ); // q - 3 + iBuffer_fx[2 * k + 1] = Madd_32_32( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), ii12_fx, rot_vctr_re_fx[k] ); // q - 3 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + iBuffer_fx[2 * k] = L_sub( Mpy_32_32( ir12_fx, rot_vctr_re_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_im_fx[k] ) ); // q - 3 + iBuffer_fx[2 * k + 1] = L_add( Mpy_32_32( ir12_fx, rot_vctr_im_fx[k] ), Mpy_32_32( ii12_fx, rot_vctr_re_fx[k] ) ); // q - 3 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); } @@ -490,8 +510,13 @@ void cldfbAnalysis_ts_fx( FOR( k = 0; k < M2; k++ ) { /*cplxMult(&realBuffer[M1-1-(2*k)],&realBuffer[2*k],rBuffer[2*k],rBuffer[2*k+1],rot_vctr_re[k],rot_vctr_im[k]);*/ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + realBuffer_fx[( ( M1 - 1 ) - ( k * 2 ) )] = Msub_32_32( Mpy_32_32( rBuffer_fx[2 * k], rot_vctr_re_fx[k] ), rBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ); // q - 5 + realBuffer_fx[2 * k] = Madd_32_32( Mpy_32_32( rBuffer_fx[2 * k], rot_vctr_im_fx[k] ), rBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ); // q - 5 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ realBuffer_fx[( ( M1 - 1 ) - ( k * 2 ) )] = L_sub( Mpy_32_32( rBuffer_fx[2 * k], rot_vctr_re_fx[k] ), Mpy_32_32( rBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ) ); // q - 5 realBuffer_fx[2 * k] = L_add( Mpy_32_32( rBuffer_fx[2 * k], rot_vctr_im_fx[k] ), Mpy_32_32( rBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ) ); // q - 5 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); } @@ -520,8 +545,13 @@ void cldfbAnalysis_ts_fx( { /* do it inplace */ /*cplxMult(&imagBuffer[2*k],&imagBuffer[M1-1-(2*k)],iBuffer[2*k],iBuffer[2*k+1],rot_vctr_re[k],rot_vctr_im[k]);*/ - imagBuffer_fx[2 * k] = L_sub( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_re_fx[k] ), Mpy_32_32( iBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ) ); // q - 5 - imagBuffer_fx[( M1 - 1 ) - ( k * 2 )] = L_add( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_im_fx[k] ), Mpy_32_32( iBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ) ); // q - 5 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + imagBuffer_fx[2 * k] = Msub_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_re_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ); // q - 5 + imagBuffer_fx[( M1 - 1 ) - ( k * 2 )] = Madd_32_32( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_im_fx[k] ), iBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ); // q - 5 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + imagBuffer_fx[2 * k] = L_sub( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_re_fx[k] ), Mpy_32_32( iBuffer_fx[2 * k + 1], rot_vctr_im_fx[k] ) ); // q - 5 + imagBuffer_fx[( M1 - 1 ) - ( k * 2 )] = L_add( Mpy_32_32( iBuffer_fx[2 * k], rot_vctr_im_fx[k] ), Mpy_32_32( iBuffer_fx[2 * k + 1], rot_vctr_re_fx[k] ) ); // q - 5 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ move32(); move32(); } @@ -542,8 +572,13 @@ void cldfbAnalysis_ts_fx( /*cplxMult(&realBuffer[k], &imagBuffer[k], realBuffer[k], imagBuffer[k], rot_vctr_delay_re[k], rot_vctr_delay_im[k]);*/ /*realBuffer[k] = rBuffer[k]; imagBuffer[k] = iBuffer[k];*/ - cplx_aux_fx = L_sub( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_re_fx[k] ), Mpy_32_32( imagBuffer_fx[k], rot_vctr_delay_im_fx[k] ) ); // q - 5 - imagBuffer_fx[k] = L_add( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_im_fx[k] ), Mpy_32_32( imagBuffer_fx[k], rot_vctr_delay_re_fx[k] ) ); // q - 5 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cplx_aux_fx = Msub_32_32( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_re_fx[k] ), imagBuffer_fx[k], rot_vctr_delay_im_fx[k] ); // q - 5 + imagBuffer_fx[k] = Madd_32_32( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_im_fx[k] ), imagBuffer_fx[k], rot_vctr_delay_re_fx[k] ); // q - 5 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + cplx_aux_fx = L_sub( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_re_fx[k] ), Mpy_32_32( imagBuffer_fx[k], rot_vctr_delay_im_fx[k] ) ); // q - 5 + imagBuffer_fx[k] = L_add( Mpy_32_32( realBuffer_fx[k], rot_vctr_delay_im_fx[k] ), Mpy_32_32( imagBuffer_fx[k], rot_vctr_delay_re_fx[k] ) ); // q - 5 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ realBuffer_fx[k] = cplx_aux_fx; move32(); move32(); @@ -1091,17 +1126,21 @@ void cldfbAnalysis_ts_fx_fixed_q( return; } + /*-------------------------------------------------------------------* * cldfbSynthesis_ivas() * * Conduct inverse multple overlap cmplex low delay MDCT *--------------------------------------------------------------------*/ void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ - const Word16 shift, /* i : scale for state buffer */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ + const Word16 shift, /* i : scale for state buffer */ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + const Word16 out_shift, /* i : scale for output buffer */ +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ) { @@ -1295,11 +1334,11 @@ void cldfbSynthesis_ivas_fx( FOR( i = 0; i < L2; i++ ) { 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 - accu1 = Madd_32_16( synthesisBuffer_fx[1 * L2 + i], prod, p_filter[( 1 * L2 + i )] ); // Qx - 1 - accu2 = Madd_32_16( synthesisBuffer_fx[2 * L2 + i], prod, p_filter[( 2 * L2 + i )] ); // Qx - 1 - accu3 = Madd_32_16( synthesisBuffer_fx[3 * L2 + i], prod, p_filter[( 3 * L2 + i )] ); // Qx - 1 - accu4 = Madd_32_16( synthesisBuffer_fx[4 * L2 + i], prod, p_filter[( 4 * L2 + i )] ); // Qx - 1 + 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 synthesisBuffer_fx[i] = accu0; move32(); @@ -1314,11 +1353,26 @@ void cldfbSynthesis_ivas_fx( } } - FOR( i = 0; i < M1; i++ ) +#ifdef OPT_AVOID_STATE_BUF_RESCALE + IF( 0 == out_shift ) { - ptr_time_out_fx[( M1 - 1 ) - i] = synthesisBuffer_fx[4 * L2 + M1 + i]; - move32(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ + FOR( i = 0; i < M1; i++ ) + { + ptr_time_out_fx[( M1 - 1 ) - i] = synthesisBuffer_fx[4 * L2 + M1 + i]; + move32(); + } +#ifdef OPT_AVOID_STATE_BUF_RESCALE } + ELSE + { + FOR( i = 0; i < M1; i++ ) + { + ptr_time_out_fx[( M1 - 1 ) - i] = L_shl_sat( synthesisBuffer_fx[4 * L2 + M1 + i], out_shift ); + move32(); + } + } +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ ptr_time_out_fx += M1; @@ -1333,7 +1387,6 @@ void cldfbSynthesis_ivas_fx( return; } - void configureCldfb_ivas_enc_fx( HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i/o: filter bank handle */ const Word32 sampling_rate /* i : sampling rate */ diff --git a/lib_com/options.h b/lib_com/options.h index 4f818e0c3..8f404dd74 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -69,6 +69,7 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ +#define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ #define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ #define FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, nonbe*/ #endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index d7ed9a140..851b461bf 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9740,11 +9740,14 @@ void cldfbAnalysis_ivas_fx( ); void cldfbSynthesis_ivas_fx( - Word32 **realBuffer_fx, /* i : real values Qx*/ - Word32 **imagBuffer_fx, /* i : imag values Qx*/ - Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ - const Word16 samplesToProcess, /* i : number of processed samples */ - const Word16 shift, /* i : scale for state buffer */ + Word32 **realBuffer_fx, /* i : real values Qx*/ + Word32 **imagBuffer_fx, /* i : imag values Qx*/ + Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/ + const Word16 samplesToProcess, /* i : number of processed samples */ + const Word16 shift, /* i : scale for state buffer */ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + const Word16 out_shift, /* i : scale for output buffer */ +#endif HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */ ); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index bd8c6ec93..38999e99e 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1807,6 +1807,7 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_imag ); // Q_imag } +#ifndef OPT_AVOID_STATE_BUF_RESCALE #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ @@ -1814,6 +1815,7 @@ ivas_error acelp_core_dec_ivas_fx( #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { @@ -1833,12 +1835,18 @@ ivas_error acelp_core_dec_ivas_fx( } } +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, 0, st->cldfbSynHB ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ +#ifndef OPT_AVOID_STATE_BUF_RESCALE Scale_sig32( save_hb_synth_fx, L_FRAME48k, negate( ( sub( Q_real, 1 ) ) ) ); // Q0 Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSynHB->Q_cldfb_state = Q10; move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ /* restore lowband */ FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { @@ -1850,14 +1858,21 @@ ivas_error acelp_core_dec_ivas_fx( move32(); } } +#ifndef OPT_AVOID_STATE_BUF_RESCALE Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // Q_real-1 st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ + +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, sub( Q11, Q_real ), -10, st->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, 0, st->cldfbSyn ); Scale_sig32( synth_fx, L_FRAME48k, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSynHB->Q_cldfb_state = Q10; move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } ELSE { @@ -1892,12 +1907,16 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ - scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) + scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, 0, st->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; @@ -1985,18 +2004,26 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real } +#ifndef OPT_AVOID_STATE_BUF_RESCALE #ifdef OPT_STEREO_32KBPS_V1 scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) #else /* OPT_STEREO_32KBPS_V1 */ scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) #endif /* OPT_STEREO_32KBPS_V1 */ +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), sub( Q10, sub( Q_real, 1 ) ), -10, st->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ +#ifndef OPT_AVOID_STATE_BUF_RESCALE Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0 Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10 st->cldfbSyn->Q_cldfb_state = Q10; move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ IF( st->p_bpf_noise_buf_32 ) { Copy_Scale_sig_16_32_DEPREC( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 9013f2f03..765749188 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -832,16 +832,25 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( } /*cldfbSynthesis_fx( st_fx->cldfbSyn, realBuffer, imagBuffer, &scaleFactor, synth_out, negate(st_fx->Q_syn), CLDFB_NO_COL_MAX_SWITCH_BFI, workBuffer );*/ +#ifndef OPT_AVOID_STATE_BUF_RESCALE Scale_sig32( st_fx->cldfbSyn->cldfb_state_fx, st_fx->cldfbSyn->cldfb_state_length, 1 ); // Q_cldfb_state+1 st_fx->cldfbSyn->Q_cldfb_state = add( st_fx->cldfbSyn->Q_cldfb_state, 1 ); move16(); Copy_Scale_sig_16_32_DEPREC( synth_out, synth32, L_FRAME48k, 5 ); /*11-5-1*/ cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ), 0, st_fx->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + Word16 out_len = extract_l( Mpy_32_16_1( st_fx->output_Fs, 328 ) ); + cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, synth32, out_len, -1, 0, st_fx->cldfbSyn ); + Copy_Scale_sig_32_16( synth32, synth_out, out_len, -4 ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ + +#ifndef OPT_AVOID_STATE_BUF_RESCALE Scale_sig32( st_fx->cldfbSyn->cldfb_state_fx, st_fx->cldfbSyn->cldfb_state_length, -1 ); // Q_cldfb_state-1 st_fx->cldfbSyn->Q_cldfb_state = sub( st_fx->cldfbSyn->Q_cldfb_state, 1 ); move16(); Copy_Scale_sig_32_16( synth32, synth_out, L_FRAME48k, -5 ); // 11-5-1 -> 11 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ // Scale_sig( synth_out, L_FRAME48k, negate( st_fx->Q_syn ) ); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 05125318f..ba7c73741 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2056,7 +2056,11 @@ static void core_switch_lb_upsamp_fx( } /* synthesis of the combined signal */ +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), 0, 0, st->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), 0, st->cldfbSyn ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ /*rescaling whole buffer to a common Q*/ no_col = st->cldfbSyn->no_col; @@ -2364,7 +2368,11 @@ ivas_error core_switching_pre_dec_ivas_fx( return error; } +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, 0, 0, st->cldfbSyn ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, fer_samples_fx, delay_comp, 0, st->cldfbSyn ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ cldfb_restore_memory_ivas_fx( st->cldfbSyn ); Copy_Scale_sig_32_16( syn_Overl_fx, st->hTcxDec->syn_Overl, 320, 15 ); Copy_Scale_sig_32_16( fer_samples_fx, st->hHQ_core->fer_samples_fx, 960, 9 ); diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index b45f54d48..e6c08669e 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3743,7 +3743,11 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[ch]->Q_cldfb_state = ( Q6 - 1 ); move16(); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, 0, st_ivas->cldfbSynDec[ch] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col; move16(); @@ -3846,7 +3850,11 @@ void ivas_dirac_dec_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; move32(); } +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, 0, 0, st_ivas->cldfbSynDec[idx_in] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, 0, st_ivas->cldfbSynDec[idx_in] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE*/ IF( !st_ivas->hLsSetupCustom->separate_ch_found ) { @@ -3886,7 +3894,11 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub( ( Q6 - 1 ), st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state ) ); // Q6-1 st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = ( Q6 - 1 ); move16(); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, 0, st_ivas->cldfbSynDec[cldfbSynIdx] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[cldfbSynIdx] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE*/ // Calculating length of output Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col; @@ -3954,8 +3966,11 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, sub( ( Q6 - 1 ), st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state ) ); st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = ( Q6 - 1 ); move16(); - +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, 0, st_ivas->cldfbSynDec[idx_in] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, 0, st_ivas->cldfbSynDec[idx_in] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ // Scaling output from Q6-1 to Q11 Scale_sig32( p_out, out_len, ( Q11 - ( Q6 - 1 ) ) ); diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index 7686a5e8a..30a32c92c 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -1533,7 +1533,11 @@ static void ivas_ism_param_dec_render_sf_fx( Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( sub( Q_real, 1 ), Q11 ) ); // Q_real-1 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub( Q_real, 1 ); move16(); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, 0, st_ivas->cldfbSynDec[ch] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, output_f_fx[ch], i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ Scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( Q11, sub( Q_real, 1 ) ) ); // Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 4c0e7fcc6..5f93c9676 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -2189,8 +2189,13 @@ void ivas_param_mc_dec_render_fx( Word16 len = add( imult1616( slot_idx_start_cldfb_synth, hParamMC->num_freq_bands ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ) ); scale_sig32( output_f_fx[ch], len, 5 - 11 ); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), + imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), 0, 0, st_ivas->cldfbSynDec[ch] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), imult1616( hParamMC->num_freq_bands, hParamMC->subframe_nbslots[subframe_idx] ), 0, st_ivas->cldfbSynDec[ch] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ scale_sig32( output_f_fx[ch], len, 11 - 5 ); // Q11 } diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 40f9f46e2..783b94940 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -866,18 +866,28 @@ static void ivas_mc_paramupmix_dec_sf( RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[ch][slot_idx]; // Q6 ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch][slot_idx]; // Q6 } +#ifndef OPT_AVOID_STATE_BUF_RESCALE scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q5 - Q11 ); // Q11 -> Q5 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5; move16(); cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 0, st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q5 - scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q11 - Q5 ); // Q5 -> Q11 +#else /* OPT_AVOID_STATE_BUF_RESCALE */ + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 6, 0, st_ivas->cldfbSynDec[ch] ); // output_fx returned in Q11 +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ + +#ifndef OPT_AVOID_STATE_BUF_RESCALE + scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, Q11 - Q5 ); // Q5 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } + +#ifndef OPT_AVOID_STATE_BUF_RESCALE FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { Scale_sig32( output_fx[ch], imult1616( maxBand, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx] ), 6 ); // Q5 -> Q11 } +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } ELSE { @@ -903,9 +913,13 @@ static void ivas_mc_paramupmix_dec_sf( ptr_re_fx[0] = Cldfb_RealBuffer_fx[ch][slot_idx]; // Q6 ptr_im_fx[0] = Cldfb_ImagBuffer_fx[ch][slot_idx]; // Q6 - +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), + hMCParamUpmix->num_freq_bands, 0, 0, st_ivas->cldfbSynDec[ch] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( ptr_re_fx, ptr_im_fx, &( pPcm_temp_fx[ch][L_mult0( hMCParamUpmix->num_freq_bands, slot_idx )] ), hMCParamUpmix->num_freq_bands, 0, st_ivas->cldfbSynDec[ch] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, sub( Q11, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); // Q6 -> Q11 st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index a7b66ff87..29a307425 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -787,7 +787,11 @@ void ivas_spar_get_cldfb_gains_fx( cldfbAnalysis_ts_fx_fixed_q( ts_inout_fx, ts_re_fx, ts_im_fx, num_cldfb_bands, cldfbAnaDec0, &q_cldfb ); cldfb_reset_memory_fx( cldfbSynDec0 ); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, 0, 0, cldfbSynDec0 ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( pp_ts_re_fx, pp_ts_im_fx, ts_inout_fx, num_cldfb_bands, 0, cldfbSynDec0 ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ FOR( sample = 0; sample < stride; sample++ ) { T_fx[( ( slot * stride ) + sample )][slot] = ts_inout_fx[sample]; /*Q21*/ @@ -2037,7 +2041,11 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, 0, st_ivas->cldfbSynDec[idx_in] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[idx_in][ts], &cldfb_in_ts_im_fx[idx_in][ts], &output_fx[ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[idx_in] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } } @@ -2052,7 +2060,11 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, 0, st_ivas->cldfbSynDec[out_ch] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( &cldfb_in_ts_re_fx[out_ch][ts], &cldfb_in_ts_im_fx[out_ch][ts], &output_fx[out_ch][i_mult( ts, num_cldfb_bands )], num_cldfb_bands, 6, st_ivas->cldfbSynDec[out_ch] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ } } } diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index c49c32e03..ba165cba4 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -1263,7 +1263,11 @@ void swb_pre_proc_ivas_fx( thr = icbwe_thr_TDM_fx; regV = icbwe_regressionValuesTDM_fx; +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, 0, 0, st->cldfbSynTd ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, 0, st->cldfbSynTd ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); *Q_shb_spch = 0; move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 2376babcd..ce602160f 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -2579,7 +2579,11 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotRePr_fx = &( outSlotRe_fx[0] ); outSlotImPr_fx = &( outSlotIm_fx[0] ); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, 0, cldfbSynDec[chA] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); move16(); } diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 59c93ae55..efa0b35e6 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -4189,7 +4189,11 @@ static void ivas_masa_ext_dirac_render_sf_fx( ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // q_cldfb } Word16 out_size = imult1616( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, 0, 0, hMasaExtRend->cldfbSynRend[idx_in] ); +#else /* OPT_AVOID_STATE_BUF_RESCALE */ cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, 0, hMasaExtRend->cldfbSynRend[idx_in] ); +#endif /* OPT_AVOID_STATE_BUF_RESCALE */ scale_sig32( &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), out_size, sub( 11, q_out ) ); // q11 idx_in++; } -- GitLab From 924d09ab17a9ad80c97a386222f30c5a94a2de29 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 26 Mar 2025 09:25:25 +0100 Subject: [PATCH 256/358] Increase precision of computeTargetPSDs_direct_subframe_fx(). --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 6149ab390..0f1a33ed5 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -4136,10 +4136,12 @@ static void computeTargetPSDs_direct_subframe_fx( Word32 *cy_cross_dir_smooth, /*q_cy_cross_dir_smooth*/ Word16 *q_cy_cross_dir_smooth ) { - Word16 ch_idx, cur_idx, i, q_tmp; #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 @@ -4148,19 +4150,21 @@ static void computeTargetPSDs_direct_subframe_fx( 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(); -#ifndef FIX_867_CLDFB_NRG_SCALE test(); if ( direct_power[i] == 0 && ( direct_power_factor[i] != 0 && reference_power[i] != 0 ) ) { direct_power[i] = 1; move32(); } -#endif } +#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 ) { @@ -4206,9 +4210,15 @@ static void computeTargetPSDs_direct_subframe_fx( 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 - 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_reference_power[0], q_reference_power[1] ) ); - q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp ); + + q_cy_auto_dir_smooth_local[0] = add( add( q_reference_power[0], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_cy_auto_dir_smooth_local[1] = add( add( q_reference_power[1], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ) ) ); + q_cy_auto_dir_smooth[ch_idx] = s_min( q_cy_auto_dir_smooth_local[0], q_cy_auto_dir_smooth_local[1] ); move16(); + + 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 -- GitLab From 9bbc9345c38738574816c2cb73ae7ea75aa8eabc Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 26 Mar 2025 12:20:55 +0100 Subject: [PATCH 257/358] Fix format. --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 0f1a33ed5..8b94a7cf7 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -4216,8 +4216,8 @@ static void computeTargetPSDs_direct_subframe_fx( q_cy_auto_dir_smooth[ch_idx] = s_min( q_cy_auto_dir_smooth_local[0], q_cy_auto_dir_smooth_local[1] ); move16(); - 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 ) ) ); + 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 -- GitLab From b97f83cb78c87f5ddae7f685e963dfcb783f0ed2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Mar 2025 14:16:10 +0100 Subject: [PATCH 258/358] pull ref branch expicitly --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1caf927b..186208f7b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -168,7 +168,7 @@ stages: - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries - git checkout $FLOAT_REF_BRANCH - - git pull + - git pull origin $FLOAT_REF_BRANCH - *activate-debug-mode-info-if-set - make clean - make -j -- GitLab From b5613202ae8beb2147304b73c9af9293e4ed78a0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Mar 2025 14:19:20 +0100 Subject: [PATCH 259/358] [revert-me] only run on specific runner for testing the fix --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 186208f7b..4b998a9b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -479,6 +479,8 @@ stages: stage: check-be needs: ["build-codec-linux-make"] timeout: "300 minutes" + tags: + - "test-fhg-basop-runner-3" variables: XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" -- GitLab From 04d2aba19d0a780fe6f3a91c52929fcd3be34413 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Mar 2025 14:46:43 +0100 Subject: [PATCH 260/358] change more "git pull" occurences --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4b998a9b8..75e7e82c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -184,7 +184,7 @@ stages: - current_commit_sha=$(git rev-parse HEAD) ### build merge target binaries - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - git pull + - git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - *activate-debug-mode-info-if-set - make clean - make -j @@ -232,7 +232,7 @@ stages: - git fetch - git restore . # Just as a precaution - git checkout $BASOP_CI_BRANCH_PC_REPO - - git pull + - git pull origin $BASOP_CI_BRANCH_PC_REPO - cd - - cp -r $SCRIPTS_DIR/ci . - cp -r $SCRIPTS_DIR/scripts . @@ -660,7 +660,7 @@ stages: ### run main now - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - git pull + - git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - make clean - make -j # need to restore cache again -- GitLab From 09dbfd6044f4a695b6102b0cebc356c5316f8d50 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 26 Mar 2025 14:54:23 +0100 Subject: [PATCH 261/358] minimal code cleanup in ivas_smc_gmm_fx(). There were two unncessary IF clauses which could be replaced with L_max. --- lib_enc/speech_music_classif_fx.c | 49 ++++++++++++------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index b9f47136f..a54f9668b 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -856,16 +856,8 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { /*mx = PS_norm[i] > st->past_PS[i] ? PS_norm[i] : st->past_PS[i];*/ - IF( GT_32( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ) - { - mx = PS_norm[i]; - move16(); /*Q25 */ - } - ELSE - { - mx = hSpMusClas->past_PS_fx[i - LOWEST_FBIN]; - move16(); /*Q25 */ - } + mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + move16(); /*Q25 */ /*ps_sta += mx / (dPS[i] + 1e-5f);*/ IF( !dPS[i] ) @@ -1611,7 +1603,7 @@ Word16 ivas_smc_gmm_fx( Word32 ps_fx[N_SMC_MIXTURES], pm_fx[N_SMC_MIXTURES], pn_fx[N_SMC_MIXTURES]; Word64 wprob_fx; Word32 fvm_fx[N_PCA_COEF]; - Word32 sum_PS_fx, ps_diff_fx, ps_sta_fx; + Word32 sum_PS_fx, ps_diff_fx; Word32 dlp_fx, wrelE_fx, wdrop_fx, wght_fx; Word32 wrise_fx; Word16 dlp_mean2var_fx; @@ -1989,32 +1981,29 @@ Word16 ivas_smc_gmm_fx( move32(); /* [14] ps_sta (spectral stationarity) */ - ps_sta_fx = 0; - move32(); - Word16 ps_sta_exp = 0; - move16(); - FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - IF( GT_32( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ) + Word32 ps_sta_fx = 0; + move32(); + Word16 ps_sta_exp = 0; + move16(); + Word32 avoid_divide_by_zero; + avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 + FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - temp32 = BASOP_Util_Divide3232_Scale_cadence( PS_norm_fx[i], ( L_add( dPS_fx[i], L_shr( 21475, sub( 31, Qfact_PS_past ) ) ) ), &temp_exp ); // 31-temp_exp + Word32 tmp_max; + tmp_max = L_max(PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + + temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp move32(); ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); move32(); } - ELSE - { - // ps_sta += hSpMusClas->past_PS[i - LOWEST_FBIN] / ( dPS[i] + 1e-5f ); - temp32 = BASOP_Util_Divide3232_Scale_cadence( hSpMusClas->past_PS_fx[i - LOWEST_FBIN], ( L_add( dPS_fx[i], L_shr( 21475, sub( 31, Qfact_PS_past ) ) ) ), &temp_exp ); // 31-temp_exp - ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); - } + temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); + temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ + *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); + move32(); + MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); } - // temp32_log = L_add( BASOP_Util_Log2( L_add( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ - *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); - move32(); - MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); /* save ps_diff and ps_sta features for XTALK and UNCLR classifier */ IF( hStereoClassif != NULL ) -- GitLab From 161bea50e3dfc1c9890e2863bfb1502e84199de0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Mar 2025 14:54:52 +0100 Subject: [PATCH 262/358] Revert "[revert-me] only run on specific runner for testing the fix" This reverts commit b5613202ae8beb2147304b73c9af9293e4ed78a0. --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 75e7e82c6..13b498f74 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -479,8 +479,6 @@ stages: stage: check-be needs: ["build-codec-linux-make"] timeout: "300 minutes" - tags: - - "test-fhg-basop-runner-3" variables: XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" -- GitLab From 20b8d705772047937dcd8b4fae794d73f98f6c58 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 26 Mar 2025 15:24:44 +0100 Subject: [PATCH 263/358] applied the clang patch. --- lib_enc/speech_music_classif_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index a54f9668b..fe0839954 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1991,7 +1991,7 @@ Word16 ivas_smc_gmm_fx( FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { Word32 tmp_max; - tmp_max = L_max(PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp move32(); -- GitLab From e4410825eee7d4f4f290c6d079c1b17e4d5ccc61 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 26 Mar 2025 15:40:37 +0530 Subject: [PATCH 264/358] Fix for MSAN error observed with decoder pipeline --- lib_dec/ivas_core_dec_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 588640d0a..03f0e4b40 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -73,6 +73,8 @@ ivas_error ivas_core_dec_fx( Word16 tmp16, tmp16_2, j; Word16 Q_white_exc; + set16_fx( tmp_buffer_fx, 0, L_FRAME48k ); + Word16 tmps, incr; Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; -- GitLab From 6c3e64c4387a3f131c09bf634bc35fccf3100940 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 26 Mar 2025 21:17:42 +0530 Subject: [PATCH 265/358] Fix for crash observed with -10dB LTV test case on decoder pipeline --- lib_dec/fd_cng_dec_fx.c | 19 +++++++++++++++++-- lib_dec/ivas_ism_dtx_dec_fx.c | 7 ++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 2f9c567c1..4c42a7959 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1531,7 +1531,15 @@ Word16 ApplyFdCng_ivas_fx( move16(); /* This sets the new CNG levels until a SID update overwrites it */ Copy32( hFdCngDec->bandNoiseShape, cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ); /* This sets the new CNG levels until a SID update overwrites it */ /*Q31 - hFdCngDec->bandNoiseShape_exp*/ - *cngNoiseLevel_exp = hFdCngDec->bandNoiseShape_exp; + + Word16 shift1 = L_norm_arr( cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ); + Word16 shift2 = L_norm_arr( cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ) ); + Word16 shift = s_max( sub( hFdCngDec->bandNoiseShape_exp, shift1 ), sub( *cngNoiseLevel_exp, shift2 ) ); + + scale_sig32( cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( sub( hFdCngDec->bandNoiseShape_exp, shift1 ), shift ) ); + scale_sig32( cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ), sub( sub( *cngNoiseLevel_exp, shift2 ), shift ) ); + + *cngNoiseLevel_exp = shift; move16(); /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ @@ -5059,7 +5067,14 @@ void FdCng_decodeSID_ivas_fx( } scalebands( sidNoiseEst, hFdCngCom->part, hFdCngCom->npart, hFdCngCom->midband, hFdCngCom->nFFTpart, sub( hFdCngCom->stopBand, hFdCngCom->startBand ), hFdCngCom->cngNoiseLevel, 1 ); - hFdCngCom->cngNoiseLevelExp = hFdCngCom->sidNoiseEstExp; + Word16 shift1 = L_norm_arr( hFdCngCom->cngNoiseLevel, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) ); + Word16 shift2 = L_norm_arr( hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) ) ); + Word16 shift = s_max( sub( hFdCngCom->sidNoiseEstExp, shift1 ), sub( hFdCngCom->cngNoiseLevelExp, shift2 ) ); + + scale_sig32( hFdCngCom->cngNoiseLevel, sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( sub( hFdCngCom->sidNoiseEstExp, shift1 ), shift ) ); + scale_sig32( hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopBand, hFdCngCom->startBand ), sub( FFTCLDFBLEN, sub( hFdCngCom->stopBand, hFdCngCom->startBand ) ), sub( sub( hFdCngCom->cngNoiseLevelExp, shift2 ), shift ) ); + + hFdCngCom->cngNoiseLevelExp = shift; move16(); lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, st->preemph_fac ); diff --git a/lib_dec/ivas_ism_dtx_dec_fx.c b/lib_dec/ivas_ism_dtx_dec_fx.c index 0f023a7ef..73ea5cd1f 100644 --- a/lib_dec/ivas_ism_dtx_dec_fx.c +++ b/lib_dec/ivas_ism_dtx_dec_fx.c @@ -181,7 +181,12 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( cng_noise_nrg_obj_fx = dotp_fixed_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9, &Q_cng_noise_nrg_obj ); /*Resultant Q_cng_noise_nrg_obj= (Q_cng_noise_nrg_obj-x)<=31*/ IF( GT_32( cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx ) ) { - Word32 temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx ); /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/ + Word32 temp = 0; + move32(); + IF( L_shr( cng_noise_nrg_dominant_fx, 1 ) ) + { + temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx ); /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/ + } Word16 Q_temp = add( sub( sub( Q_cng_noise_nrg_dominant, 1 ), Q_cng_noise_nrg_obj ), 15 ); /*Stores resultant Q after divide3232 operation above*/ IF( EQ_16( Q_temp % 2, 1 ) ) /*Making Q_temp even for sqrt function*/ { -- GitLab From 5f567820d4191cc81f2980331fa3ed0b1176e3a7 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Mar 2025 19:46:19 +0530 Subject: [PATCH 266/358] Fix for 3GPP issue 1397: Stereo Encoder: 48 kbit/s DTX on, click in LTV Link #1397 --- lib_enc/fd_cng_enc_fx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 9c3a236d7..e51e2b682 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -2839,16 +2839,19 @@ void FdCngEncodeMDCTStereoSID_fx( { IF( lr_in_ptr_fx[ch][p] ) { - t1 = BASOP_Util_Log2( lr_in_ptr_fx[ch][p] ); // Q25 - t2 = L_add( t1, L_shl( lr_in_ptr_e[ch], Q25 ) ); // Q25 + t1 = BASOP_Util_Log2( lr_in_ptr_fx[ch][p] ); // Q25 + t2 = L_add( t1, L_shl( lr_in_ptr_e[ch], Q25 ) ); // Q25 + ms_ptr_fx[ch][p] = Mpy_32_32( t2, TEN_MULT_LOG10_2_IN_Q29 ); // Q23 + move32(); } ELSE { - t2 = 0; + // 10.f * log10f( EPSILON ) --> -150.0f + // Subsequent additions / subtractions happen on these numbers, so to avoid saturations + // this value is set to -128.0f in Q23 + ms_ptr_fx[ch][p] = -ONE_IN_Q30; // Q23 move32(); } - ms_ptr_fx[ch][p] = Mpy_32_32( t2, TEN_MULT_LOG10_2_IN_Q29 ); // Q23 - move32(); E_fx[ch] = L_add( E_fx[ch], L_shr( ms_ptr_fx[ch][p], 4 ) ); // Q19 move32(); } -- GitLab From c27356358db7765ff9c1354ecc13d25583420d47 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Mar 2025 10:21:29 +0100 Subject: [PATCH 267/358] Fix rescale boundaries and simplifications. These changes might have already been commited earlier but were lost ? --- lib_rend/ivas_dirac_rend_fx.c | 124 +++++++++++----------------------- 1 file changed, 40 insertions(+), 84 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index e8a798a1a..573ece7cb 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -4097,37 +4097,31 @@ static void ivas_masa_ext_dirac_render_sf_fx( #ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { - Scale_sig32( reference_power_fix + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q } DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; move16(); } ELSE { - Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + Scale_sig32( reference_power_fix, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; move16(); } IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + 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 } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 + 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } @@ -4179,37 +4173,31 @@ static void ivas_masa_ext_dirac_render_sf_fx( #ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q } DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; move16(); } ELSE { - Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + Scale_sig32( reference_power_fix, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; move16(); } IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + 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 } DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { - Scale_sig32( reference_power_fix, 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 + 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } @@ -4259,37 +4247,31 @@ static void ivas_masa_ext_dirac_render_sf_fx( #ifdef FIX_867_CLDFB_NRG_SCALE IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q } DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; move16(); } ELSE { - Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + Scale_sig32( reference_power_fix, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; move16(); } IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + 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 } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { - Scale_sig32( reference_power_fix, 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 + 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } @@ -4595,44 +4577,28 @@ static void ivas_masa_ext_dirac_render_sf_fx( } #ifdef FIX_867_CLDFB_NRG_SCALE - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + 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 ) - IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + 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 + hSpatParamRendCom->num_freq_bands * 2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands * 3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + hSpatParamRendCom->num_freq_bands * 4, 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 ) + 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 ) } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) - IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + 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 + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 5, 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 ) + 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 ) } 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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + 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 + hSpatParamRendCom->num_freq_bands * 2, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands * 3, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + hSpatParamRendCom->num_freq_bands * 4, CLDFB_NO_CHANNELS_HALF, sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] ), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ); // 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[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(); - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands, 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 ) - IF( GT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + 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 + hSpatParamRendCom->num_freq_bands * 2, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 3, 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 ) - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF + hSpatParamRendCom->num_freq_bands * 4, 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 ) + 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 ) } 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(); @@ -4667,27 +4633,23 @@ 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, 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, 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 ) - Scale_sig32( DirAC_mem.reference_power_fx, 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_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 ) - IF( GT_16( DirAC_mem.reference_power_len, shl( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + 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_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 ) + FOR( i = 0; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( DirAC_mem.reference_power_fx + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 ) - Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 ) - Scale_sig32( DirAC_mem.reference_power_fx + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 ) + 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_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 ) } 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(); 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[1], DirAC_mem.reference_power_q[1] ); move16(); DirAC_mem.reference_power_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ); + move16(); DirAC_mem.reference_power_q[1] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ); move16(); DirAC_mem.reference_power_smooth_q[0] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0], DirAC_mem.reference_power_q[0] ); + 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 @@ -4725,37 +4687,31 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); IF( LT_16( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q - Scale_sig32( reference_power_fix + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q + Scale_sig32( reference_power_fix + i, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_q[0], DirAC_mem.reference_power_smooth_q[0] ) ); // DirAC_mem.reference_power_q } DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; move16(); } ELSE { - Scale_sig32( reference_power_fix, CLDFB_NO_CHANNELS_HALF, sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q + Scale_sig32( reference_power_fix, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( DirAC_mem.reference_power_smooth_q[0], DirAC_mem.reference_power_q[0] ) ); // DirAC_mem.reference_power_smooth_q DirAC_mem.reference_power_q[0] = DirAC_mem.reference_power_smooth_q[0]; move16(); } IF( LT_16( DirAC_mem.reference_power_q[1], DirAC_mem.reference_power_smooth_q[1] ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 1 ), 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 - IF( GT_16( DirAC_mem.reference_power_len, shr( hSpatParamRendCom->num_freq_bands, 1 ) ) ) + FOR( i = hSpatParamRendCom->num_freq_bands; DirAC_mem.reference_power_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 2 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 3 ), 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 - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF + i_mult( hSpatParamRendCom->num_freq_bands, 4 ), 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 + 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 } DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; move16(); } ELSE { - Scale_sig32( reference_power_fix + CLDFB_NO_CHANNELS_HALF, 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 + 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 DirAC_mem.reference_power_q[1] = DirAC_mem.reference_power_smooth_q[1]; move16(); } -- GitLab From fd97a3278968a74991754d649e97fc73a8f36751 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 27 Mar 2025 15:44:31 +0530 Subject: [PATCH 268/358] ASAN error fix in encoder and Missing lowrate_pitchGain added inside enc_pit_exc --- lib_enc/enc_pit_exc_fx.c | 2 ++ lib_enc/mslvq_enc_fx.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 7af329a1c..957e41516 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -775,6 +775,8 @@ void enc_pit_exc_ivas_fx( push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } + st_fx->hSpMusClas->lowrate_pitchGain = mac_r( L_mult( 29491 /* 0.9 in Q15 */, st_fx->hSpMusClas->lowrate_pitchGain ), 3277 /* 0.1 in Q15 */, gain_pit ); /* Q14 */ + gpit_tmp = gain_pit; move16(); /*Q14*/ test(); diff --git a/lib_enc/mslvq_enc_fx.c b/lib_enc/mslvq_enc_fx.c index f15b80655..8f8dd4537 100644 --- a/lib_enc/mslvq_enc_fx.c +++ b/lib_enc/mslvq_enc_fx.c @@ -251,7 +251,7 @@ Word32 mslvq_cng_ivas_fx( move16(); p_inv_sigma = inv_sigma_MSLVQ_fx[mode]; // Q15 move16(); - p_scales = scales_fx[mode_glb]; // Q11 + p_scales = scales_ivas_fx[mode_glb]; // Q11 move16(); no_scales[0] = 0; -- GitLab From e0b4a0bcb3bfdcc39c93349b42520bb70e695132 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 27 Mar 2025 17:43:17 +0100 Subject: [PATCH 269/358] allow failure for complexity number changes see https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/merge_requests/2063 --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13b498f74..a3fa4217b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1750,6 +1750,9 @@ voip-be-on-merge-request: # delete previous jobs logfiles if present (-f flag ensures return calue of 0 even in first run where this folder is not present) - rm -rf COMPLEXITY/logs - which coan + allow_failure: + exit_codes: + - 123 artifacts: name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" when: always -- GitLab From 275083601fc28744d234e543de0f92226eab332e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 09:37:21 +0530 Subject: [PATCH 270/358] inp 12k8 precision improvement through pre_proc_front path --- lib_enc/ivas_core_pre_proc_front_fx.c | 205 ++++++++++++-------------- lib_enc/ivas_cpe_enc_fx.c | 62 ++++---- lib_enc/ivas_ism_enc_fx.c | 23 ++- lib_enc/ivas_sce_enc_fx.c | 11 +- lib_enc/speech_music_classif_fx.c | 8 +- 5 files changed, 145 insertions(+), 164 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 4ff34272f..0eb6d1887 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -87,7 +87,7 @@ ivas_error pre_proc_front_ivas_fx( const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ const Word16 input_frame, /* i : frame length Q0*/ const Word16 n, /* i : channel number Q0*/ - Word16 old_inp_12k8_fx[], /* o : buffer of old input signal Q_new-1*/ + Word16 old_inp_12k8_fx[], /* o : buffer of old input signal (st->Q_inp until preemph, then Q_new, then Q_new-1 towards the end)*/ Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz Q_new-1*/ Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ Word16 *relE_fx, /* o : frame relative energy Q8*/ @@ -149,26 +149,6 @@ ivas_error pre_proc_front_ivas_fx( { st = hCPE->hCoreCoder[n]; } - Word16 old_inp_12k8_e; - Word16 shift = getScaleFactor16( st->old_inp_12k8_fx, 240 ); - Scale_sig( st->old_inp_12k8_fx, 240, shift ); /* exp(st->exp_old_inp_12k8 - shift) */ - st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); - move16(); - shift = getScaleFactor16( old_inp_12k8_fx, 496 ); - Scale_sig( old_inp_12k8_fx, 496, shift ); /* exp(16 - shift) */ - old_inp_12k8_e = sub( Q16, shift ); - IF( GT_16( old_inp_12k8_e, st->exp_old_inp_12k8 ) ) - { - Scale_sig( st->old_inp_12k8_fx, 240, sub( st->exp_old_inp_12k8, old_inp_12k8_e ) ); /* exp(old_inp_12k8_e) */ - st->exp_old_inp_12k8 = old_inp_12k8_e; - move16(); - } - ELSE - { - Scale_sig( old_inp_12k8_fx, 496, sub( old_inp_12k8_e, st->exp_old_inp_12k8 ) ); /* exp(st->exp_old_inp_12k8) */ - old_inp_12k8_e = st->exp_old_inp_12k8; - move16(); - } Word16 q_tmpN_LR[CPE_CHANNELS]; Word16 q_tmpE_LR[CPE_CHANNELS]; @@ -251,41 +231,21 @@ ivas_error pre_proc_front_ivas_fx( temp1F_icatdmResampBuf_fx = (Word16 *) malloc( 45 * sizeof( Word16 * ) ); set16_fx( fft_buff_fx, 0, 512 ); - IF( hSCE != NULL ) - { - Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx, hSCE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_no_sat( hSCE->hCoreCoder[n]->input_fx - input_frame, hSCE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ - hSCE->hCoreCoder[n]->q_inp32 = Q11; - move16(); - Scale_sig( hSCE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ - hSCE->hCoreCoder[n]->q_inp = -1; - move16(); - Scale_sig( hSCE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_old_inp ) ); /* Q(-1) */ - hSCE->hCoreCoder[n]->q_old_inp = -1; - move16(); + Word16 Q_min = add( sub( 15, st->exp_old_inp_12k8 ), norm_arr( st->old_inp_12k8_fx, L_INP_MEM ) ); + Word16 input_frame_full = shl( input_frame, 1 ); //(old frame input length + new frame input length) + Q_min = s_min( Q_min, sub( add( getScaleFactor32( st->input32_fx - input_frame, input_frame_full ), st->q_inp32 ), 16 ) ); + Q_min = s_max( -1, Q_min ); + Copy_Scale_sig_32_16( st->input32_fx - input_frame, st->input_fx - input_frame, input_frame_full, sub( Q_min, st->q_inp32 ) ); // Q_min + st->q_inp = Q_min; + move16(); + st->q_old_inp = Q_min; + move16(); #ifdef DEBUG_MODE_INFO - in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; - in_q_temp = hSCE->hCoreCoder[n]->q_inp32; + in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; + in_q_temp = hSCE->hCoreCoder[n]->q_inp32; #endif - } - ELSE - { - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx, hCPE->hCoreCoder[n]->input32_fx, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[n]->input_fx - input_frame, hCPE->hCoreCoder[n]->input32_fx - input_frame, input_frame, sub( Q11, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q11 */ - hCPE->hCoreCoder[n]->q_inp32 = Q11; - move16(); - Scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_inp ) ); /* Q(-1) */ - hCPE->hCoreCoder[n]->q_inp = -1; - move16(); - Scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_old_inp ) ); /* Q(-1) */ - hCPE->hCoreCoder[n]->q_old_inp = -1; - move16(); -#ifdef DEBUG_MODE_INFO - in_buff_temp = hCPE->hCoreCoder[n]->input32_fx; - in_q_temp = hCPE->hCoreCoder[n]->q_inp32; -#endif - } + #ifdef DEBUG_MODE_INFO if ( !( hCPE != NULL && hCPE->hStereoTD != NULL && ch_idx > 0 ) ) @@ -307,7 +267,7 @@ ivas_error pre_proc_front_ivas_fx( } Word16 sf_energySum[CLDFB_NO_CHANNELS_MAX]; - Word16 Q_to_be_looked_into = -1; + Word16 Q_inp_const = -1; move16(); Word16 headroom = 0, preemp_len = 0, inp_max = 0; move16(); @@ -456,11 +416,6 @@ ivas_error pre_proc_front_ivas_fx( L_look = L_LOOK_12k8; /* lookahead at 12.8kHz */ move16(); - Scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( Q_to_be_looked_into, sub( Q15, old_inp_12k8_e ) ) ); /* Q_to_be_looked_into*/ - old_inp_12k8_e = sub( Q15, Q_to_be_looked_into ); - Scale_sig( st->old_inp_12k8_fx, 240, sub( Q_to_be_looked_into, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* Q_to_be_looked_into */ - st->exp_old_inp_12k8 = sub( Q15, Q_to_be_looked_into ); - move16(); new_inp_12k8_fx = old_inp_12k8_fx + L_INP_MEM; /* pointer to new samples of the input signal in 12.8kHz core */ inp_12k8_fx = new_inp_12k8_fx - L_look; /* pointer to the current frame of input signal in 12.8kHz core */ @@ -471,15 +426,15 @@ ivas_error pre_proc_front_ivas_fx( IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { - Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8 ); /* exp(st->exp_old_inp_12k8) */ + Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { - Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, sub( L_INP_MEM - L_FILT, lMemRecalc_12k8 ) ); /* exp(st->exp_old_inp_12k8) */ + Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, sub( L_INP_MEM - L_FILT, lMemRecalc_12k8 ), sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ } ELSE { - Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - L_FILT ); /* exp(st->exp_old_inp_12k8) */ + Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - L_FILT, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ } Copy( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM ); /* exp(st->exp_old_wsp) */ @@ -504,12 +459,18 @@ ivas_error pre_proc_front_ivas_fx( test(); IF( EQ_16( element_mode, IVAS_SCE ) || ( EQ_16( element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - analysisCldfbEncoder_ivas_fx( st, signal32_in_fx, 11, input_frame, realBuffer_fx, imagBuffer_fx, realBuffer16, imagBuffer16, enerBuffer_fx, enerBuffer_fx_exp, &cldfbScale ); + scale_sig32( signal32_in_fx - input_frame, input_frame_full, sub( 11, st->q_inp32 ) ); // Q11 + st->q_inp32 = 11; + move16(); + analysisCldfbEncoder_ivas_fx( st, signal32_in_fx, st->q_inp32, input_frame, realBuffer_fx, imagBuffer_fx, realBuffer16, imagBuffer16, enerBuffer_fx, enerBuffer_fx_exp, &cldfbScale ); } ELSE IF( ( EQ_16( element_mode, IVAS_CPE_TD ) && st->idchan == 0 ) || ( EQ_16( st->idchan, 1 ) && st->tdm_LRTD_flag ) ) { /* cldfb analysis only for pri. channel */ - analysisCldfbEncoder_ivas_fx( st, signal32_in_fx - NS2SA_FX2( input_Fs, L_MEM_RECALC_TBE_NS ), 11, input_frame, realBuffer_fx, imagBuffer_fx, realBuffer16, imagBuffer16, enerBuffer_fx, enerBuffer_fx_exp, &cldfbScale ); + scale_sig32( signal32_in_fx - input_frame, input_frame_full, sub( 11, st->q_inp32 ) ); // Q11 + st->q_inp32 = 11; + move16(); + analysisCldfbEncoder_ivas_fx( st, signal32_in_fx - NS2SA_FX2( input_Fs, L_MEM_RECALC_TBE_NS ), st->q_inp32, input_frame, realBuffer_fx, imagBuffer_fx, realBuffer16, imagBuffer16, enerBuffer_fx, enerBuffer_fx_exp, &cldfbScale ); } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { @@ -530,16 +491,17 @@ ivas_error pre_proc_front_ivas_fx( * (if not available from downsampled DMX) *----------------------------------------------------------------*/ + Scale_sig( st->mem_decim_fx, 2 * L_FILT_MAX, sub( st->q_inp, Q_inp_const ) ); /* st->q_inp */ test(); IF( EQ_16( element_mode, IVAS_SCE ) ) { - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* Q0 */ - Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ Copy( st->mem_decim_fx, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); - new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* Q0 */ - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { @@ -550,27 +512,38 @@ ivas_error pre_proc_front_ivas_fx( Word16 length_inp = NS2SA_FX2( input_Fs, L_MEM_RECALC_SCH_NS ); Word16 length_12k8 = NS2SA( INT_FS_12k8, L_MEM_RECALC_SCH_NS ); - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx, 0, &Q_new_inp, &mem_decim_size ); /* Q0 */ - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* Q0 */ - Copy( st->mem_decim_fx, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Copy( st->mem_decim_fx, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ IF( lMemRecalc > 0 ) { - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* Q0 */ - Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx + sub( input_frame, lMemRecalc ), lMemRecalc, input_Fs, new_inp_12k8_fx + sub( L_FRAME, lMemRecalc_12k8 ), INT_FS_12k8, mem_decim_dummy_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx + L_FRAME - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); - new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* Q0 */ - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ + Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE /* DFT stereo */ { /* update the FIR resampling filter memory, needed for switching to time-domain (FIR) resampling */ - Copy( signal_in_fx + sub( input_frame, add( NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ), 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ) ), st->mem_decim_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* hSCE->hCoreCoder[n]->q_inp */ + Copy( signal_in_fx + sub( input_frame, add( NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ), 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ) ), st->mem_decim_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ + scale_sig( old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8, sub( Q_inp_const, st->q_inp ) ); + scale_sig( st->input_fx - input_frame, input_frame_full, sub( Q_inp_const, st->q_inp ) ); + Scale_sig( st->mem_decim_fx, 2 * L_FILT_MAX, sub( Q_inp_const, st->q_inp ) ); /* Q(-1) */ + st->q_inp = Q_inp_const; + move16(); + st->q_old_inp = Q_inp_const; + move16(); + } + IF( NE_16( Q_inp_const, st->q_inp ) ) + { + Scale_sig( st->mem_decim_fx, 2 * L_FILT_MAX, sub( Q_inp_const, st->q_inp ) ); /* Q(-1) */ } Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( -1, sub( 15, st->exp_buf_speech_enc ) ) ); /* Q(-1) */ @@ -581,15 +554,15 @@ ivas_error pre_proc_front_ivas_fx( test(); IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { - Copy( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, st->buf_speech_enc + L_FRAME32k - STEREO_DFT_OVL_12k8, L_FRAME + STEREO_DFT_OVL_12k8 ); /* Q_to_be_looked_into */ + Copy_Scale_sig( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, st->buf_speech_enc + L_FRAME32k - STEREO_DFT_OVL_12k8, L_FRAME + STEREO_DFT_OVL_12k8, sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { - Copy( new_inp_12k8_fx - lMemRecalc_12k8, st->buf_speech_enc + L_FRAME32k - lMemRecalc_12k8 - L_FILT, add( L_FRAME + L_FILT, lMemRecalc_12k8 ) ); /* Q_to_be_looked_into */ + Copy_Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, st->buf_speech_enc + L_FRAME32k - lMemRecalc_12k8 - L_FILT, add( L_FRAME + L_FILT, lMemRecalc_12k8 ), sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ } ELSE { - Copy( new_inp_12k8_fx, st->buf_speech_enc + L_FRAME32k, L_FRAME ); /* Q_to_be_looked_into */ + Copy_Scale_sig( new_inp_12k8_fx, st->buf_speech_enc + L_FRAME32k, L_FRAME, sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ } /*------------------------------------------------------------------* @@ -604,14 +577,18 @@ ivas_error pre_proc_front_ivas_fx( move16(); + st->mem_preemph_fx = shl_sat( st->mem_preemph_fx, sub( st->q_inp, -1 ) ); /*st->q_inp*/ + move16(); + st->mem_preemph_DFT_fx = shl_sat( st->mem_preemph_DFT_fx, sub( st->q_inp, -1 ) ); /*st->q_inp*/ + move16(); test(); IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { - Copy( new_inp_12k8_fx - STEREO_DFT_OVL_12k8 + L_FRAME, st->inp_12k8_mem_stereo_sw_fx, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ); /* memory for TD/DFT stereo switching Q_to_be_looked_into*/ + Copy_Scale_sig( new_inp_12k8_fx - STEREO_DFT_OVL_12k8 + L_FRAME, st->inp_12k8_mem_stereo_sw_fx, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, sub( Q_inp_const, st->q_inp ) ); /* memory for TD/DFT stereo switching Q_inp_const*/ - st->mem_preemph_fx = st->mem_preemph_DFT_fx; /* Q(-1) */ + st->mem_preemph_fx = st->mem_preemph_DFT_fx; /* st->q_inp */ move16(); - st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1]; /* Q_new - 1 */ + st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1]; /* st->q_inp */ move16(); // PREEMPH_FX( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx ); @@ -632,9 +609,9 @@ ivas_error pre_proc_front_ivas_fx( { IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { - st->mem_preemph_fx = st->mem_preemph_DFT_fx; + st->mem_preemph_fx = st->mem_preemph_DFT_fx; /* st->q_inp */ move16(); - Copy( st->inp_12k8_mem_stereo_sw_fx, new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ); /* Q(-1) */ + Copy_Scale_sig( st->inp_12k8_mem_stereo_sw_fx, new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, sub( st->q_inp, Q_inp_const ) ); /* st->q_inp */ // PREEMPH_FX( new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), PREEMPH_FAC, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, &st->mem_preemph_fx ); PREEMPH_32FX( new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ), sig_out, PREEMPH_FAC, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT, &st->mem_preemph_fx ); preemp_start_idx = new_inp_12k8_fx - L_MEM_RECALC_12K8 - ( STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ); @@ -643,7 +620,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); } - st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1]; /* == inp_12k8[L_FRAME-1] Q_new - 1 */ + st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1]; /* st->q_inp */ move16(); } @@ -662,7 +639,7 @@ ivas_error pre_proc_front_ivas_fx( // PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx ); PREEMPH_32FX( new_inp_12k8_fx - lMemRecalc_12k8, sig_out + preemp_len, PREEMPH_FAC, L_FRAME, &st->mem_preemph_fx ); - dummy_fx = st->mem_preemph_fx; /* Q(-1) */ + dummy_fx = st->mem_preemph_fx; /* st->q_inp */ move16(); // PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx ); PREEMPH_32FX( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, sig_out + preemp_len + L_FRAME, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx ); @@ -692,12 +669,15 @@ ivas_error pre_proc_front_ivas_fx( preemp_len = L_FRAME + L_FILT; move16(); } + st->mem_preemph_fx = shl_sat( st->mem_preemph_fx, sub( -1, st->q_inp ) ); /*Q(-1) saturation added as float value goes above 65536 for +10 dB test (ltv48_MC512.wav and ltv48_MC51.wav) */ + move16(); + st->mem_preemph_DFT_fx = shl( st->mem_preemph_DFT_fx, sub( -1, st->q_inp ) ); /*Q(-1)*/ + move16(); maximum_abs_32_fx( sig_out, preemp_len, &max_32 ); inp_max = s_max( extract_h( max_32 ), 1 ); - shift = sub( norm_s( inp_max ), headroom ); - Word16 Q_min; + Word16 shift = add( sub( norm_s( inp_max ), headroom ), st->q_inp ); shift = s_max( shift, 0 ); shift = s_min( shift, Q_MAX ); minimum_fx( st->Q_max, L_Q_MEM, &Q_min ); @@ -720,12 +700,12 @@ ivas_error pre_proc_front_ivas_fx( st->Q_max[i] = shift; move16(); - Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, *Q_new ); /* Q_to_be_looked_into + Q_new */ + *Q_new = add( *Q_new, Q_inp_const ); + move16(); - Scale_sig( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ), *Q_new ); /* Q(-1) */ + Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, sub( *Q_new, st->q_inp ) ); /* Q_new */ - *Q_new = add( *Q_new, Q_to_be_looked_into ); - move16(); + Scale_sig( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ), sub( *Q_new, st->q_inp ) ); /* Q_new */ cldfbScale.hb_scale = cldfbScale.lb_scale; move16(); @@ -870,11 +850,10 @@ ivas_error pre_proc_front_ivas_fx( test(); IF( st->idchan == 0 && NE_16( element_mode, IVAS_CPE_MDCT ) ) { - Scale_sig( st->input_fx, 480, negate( Q_to_be_looked_into ) ); /*scaling from Q_to_be_looked_into to q0*/ - - bw_detect_fx( st, st->input_fx, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); + Word16 input_fx_tmp[480]; + Copy_Scale_sig( st->input_fx, input_fx_tmp, shr( input_frame, 1 ), negate( st->q_inp ) ); /*scaling from Q_inp_const to q0*/ - Scale_sig( st->input_fx, 480, Q_to_be_looked_into ); /*scaling back to Q_to_be_looked_into*/ + bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); } @@ -1156,10 +1135,8 @@ ivas_error pre_proc_front_ivas_fx( * LP analysis *----------------------------------------------------------------*/ Word16 stab_fac_fx; - Word16 Q_new_loc; Word16 Q_r[2]; set16_fx( Q_r, 0, 2 ); - Q_new_loc = *Q_new; move16(); alw_pitch_lag_12k8[0] = st->old_pitch_la; /* Q0 */ @@ -1183,7 +1160,7 @@ ivas_error pre_proc_front_ivas_fx( } analy_lp_ivas_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, - INT_FS_12k8, i, Q_new_loc, Q_r ); + INT_FS_12k8, i, *Q_new, Q_r ); FOR( Word16 idx = 0; idx < M + 1; idx++ ) { @@ -1223,6 +1200,9 @@ ivas_error pre_proc_front_ivas_fx( st->mem_wsp_q = *Q_new; move16(); move16(); + scale_sig( old_wsp_fx, L_WSP_MEM, sub( *Q_new, *q_old_wsp ) ); + *q_old_wsp = *Q_new; + move16(); ivas_find_wsp_fx( L_FRAME, L_SUBFR, NB_SUBFR, A_fx, Aw_fx, inp_12k8_fx, TILT_FAC_FX, wsp_fx, &st->mem_wsp_fx, GAMMA1, L_LOOK_12k8 ); @@ -1253,6 +1233,7 @@ ivas_error pre_proc_front_ivas_fx( shift = s_min( add( *q_old_wsp, shift1 ), add( Q_wsp, shift2 ) ); shift = s_min( shift, add( norm_arr( st->mem_decim2_fx, 3 ), st->Q_old_wsp2 ) ); shift = s_min( shift, add( norm_arr( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM ), st->Q_old_wsp2 ) ); + shift = s_min( shift, 15 ); scale_sig( old_wsp_fx, L_WSP_MEM, sub( shift, *q_old_wsp ) ); scale_sig( wsp_fx, L_WSP - L_WSP_MEM, sub( shift, Q_wsp ) ); @@ -1616,12 +1597,6 @@ ivas_error pre_proc_front_ivas_fx( move16(); } - IF( flag_16k_smc ) - { - Scale_sig( st->input_fx, input_frame, sub( -1, st->q_inp ) ); /* Q(-1) */ - st->q_inp = -1; - move16(); - } /* these are for ivas_acelp_tcx20_switching_fx */ Scale_sig32( st->hTcxEnc->spectrum_long_fx, N_MAX, sub( st->hTcxEnc->spectrum_long_e, 16 ) ); /* Q(-1) */ st->hTcxEnc->spectrum_long_e = 16; @@ -1632,6 +1607,12 @@ ivas_error pre_proc_front_ivas_fx( move16(); IF( flag_16k_smc ) { + Scale_sig( st->input_fx - input_frame, input_frame_full, sub( -1, st->q_inp ) ); /* Q(-1) */ + st->q_inp = -1; + move16(); + st->q_old_inp = -1; + move16(); + Word16 Q_old_inp_16k = -1; move16(); @@ -1678,7 +1659,7 @@ ivas_error pre_proc_front_ivas_fx( st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( 0, sub( Q15, st->exp_buf_wspeech_enc ) ) ); // Q0 move16(); - *Q_new = add( *Q_new, Q_to_be_looked_into ); // actual Q_new + *Q_new = add( *Q_new, Q_inp_const ); // actual Q_new move16(); Scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( *Q_new, Q_old_inp_12k8 ) ); /* Q_new */ @@ -1769,9 +1750,15 @@ ivas_error pre_proc_front_ivas_fx( st->exp_old_inp_12k8 = sub( Q15, add( *Q_new, shift ) ); move16(); + Scale_sig( st->input_fx - input_frame, input_frame_full, sub( -1, st->q_inp ) ); + st->q_inp = -1; + move16(); + st->q_old_inp = -1; + move16(); + // Scale_sig( old_inp_12k8_fx, L_INP_12k8, negate( add( *Q_new, 1 ) ) ); - *Q_new = sub( *Q_new, Q_to_be_looked_into ); // ivas_core_enc will assume inp signal (12k8 and 16k) in Q_new - 1 + *Q_new = sub( *Q_new, Q_inp_const ); // ivas_core_enc will assume inp signal (12k8 and 16k) in Q_new - 1 move16(); free( mem_decim_dummy_fx ); diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 72d5d89e8..4e7706baf 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -216,30 +216,29 @@ ivas_error ivas_cpe_enc_fx( #endif } - Copy32( data_fx_ch0, sts[0]->input32_fx, input_frame ); // Q(q_data_fx) - sts[0]->q_inp32 = q_data_fx; + Word16 Q_min = s_min( q_data_fx, add( sts[0]->q_inp32, L_norm_arr( sts[0]->input32_fx - input_frame, input_frame ) ) ); + scale_sig32( sts[0]->input32_fx - input_frame, input_frame, sub( Q_min, sts[0]->q_inp32 ) ); + Copy_Scale_sig32( data_fx_ch0, sts[0]->input32_fx, input_frame, sub( Q_min, q_data_fx ) ); // Q(Q_min) + sts[0]->q_inp32 = Q_min; move16(); + Word16 norm = L_norm_arr( sts[0]->input32_fx, input_frame ); - scale_sig32( sts[0]->input32_fx, input_frame, norm ); - sts[0]->q_inp32 = add( sts[0]->q_inp32, norm ); - move16(); - Copy_Scale_sig32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, 0 ); - sts[0]->q_inp = sub( sts[0]->q_inp32, Q16 ); + Copy_Scale_sig32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, norm ); + sts[0]->q_inp = add( sub( sts[0]->q_inp32, Q16 ), norm ); move16(); IF( data_fx_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ { - Copy32( data_fx_ch1, sts[1]->input32_fx, input_frame ); // Q(q_data_fx) - sts[1]->q_inp32 = q_data_fx; + Q_min = s_min( q_data_fx, add( sts[1]->q_inp32, L_norm_arr( sts[1]->input32_fx - input_frame, input_frame ) ) ); + scale_sig32( sts[1]->input32_fx - input_frame, input_frame, sub( Q_min, sts[1]->q_inp32 ) ); + Copy_Scale_sig32( data_fx_ch1, sts[1]->input32_fx, input_frame, sub( Q_min, q_data_fx ) ); // Q(Q_min) + sts[1]->q_inp32 = Q_min; move16(); norm = L_norm_arr( sts[1]->input32_fx, input_frame ); - scale_sig32( sts[1]->input32_fx, input_frame, norm ); - sts[1]->q_inp32 = add( sts[1]->q_inp32, norm ); - move16(); - Copy_Scale_sig32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, 0 ); - sts[1]->q_inp = sub( sts[1]->q_inp32, Q16 ); + Copy_Scale_sig32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, norm ); + sts[1]->q_inp = add( sub( sts[1]->q_inp32, Q16 ), norm ); move16(); } @@ -369,26 +368,8 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Set TD stereo parameters *----------------------------------------------------------------*/ - Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ - Word16 shift = getScaleFactor32( sts[1]->input32_fx, input_frame ); - scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* Q11 + shift */ - sts[1]->q_inp32 = add( Q11, shift ); - move16(); - - shift = getScaleFactor32( sts[0]->input32_fx, input_frame ); - scale_sig32( sts[0]->input32_fx, input_frame, shift ); /* Q11 + shift */ - sts[0]->q_inp32 = add( Q11, shift ); - move16(); - Q_inp = s_min( Q_inp, s_min( sts[0]->q_inp32, sts[1]->q_inp32 ) ); - scale_sig32( sts[0]->input32_fx, input_frame, sub( Q_inp, sts[0]->q_inp32 ) ); /* Q_inp */ - scale_sig32( sts[1]->input32_fx, input_frame, sub( Q_inp, sts[1]->q_inp32 ) ); /* Q_inp */ - sts[1]->q_inp32 = sts[0]->q_inp32 = Q_inp; - move16(); - move16(); - - IF( ( error = stereo_set_tdm_fx( hCPE, input_frame, Q_inp ) ) != IVAS_ERR_OK ) + IF( ( error = stereo_set_tdm_fx( hCPE, input_frame, sts[1]->q_inp32 ) ) != IVAS_ERR_OK ) { return error; } @@ -397,7 +378,7 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ - shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); + Word16 shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); move16(); @@ -741,6 +722,8 @@ ivas_error ivas_cpe_enc_fx( move16(); } stereo_tdm_downmix_ivas_fx( hCPE->hStereoTD, sts[0]->input_fx, sts[1]->input_fx, input_frame, tdm_ratio_idx, tdm_SM_flag, tdm_ratio_idx_SM ); + Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( sts[0]->q_inp32, sts[0]->q_inp ) ); + Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( sts[1]->q_inp32, sts[1]->q_inp ) ); /* signal the bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; @@ -831,6 +814,9 @@ ivas_error ivas_cpe_enc_fx( move16(); move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); + Scale_sig32( sts[0]->input32_fx - input_frame, add( out_start_ind, input_frame ), sub( Q15, sts[0]->q_inp32 ) ); // scaling initial part of the input buffer + sts[0]->q_inp32 = Q15; + move16(); // Normalise the input buffer from Q15 Word16 input_norm, q_inp32, common_q, fir_delay_len; @@ -890,6 +876,9 @@ ivas_error ivas_cpe_enc_fx( set16_fx( sts[1]->input_fx, 0, input_frame ); sts[1]->q_inp = Q15; move16(); + set32_fx( sts[1]->input32_fx, 0, input_frame ); + sts[1]->q_inp32 = Q31; + move16(); } #ifdef DEBUG_MODE_INFO @@ -1232,6 +1221,9 @@ ivas_error ivas_cpe_enc_fx( Copy( orig_input_fx[n], sts[n]->old_input_signal_fx, input_frame ); /* Q_orig_inp */ sts[n]->q_old_inp = Q_orig_inp[n]; move16(); + Copy_Scale_sig_16_32_no_sat( sts[n]->input_fx - input_frame, sts[n]->input32_fx - input_frame, input_frame, 16 ); // duplicating the data for input32_fx + sts[n]->q_inp32 = add( Q_orig_inp[n], 16 ); + move16(); } } ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) @@ -1239,6 +1231,7 @@ ivas_error ivas_cpe_enc_fx( Copy( sts[0]->input_fx, sts[0]->old_input_signal_fx, input_frame ); /* sts[n]->q_inp */ sts[0]->q_old_inp = sts[0]->q_inp; move16(); + Copy32( sts[0]->input32_fx, sts[0]->input32_fx - input_frame, input_frame ); /* st->q_inp32 */ } ELSE IF( st_ivas->hMCT == NULL ) /* note: in MCT, input buffers are updated later in ivas_mct_enc() */ { @@ -1248,6 +1241,7 @@ ivas_error ivas_cpe_enc_fx( Copy( sts[n]->input_fx, sts[n]->old_input_signal_fx, input_frame ); /* sts[n]->q_inp */ sts[n]->q_old_inp = sts[n]->q_inp; move16(); + Copy32( sts[n]->input32_fx, sts[n]->input32_fx - input_frame, input_frame ); /* st->q_inp32 */ } } diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 7f9962098..81c9e01ef 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -165,10 +165,14 @@ ivas_error ivas_ism_enc_fx( /*------------------------------------------------------------------* * Initialization - general *-----------------------------------------------------------------*/ - Copy32( data[sce_id], st->input32_fx, input_frame ); // Q(q_data) - q_st_inp_16 = sub( L_norm_arr( st->input32_fx, input_frame ), 16 ); - Copy_Scale_sig_32_16( st->input32_fx, st->input_fx, input_frame, q_st_inp_16 ); // q_data -> Q(q_inp + q_data) - st->q_inp = add( q_st_inp_16, q_data ); + Word16 Q_min = s_min( q_data, add( st->q_inp32, L_norm_arr( st->input32_fx - input_frame, input_frame ) ) ); + scale_sig32( st->input32_fx - input_frame, input_frame, sub( Q_min, st->q_inp32 ) ); + Copy_Scale_sig32( data[sce_id], st->input32_fx, input_frame, sub( Q_min, q_data ) ); // Q(Q_min) + st->q_inp32 = Q_min; + move16(); + q_st_inp_16 = sub( getScaleFactor32( st->input32_fx, input_frame ), 16 ); + Copy_Scale_sig_32_16( st->input32_fx, st->input_fx, input_frame, q_st_inp_16 ); // Q_min -> Q(q_inp + Q_min) + st->q_inp = add( q_st_inp_16, Q_min ); move16(); st->element_mode = IVAS_SCE; @@ -275,16 +279,6 @@ ivas_error ivas_ism_enc_fx( *-----------------------------------------------------------------*/ /* compute the dominant sce_id using long term energy */ - FOR( Word16 j = 0; j < st_ivas->nchan_transport; j++ ) - { - test(); - IF( st_ivas->hSCE[j] && st_ivas->hSCE[j]->hCoreCoder[0] ) - { - Copy_Scale_sig_16_32_no_sat( st_ivas->hSCE[j]->hCoreCoder[0]->input_fx, st_ivas->hSCE[j]->hCoreCoder[0]->input32_fx, input_frame, sub( Q11, st_ivas->hSCE[j]->hCoreCoder[0]->q_inp ) ); /* Q11 */ - st_ivas->hSCE[j]->hCoreCoder[0]->q_inp32 = Q11; - move16(); - } - } IF( st_ivas->hEncoderConfig->Opt_DTX_ON ) { @@ -480,6 +474,7 @@ ivas_error ivas_ism_enc_fx( Copy( st->input_fx, st->old_input_signal_fx, input_frame ); /* st->q_inp */ st->q_old_inp = st->q_inp; move16(); + Copy32( st->input32_fx, st->input32_fx - input_frame, input_frame ); /* st->q_inp32 */ hSCE->last_element_brate = hSCE->element_brate; /* Q0 */ move32(); diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index b2e0e9c69..f1631ba4f 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -122,10 +122,14 @@ ivas_error ivas_sce_enc_fx( set16_zero_fx( old_inp_12k8_fx[0], L_INP_12k8 ); - Copy32( data_fx, st->input32_fx, input_frame ); // Q(q_data_fx) - q_input = sub( add( L_norm_arr( st->input32_fx, input_frame ), q_data_fx ), 16 ); + Word16 Q_min = s_min( q_data_fx, add( st->q_inp32, L_norm_arr( st->input32_fx - input_frame, input_frame ) ) ); + scale_sig32( st->input32_fx - input_frame, input_frame, sub( Q_min, st->q_inp32 ) ); + Copy_Scale_sig32( data_fx, st->input32_fx, input_frame, sub( Q_min, q_data_fx ) ); // Q(Q_min) + st->q_inp32 = Q_min; + move16(); + q_input = sub( add( L_norm_arr( st->input32_fx, input_frame ), Q_min ), 16 ); - Copy_Scale_sig32_16( st->input32_fx, st->input_fx, input_frame, sub( add( Q16, q_input ), q_data_fx ) ); // Q(q_data_fx) -> Q(q_input) + Copy_Scale_sig32_16( st->input32_fx, st->input_fx, input_frame, sub( add( Q16, q_input ), Q_min ) ); // Q(Q_min) -> Q(q_input) st->q_inp = q_input; move16(); @@ -362,6 +366,7 @@ ivas_error ivas_sce_enc_fx( Copy( st->input_fx, st->old_input_signal_fx, input_frame ); st->q_old_inp = st->q_inp; move16(); + Copy32( st->input32_fx, st->input32_fx - input_frame, input_frame ); /* st->q_inp32 */ hSCE->last_element_brate = hSCE->element_brate; move32(); diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index b9f47136f..63c0d5d54 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -2948,11 +2948,11 @@ void ivas_smc_mode_selection_fx( ton = tonal_det_fx( S_map, st->vad_flag, hSpMusClas->tod_S_map_lt_fx, &hSpMusClas->tod_thr_lt_fx, &hSpMusClas->tod_weight_fx, &hSpMusClas->tod_S_mass_prev_fx, &hSpMusClas->tod_S_mass_lt_fx ); // Q22 /* calculate spectral peak-to-average ratio */ - Word16 shift = sub( add( Q_new, Q_SCALE - 2 ), st->hSpMusClas->Q_tod_lt_Bin_E ); + Word16 shift = sub( st->q_Bin_E, st->hSpMusClas->Q_tod_lt_Bin_E ); FOR( i = 0; i < TOD_NSPEC; i++ ) { // st->hSpMusClas->tod_lt_Bin_E[i] = P2A_FACT * st->hSpMusClas->tod_lt_Bin_E[i] + ( 1 - P2A_FACT ) * st->Bin_E[i]; - st->hSpMusClas->tod_lt_Bin_E_fx[i] = Madd_32_16( L_shl( Mpy_32_16_1( st->hSpMusClas->tod_lt_Bin_E_fx[i], P2A_FACT_FX_Q15 ), shift ), st->Bin_E_fx[i], ( 32767 - P2A_FACT_FX_Q15 ) ); // Q = Q_new + Q_SCALE - 2 + st->hSpMusClas->tod_lt_Bin_E_fx[i] = Madd_32_16( L_shl( Mpy_32_16_1( st->hSpMusClas->tod_lt_Bin_E_fx[i], P2A_FACT_FX_Q15 ), shift ), st->Bin_E_fx[i], ( 32767 - P2A_FACT_FX_Q15 ) ); // Q = st->q_Bin_E + Q_SCALE - 2 move32(); } st->hSpMusClas->Q_tod_lt_Bin_E = add( st->hSpMusClas->Q_tod_lt_Bin_E, shift ); @@ -2969,11 +2969,11 @@ void ivas_smc_mode_selection_fx( IF( LE_32( element_brate, IVAS_16k4 ) ) { - thr_sp2a = L_shl( THR_P2A_HIGH_FX, add( Q_new, Q_SCALE - 2 ) ); // Q = Q_new + Q_SCALE - 2 + thr_sp2a = L_shl( THR_P2A_HIGH_FX, st->q_Bin_E ); // Q = st->q_Bin_E } ELSE { - thr_sp2a = L_shl( THR_P2A_FX, add( Q_new, Q_SCALE - 2 ) ); // Q = Q_new + Q_SCALE - 2 + thr_sp2a = L_shl( THR_P2A_FX, st->q_Bin_E ); // Q = st->q_Bin_E } /* initial 3-way selection of coding modes (ACELP/GSC/TCX) */ -- GitLab From d307078616b59d33498ac589a1055838c9ae11c0 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 12:43:47 +0530 Subject: [PATCH 271/358] Fix for 3GPP issue 1407: BASOP encoder: Distortion Stereo DTX 24.4 kbps, high MLD Link #1407 --- lib_enc/ivas_cpe_enc_fx.c | 53 ++++++++++++++--------------- lib_enc/ivas_stereo_dft_enc_fx.c | 17 +++------ lib_enc/ivas_stereo_dft_td_itd_fx.c | 36 ++++++++++++++------ 3 files changed, 55 insertions(+), 51 deletions(-) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 4e7706baf..be0afc1a4 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -127,6 +127,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new + Word16 q_com; error = IVAS_ERR_OK; move32(); @@ -649,35 +650,31 @@ ivas_error ivas_cpe_enc_fx( hCPE->hStereoDft->Spd_R_smooth_fx_e = sub( hCPE->hStereoDft->Spd_R_smooth_fx_e, temp ); move16(); - shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); - Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[1]->input_fx, input_frame ); - Copy_Scale_sig_32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, sub( add( sts[1]->q_inp, shift ), sts[1]->q_inp32 ) ); /* sts[1]->q_inp + shift */ - sts[1]->q_inp = add( sts[1]->q_inp, shift ); - move16(); - Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[1]->q_inp, sts[1]->q_old_inp ), sts[1]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ - Scale_sig( sts[1]->old_input_signal_fx, input_frame, sub( s_min( sts[1]->q_old_inp, sts[1]->q_inp ), sts[1]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ - sts[1]->q_inp = s_min( sts[1]->q_inp, sts[1]->q_old_inp ); - move16(); - sts[1]->q_old_inp = sts[1]->q_inp; - move16(); - shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); - Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[0]->q_old_inp + shift */ - sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[0]->input_fx, input_frame ); - Copy_Scale_sig_32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, sub( add( sts[0]->q_inp, shift ), sts[0]->q_inp32 ) ); /* sts[0]->q_inp + shift */ - sts[0]->q_inp = add( sts[0]->q_inp, shift ); - move16(); - Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), sts[0]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ - Scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( s_min( sts[0]->q_old_inp, sts[0]->q_inp ), sts[0]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ - sts[0]->q_inp = s_min( sts[0]->q_inp, sts[0]->q_old_inp ); - move16(); - sts[0]->q_old_inp = sts[0]->q_inp; - move16(); + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + q_com = sub( add( L_norm_arr( sts[n]->input32_fx, input_frame ), sts[n]->q_inp32 ), 16 ); + q_com = s_min( q_com, add( norm_arr( sts[n]->old_input_signal_fx, input_frame ), sts[n]->q_old_inp ) ); + q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl ), hCPE->q_input_mem[n] ) ); + + if ( EQ_16( q_com, Q15 ) ) + { + q_com = 0; + move16(); + } + + Copy_Scale_sig_32_16( sts[n]->input32_fx, sts[n]->input_fx, input_frame, sub( q_com, sts[n]->q_inp32 ) ); + sts[n]->q_inp = q_com; + move16(); + + scale_sig( sts[n]->old_input_signal_fx, input_frame, sub( q_com, sts[n]->q_old_inp ) ); + sts[n]->q_old_inp = q_com; + move16(); + + scale_sig( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); + hCPE->q_input_mem[n] = q_com; + move16(); + } stereo_dft_hybrid_ITD_flag_fx( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index cebbc2619..01318af28 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -1064,23 +1064,14 @@ void stereo_dft_enc_analyze_fx( Word16 q_shift, guarded_bits; guarded_bits = find_guarded_bits_fx( NFFT ); - q_shift = sub( getScaleFactor32( pDFT_L, NFFT ), guarded_bits ); - q_shift = s_min( q_shift, sub( getScaleFactor32( pDFT_R, NFFT ), guarded_bits ) ); - FOR( Word16 j = 0; j < NFFT; j++ ) - { - pDFT_L[j] = L_shl( pDFT_L[j], q_shift ); - move32(); - } + q_shift = sub( L_norm_arr( pDFT_L, NFFT ), guarded_bits ); + scale_sig32( pDFT_L, NFFT, q_shift ); DFT_e[0] = sub( DFT_e[0], q_shift ); move16(); - FOR( Word16 j = 0; j < NFFT; j++ ) - { - pDFT_R[j] = L_shl( pDFT_R[j], q_shift ); - move32(); - } - + q_shift = sub( L_norm_arr( pDFT_R, NFFT ), guarded_bits ); + scale_sig32( pDFT_R, NFFT, q_shift ); DFT_e[1] = sub( DFT_e[1], q_shift ); move16(); diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index df4fe3edd..569a5690a 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -380,15 +380,6 @@ void stereo_td_itd_fx( move16(); set16_fx( shift_input, 0, input_frame ); - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - - Scale_sig( &input_mem[n][0], dft_ovl, sts[n]->q_inp - q_input_mem[n] ); // Q(sts[n]->q_inp) - // Scale_sig(&sts[n]->old_input_signal_fx, 1965, sts[n]->q_inp - sts[n]->q_old_inp); - // sts[n]->q_old_inp = sts[n]->q_inp; - q_input_mem[n] = sts[n]->q_inp; - move16(); - } IF( EQ_16( sts[0]->element_mode, IVAS_CPE_MDCT ) ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) @@ -540,7 +531,7 @@ void stereo_td_itd_mdct_stereo_fx( const Word16 input_frame /* i : frame length */ ) { - Word16 i; + Word16 i, n, q_com; Word32 bin_nrgL_fx[STEREO_DFT_N_32k_ENC]; Word16 bin_nrgL_e[STEREO_DFT_N_32k_ENC]; Word32 bin_nrgR_fx[STEREO_DFT_N_32k_ENC]; @@ -584,6 +575,31 @@ void stereo_td_itd_mdct_stereo_fx( /*call ITD function*/ stereo_dft_enc_compute_itd_fx( hCPE, DFT_fx[0], DFT_tmp_e[0], DFT_fx[1], DFT_tmp_e[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL_fx, bin_nrgL_e, bin_nrgR_fx, bin_nrgR_e ); + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + q_com = add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ); + q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame ), hCPE->hCoreCoder[n]->q_old_inp ) ); + q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl ), hCPE->q_input_mem[n] ) ); + + if ( EQ_16( q_com, Q15 ) ) + { + q_com = 0; + move16(); + } + + scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_inp ) ); + hCPE->hCoreCoder[n]->q_inp = q_com; + move16(); + + scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_old_inp ) ); + hCPE->hCoreCoder[n]->q_old_inp = q_com; + move16(); + + scale_sig( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); + hCPE->q_input_mem[n] = q_com; + move16(); + } + /* Time Domain ITD compensation using extrapolation */ stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem ); } -- GitLab From cdb308b8db07cccd2d30a67e92547f673cca4aae Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 14:26:16 +0530 Subject: [PATCH 272/358] Fix for 3GPP issue 1427: Basop Encoder Spectral Gaps in Stereo DTX 13.2 kbps Noisy Signal Link #1427 --- lib_enc/ivas_core_pre_proc_front_fx.c | 51 +++++++++++++++++---------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 0eb6d1887..f4f9d5651 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -56,7 +56,7 @@ #define SCE_SMC_THR 16000 -static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 *enerBuffer_dft_e ); +static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 enerBuffer_dft_e[] ); #ifdef IVAS_FIXED_ENC static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); @@ -222,6 +222,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 imagBuffer16[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word16 res_cod_SNR_M_fx_e[STEREO_DFT_BAND_MAX]; Word16 Qfact_PS, q_lf_E_fx; + Word16 enerBuffer_fx_exp_buf[CLDFB_NO_CHANNELS_MAX]; #ifdef DEBUG_MODE_INFO Word32 *in_buff_temp; Word16 in_q_temp; @@ -474,7 +475,7 @@ ivas_error pre_proc_front_ivas_fx( } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { - calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp ); + calculate_energy_buffer_ivas_fx( hCPE, enerBuffer_fx, st->cldfbAnaEnc->no_channels, input_Fs, enerBuffer_fx_exp_buf ); } ELSE { @@ -841,10 +842,18 @@ ivas_error pre_proc_front_ivas_fx( /*----------------------------------------------------------------* * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ - FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + + IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { - sf_energySum[i] = *enerBuffer_fx_exp; - move16(); + FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + sf_energySum[i] = enerBuffer_fx_exp_buf[i]; + move16(); + } + } + ELSE + { + set16_fx( sf_energySum, *enerBuffer_fx_exp, CLDFB_NO_CHANNELS_MAX ); } test(); @@ -856,6 +865,15 @@ ivas_error pre_proc_front_ivas_fx( bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); } + IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) + { + maximum_fx( sf_energySum, CLDFB_NO_CHANNELS_MAX, enerBuffer_fx_exp ); + FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + enerBuffer_fx[i] = L_shl( enerBuffer_fx[i], sub( sf_energySum[i], *enerBuffer_fx_exp ) ); + move32(); + } + } IF( NE_16( element_mode, IVAS_CPE_MDCT ) ) /* in MDCT stereo, set_bw_stereo() is used instead */ { @@ -1840,7 +1858,7 @@ static void calculate_energy_buffer_ivas_fx( Word32 enerBuffer_dft_fx[], /* o : energy buffer() exp(enerBuffer_dft_e)*/ const Word16 no_channels, /* i : no. of used CLDFB channels Q0*/ const Word32 input_Fs, /* i : input sampling rate Q0*/ - Word16 *enerBuffer_dft_e ) + Word16 enerBuffer_dft_e[] ) { Word16 i, j, guard_bits; Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; @@ -1848,11 +1866,8 @@ static void calculate_energy_buffer_ivas_fx( Word32 *pDFT_DMX_fx; /*q_DFT_DMX_fx*/ Word32 chan_width_bins_fx; Word16 band_res_dft_fx, chan_width_f_fx, start, stop; - Word16 norm_nrg_DMX_fx; - Word64 max_abs_nrg_DMX_fx; + Word16 norm_nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; - max_abs_nrg_DMX_fx = 0; - move64(); Word16 temp_q1 = sub( norm_l( input_Fs ), 1 ); Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); @@ -1884,30 +1899,28 @@ static void calculate_energy_buffer_ivas_fx( *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, W_shr( W_mult_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ), guard_bits ) ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits */ move64(); } - IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) - { - max_abs_nrg_DMX_fx = W_abs( *p_nrg_DMX_fx ); - } + norm_nrg_DMX_fx[i] = W_norm( W_abs( *p_nrg_DMX_fx ) ); + move16(); start = stop; move16(); p_nrg_DMX_fx++; } - norm_nrg_DMX_fx = W_norm( max_abs_nrg_DMX_fx ); FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ { - enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx - 32 */ + enerBuffer_dft_fx[i] = Mpy_32_16_1( W_extract_h( W_shl( nrg_DMX_fx[i], norm_nrg_DMX_fx[i] ) ), 10923 /* 1/3 in Q15 */ ); /* 2 * q_DFT_DMX_fx + 1 - guard_bits + norm_nrg_DMX_fx[i] - 32 */ move32(); + enerBuffer_dft_e[i] = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx[i] ); + move16(); } - *enerBuffer_dft_e = sub( add( shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ), guard_bits ), norm_nrg_DMX_fx ); - move16(); - /* Set remaining entries of enerBuffer to zero */ FOR( ; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_dft_fx[i] = 0; move32(); + enerBuffer_dft_e[i] = 0; + move16(); } return; } -- GitLab From cf8d0c484c6abb583658c0abd34dccff73b50f8d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 15:05:26 +0530 Subject: [PATCH 273/358] Q mismatch fix in stereo_icBWE_enc_ivas_fx stack --- lib_com/deemph.c | 11 ++--- lib_com/prot_fx.h | 1 - lib_dec/ivas_stereo_icbwe_dec_fx.c | 2 +- lib_enc/ivas_stereo_ica_enc_fx.c | 8 ++-- lib_enc/ivas_stereo_icbwe_enc_fx.c | 64 +++++++++++++++++++----------- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/lib_com/deemph.c b/lib_com/deemph.c index c03a050bc..9bc20cb6f 100644 --- a/lib_com/deemph.c +++ b/lib_com/deemph.c @@ -41,26 +41,23 @@ void deemph_fx_32( - Word16 shift, /*scaled output*/ Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ const Word16 L, /* i : vector size */ - Word32 *mem /* i/o: memory (y[-1]) Qx+shift*/ + Word32 *mem /* i/o: memory (y[-1]) Qx*/ ) { Word16 i; - signal[0] = L_add( signal[0], Mpy_32_16_1( ( *mem ), mu ) ); /*Qx*/ + signal[0] = Madd_32_16( signal[0], *mem, mu ); // Qx move32(); FOR( i = 1; i < L; i++ ) { - signal[i] = L_add( signal[i], Mpy_32_16_1( signal[i - 1], mu ) ); /*Qx*/ - signal[i] = L_shl( signal[i], shift ); /*Qx+shift*/ - move32(); + signal[i] = Madd_32_16( signal[i], signal[i - 1], mu ); // Qx move32(); } - *mem = signal[L - 1]; /*Qx+shift*/ + *mem = signal[L - 1]; // Qx move32(); return; diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 851b461bf..ffd1d6032 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1651,7 +1651,6 @@ void deemph_fx( void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, Word16 *mem ); void deemph_fx_32( - Word16 shift, /* i : scaled output */ Word32 *signal, /* i/o: signal */ const Word16 mu, /* i : deemphasis factor */ const Word16 L, /* i : vector size */ diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index c9f7cac92..c7bc98566 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -611,7 +611,7 @@ void stereo_icBWE_dec_fx( Q_syn_shb = tmp; move16(); - deemph_fx_32( 0, shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); + deemph_fx_32( shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); hStereoICBWE->prev_Q_memshbspec = Q_syn_shb; move16(); Copy32( shb_synth_nonref_fx + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD ); /* Q_syn_shb */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 78ea50d7e..a8a088f20 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -408,8 +408,8 @@ static void deEmphResample_fx( /* De-emphasis, 1/(1-mu z^-1), and resample, stage 1 */ - deemph_fx_32( 0, buf1_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[0] ); - deemph_fx_32( 0, buf2_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[1] ); + deemph_fx_32( buf1_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[0] ); + deemph_fx_32( buf2_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[1] ); FOR( i = 0; i < ( input_frame / dsFac1 ); i++ ) { @@ -420,8 +420,8 @@ static void deEmphResample_fx( } /* De-emphasis, 1/(1-mu z^-1), and resample, stage 2 */ - deemph_fx_32( 0, tempBuf1_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[2] ); - deemph_fx_32( 0, tempBuf2_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[3] ); + deemph_fx_32( tempBuf1_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[2] ); + deemph_fx_32( tempBuf2_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[3] ); FOR( i = 0; i < ( input_frame / dsFactor ); i++ ) { diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 02d20543b..eba30f762 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -102,14 +102,15 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( const Word32 *shb_frame_target_fx, /* i : target shb Q31-shb_frame_target_e*/ Word16 shb_frame_target_e, Word32 *shb_synth_nonref_fx, /* o : non-ref shb synth Q31-shb_synth_nonref_e*/ - Word16 shb_synth_nonref_e, + Word16 *shb_synth_nonref_e, Word32 *specMapping_fx, /* i/o: current frame's mapping Qx*/ - Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Qx*/ - Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ + Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Q31-memShbSpecMapping_e*/ + Word16 *memShbSpecMapping_e, + Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ Word16 *memShbSpecXcorr_e ) { Word16 idx; - + Word16 max_exp; Word16 Txx1_fx = 0, Txx2_fx = 0, Txx3_fx = 0, T_desired_fx = 0; Word16 Txx1_e = 0, Txx2_e = 0, Txx3_e = 0, T_desired_e = 0; Word16 T_nonref_target_fx, temp_fx; @@ -136,10 +137,10 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( temp11_fx = dotp_fixed_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */ /* Calculate rxx(1)/rxx(0) of the non ref synth */ - temp0_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx, shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ - temp1_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 1, shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ - temp2_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 2, shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ - temp3_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 3, shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ + temp0_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx, *shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ + temp1_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 1, *shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ + temp2_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 2, *shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ + temp3_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 3, *shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ exp = s_max( *memShbSpecXcorr_e, s_max( s_max( s_max( temp00_exp, temp11_exp ), s_max( temp0_exp, temp1_exp ) ), s_max( temp2_exp, temp3_exp ) ) ); @@ -291,8 +292,19 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( *specMapping_fx = L_deposit_h( specMapping16 ); move32(); + max_exp = s_max( sub( *memShbSpecMapping_e, norm_l( *memShbSpecMapping_fx ) ), *shb_synth_nonref_e ); + + *memShbSpecMapping_fx = L_shl( *memShbSpecMapping_fx, sub( *memShbSpecMapping_e, max_exp ) ); // max_exp + move32(); + *memShbSpecMapping_e = max_exp; + move16(); + + scale_sig32( shb_synth_nonref_fx, L_FRAME16k, sub( *shb_synth_nonref_e, max_exp ) ); // max_exp + *shb_synth_nonref_e = max_exp; + move16(); + /* IC-BWE spec mapping */ - deemph_fx_32( 0, shb_synth_nonref_fx, extract_h( *specMapping_fx ), L_FRAME16k, memShbSpecMapping_fx ); + deemph_fx_32( shb_synth_nonref_fx, specMapping16, L_FRAME16k, memShbSpecMapping_fx ); // shb_synth_nonref_e return idx; } @@ -429,7 +441,7 @@ static void icbwe_dft_stereo_param_ivas_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i : */ Encoder_State *st, /* i/o: */ Word32 *shb_synth_nonref_fx, /* i/o: Q31-shb_synth_nonref_e*/ - Word16 shb_synth_nonref_e /* i/o: */ + Word16 *shb_synth_nonref_e /* i/o: */ ) { Word16 slopeILD_fx; @@ -439,7 +451,7 @@ static void icbwe_dft_stereo_param_ivas_fx( Word32 *nrg_L_fx, *nrg_R_fx, *nrg_DMX_fx; Word32 sum_nrg_L_fx, sum_nrg_R_fx, sum_nrg_DMX_fx; const Word32 spec_table_fx[4] = { -1288490189, -858993459, -429496730, 0 }; // Q31 - const Word16 slope_table_fx16[4] = { -17788, -10577, -4822, 0 }; // Q13 + const Word16 slope_table_fx16[4] = { -278, -165, -75, 0 }; // Q7 BSTR_ENC_HANDLE hBstr = st->hBstr; normFac_fx = 1342177280; /* 1000 * (10/((14400+10400)/2 - (6400+10400)/2)) */ // Q29 @@ -505,6 +517,7 @@ static void icbwe_dft_stereo_param_ivas_fx( IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) { /* Spec Mapping Estimate */ + Word16 max_exp; Word16 tmp1, exp1; Word32 L_tmp, L_tmp1; L_tmp = Mpy_32_32( hStereoICBWE->mem_nrg_L_fx[1], hStereoICBWE->mem_nrg_R_fx[0] ); // hStereoICBWE->mem_nrg_L_fx_e[1] + hStereoICBWE->mem_nrg_R_fx_e[1] @@ -527,10 +540,20 @@ static void icbwe_dft_stereo_param_ivas_fx( } hStereoICBWE->prevSpecMapping_fx = spec_table_fx[spIndx]; // q31 - /* ic bwe spec mapping application */ - deemph_fx_32( 0, shb_synth_nonref_fx, extract_l( L_shr( hStereoICBWE->prevSpecMapping_fx, 16 ) ), L_FRAME16k, &hStereoICBWE->memShbSpecMapping_fx ); // shb_synth_nonref_e - hStereoICBWE->memShbSpecMapping_e = shb_synth_nonref_e; + + max_exp = s_max( *shb_synth_nonref_e, sub( hStereoICBWE->memShbSpecMapping_e, norm_l( hStereoICBWE->memShbSpecMapping_fx ) ) ); + + hStereoICBWE->memShbSpecMapping_fx = L_shl( hStereoICBWE->memShbSpecMapping_fx, sub( hStereoICBWE->memShbSpecMapping_e, max_exp ) ); // max_exp + move32(); + hStereoICBWE->memShbSpecMapping_e = max_exp; + move16(); + + scale_sig32( shb_synth_nonref_fx, L_FRAME16k, sub( *shb_synth_nonref_e, max_exp ) ); + *shb_synth_nonref_e = max_exp; move16(); + + /* ic bwe spec mapping application */ + deemph_fx_32( shb_synth_nonref_fx, extract_h( hStereoICBWE->prevSpecMapping_fx ), L_FRAME16k, &hStereoICBWE->memShbSpecMapping_fx ); // shb_synth_nonref_e } ELSE { @@ -572,7 +595,7 @@ static void icbwe_dft_stereo_param_ivas_fx( move32(); move16(); - gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ + gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ hStereoICBWE->gDes_pastFrame_fx = L_deposit_h( gDes_fx ); /* Q31-exp */ hStereoICBWE->gDes_pastFrame_e = exp; @@ -800,7 +823,7 @@ void stereo_icBWE_enc_ivas_fx( move16(); } - icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, shb_synth_nonref_e ); + icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e ); } ELSE { @@ -1020,14 +1043,7 @@ void stereo_icBWE_enc_ivas_fx( IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) { /* IC BWE spectral mapping */ - Word32 max_abs_val; - maximum_abs_32_fx( shb_synth_nonref_fx, L_FRAME16k, &max_abs_val ); - IF( max_abs_val > 0 ) - { - scale_sig32( shb_synth_nonref_fx, L_FRAME16k, -1 ); - shb_synth_nonref_e = sub( shb_synth_nonref_e, -1 ); - } - spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ + spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ } ELSE { -- GitLab From 272b5e75fb5783e1e393450245399e444392d6e3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 16:33:13 +0530 Subject: [PATCH 274/358] Crash fix when Debugging mode was enabled --- lib_enc/ivas_core_pre_proc_front_fx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 0eb6d1887..ec752e71a 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -242,8 +242,16 @@ ivas_error pre_proc_front_ivas_fx( move16(); #ifdef DEBUG_MODE_INFO - in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; - in_q_temp = hSCE->hCoreCoder[n]->q_inp32; + IF( hSCE != NULL ) + { + in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; + in_q_temp = hSCE->hCoreCoder[n]->q_inp32; + } + ELSE + { + in_buff_temp = hCPE->hCoreCoder[n]->input32_fx; + in_q_temp = hCPE->hCoreCoder[n]->q_inp32; + } #endif -- GitLab From 45965109a47920fd540871b564d4702a2328a2b2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 16:35:27 +0530 Subject: [PATCH 275/358] Fix for 3GPP issue 1018: ParamISM: Ext-Output: Difference in high-band Link #1018 --- lib_com/swb_tbe_com_fx.c | 125 ++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 2a2841966..238b478c5 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,11 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ -#define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 -#define POW_EXC16k_WHTND_FX 178125000 // Q-6 -#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ -#define THR_ENV_ERROR_PLOSIVE_FX 200 /* threshold for envelope error used in plosive detection Q0 */ +#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ +#define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 +#define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 +#define POW_EXC16k_WHTND_FX 178125000 // Q-6 +#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ +#define THR_ENV_ERROR_PLOSIVE_FX 200 /* threshold for envelope error used in plosive detection Q0 */ /*-----------------------------------------------------------------* * Local function prototypes @@ -3958,7 +3959,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word16 exc32k[L_FRAME32k], exc16k[L_FRAME16k]; Word32 pow1, pow22; Word16 scale, temp1, temp2, temp3; - + Word16 Q_White_exc16k; Word16 excTmp2[L_FRAME16k]; Word16 *White_exc16k; Word16 excNoisyEnv[L_FRAME16k]; @@ -3989,12 +3990,13 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word32 White_exc16k_32[L_FRAME16k]; Word16 White_exc16k_tmp[L_FRAME16k]; Word16 Q_temp; - Word16 prev_Q_bwe_exc_fb; - Word16 chk1, chk2; + Word16 prev_Q_bwe_exc_fb, Q_exc16kWhtnd; + Word16 chk1; + Word32 chk2; chk1 = 0; chk2 = 0; move16(); - move16(); + move32(); #if 1 // def ADD_IVAS_TBE_CODE Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k]; @@ -4262,7 +4264,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( } /* normalize the amplitude of the gaussian excitation to that of the LB exc. */ - Word32 pow22_inv = POW_EXC16k_WHTND_FX_INV_SQRT; + Word32 pow22_inv = POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49; move32(); move32(); pow22 = POW_EXC16k_WHTND_FX; @@ -4271,21 +4273,23 @@ void GenShapedSHBExcitation_ivas_dec_fx( // v_multc(White_exc16k, (float)sqrt(pow1 / pow22), White_exc16k, L_FRAME16k); Word16 pow1_exp = sub( Q31, Q_pow1 ); Word32 temp_pow = Sqrt32( pow1, &pow1_exp ); - temp_pow = L_shl( Mpy_32_32( temp_pow, pow22_inv ), pow1_exp ); + temp_pow = Mpy_32_32( temp_pow, pow22_inv ); /*Word16 out_exp; Word32 temp_pow1 = root_a_over_b_fx(pow1, Q_pow1, pow22, Q_pow22, &out_exp); temp_pow1 = L_shl(temp_pow1, out_exp);*/ // v_multc_fixed_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); L_tmp = 0; move32(); + shift = getScaleFactor16( White_exc16k, L_FRAME16k ); FOR( k = 0; k < L_FRAME16k; k++ ) { White_exc16k_32[k] = Mpy_32_16_1( temp_pow, White_exc16k[k] ); move32(); - White_exc16k[k] = round_fx( L_shl( White_exc16k_32[k], sub( *Q_bwe_exc, NOISE_QADJ ) ) ); // Q_bwe_exc - NOISE_QADJ + White_exc16k[k] = round_fx( L_shl( White_exc16k_32[k], shift ) ); // Q_White_exc16k move16(); L_tmp = L_max( L_tmp, L_abs( White_exc16k_32[k] ) ); } + Q_White_exc16k = add( shift, sub( 49 - 31, pow1_exp ) ); Q_temp = norm_l( L_tmp ); IF( L_tmp == 0 ) { @@ -4323,22 +4327,24 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* calculate pow22 */ /* pow22=0.00001f */ tmp = sub( shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1 ), 31 ); - pow22 = L_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(*Q_bwe_exc-NOISE_QADJ) */ + Word64 sum = W_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(*Q_bwe_exc-NOISE_QADJ) */ + Q_White_exc16k = getScaleFactor32( White_exc16k_32, L_FRAME16k ); FOR( k = 0; k < L_FRAME16k; k++ ) { - /* White_exc16k[k] *= excNoisyEnv[k]; */ - White_exc16k[k] = mult_r( excNoisyEnv[k], shl( White_exc16k[k], 1 ) ); // Q_excTmp2 + 5 + 1 - 15 ==> Q_excTmp2 - 9 - move16(); - chk2 = s_or( chk2, White_exc16k[k] ); + + White_exc16k[k] = extract_h( L_shl( White_exc16k_32[k], Q_White_exc16k ) ); // Q_excTmp2 + 6 + Q_White_exc16k - 16 ==> Q_excTmp2 + Q_White_exc16k - 10 + chk2 = L_or( chk2, White_exc16k_32[k] ); /* i: excNoisyEnv in (Q_excTmp2) */ /* i: White_exc16k in Q6 */ - /* o: White_exc16k in (Q_bwe_exc-NOISE_QADJ) */ + /* o: White_exc16k in (Q_White_exc16k) */ /* pow22 += White_exc16k[k] * White_exc16k[k]; */ - pow22 = L_mac0_sat( pow22, White_exc16k[k], White_exc16k[k] ); /* 2*(Q_excTmp2-NOISE_QADJ)*/ + sum = W_mac0_16_16( sum, White_exc16k[k], White_exc16k[k] ); /* 2*(Q_excTmp2 + Q_White_exc16k - 10)*/ + move16(); } - /*Q_pow22 = sub( shl(*Q_bwe_exc,1), 18 );*/ - Q_pow22 = shl( sub( Q_excTmp2, NOISE_QADJ ), 1 ); - Scale_sig( White_exc16k, L_FRAME16k, sub( *Q_bwe_exc, Q_excTmp2 ) ); + Q_pow22 = W_norm( sum ); + pow22 = W_extract_h( W_shl( sum, Q_pow22 ) ); // 2*(Q_excTmp2 + Q_White_exc16k - 10)+Q_pow22-32 + Q_pow22 = sub( add( Q_pow22, shl( sub( add( Q_White_exc16k, Q_excTmp2 ), 10 ), 1 ) ), 32 ); + Q_White_exc16k = add( Q_White_exc16k, sub( Q_excTmp2, 10 ) ); } #if 1 // def ADD_IVAS_TBE_CODE @@ -4625,7 +4631,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( move16(); } } -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( GE_16( element_mode, IVAS_CPE_DFT ) && nlExc16k != NULL ) { @@ -4638,29 +4643,42 @@ void GenShapedSHBExcitation_ivas_dec_fx( temp_fac = Sqrt16(temp_fac, &temp_fac_exp);*/ L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); Word16 temp_fac = round_fx_sat( L_shl_sat( L_tmp, exp ) ); // Q15 + shift = sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ); // v_multc_fixed_16_16(White_exc16k,shr(temp_fac, temp_fac_exp) , mixExc16k, L_FRAME16k); FOR( k = 0; k < L_FRAME16k; k++ ) { - mixExc16k[k] = mult_r( White_exc16k[k], temp_fac ); + mixExc16k[k] = mult_r( shl_sat( White_exc16k[k], shift ), temp_fac ); move16(); } } -#endif tmp = sub( Q_temp, 3 ); FOR( k = 0; k < L_FRAME16k; k++ ) { - White_exc16k_FB[k] = White_exc16k[k]; /* Q_bwe_exc-NOISE_QADJ */ + White_exc16k_FB[k] = White_exc16k[k]; /* Q_White_exc16k */ } prev_Q_bwe_exc_fb = *Q_bwe_exc_fb; move16(); - *Q_bwe_exc_fb = sub( *Q_bwe_exc, NOISE_QADJ ); + *Q_bwe_exc_fb = Q_White_exc16k; move16(); + *tbe_demph = shl_sat( *tbe_demph, sub( Q_White_exc16k, sub( *Q_bwe_exc, NOISE_QADJ ) ) ); deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph ); - /* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */ - /* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */ + *tbe_demph = shl_sat( *tbe_demph, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); -#if 1 // def ADD_IVAS_TBE_CODE + Q_exc16kWhtnd = getScaleFactor16( exc16kWhtnd, L_FRAME16k ); + Q_exc16kWhtnd = add( Q_exc16kWhtnd, *Q_bwe_exc ); + + shift = getScaleFactor16( White_exc16k, L_FRAME16k ); + + shift = s_min( Q_exc16kWhtnd, add( shift, Q_White_exc16k ) ); + scale_sig( exc16kWhtnd, L_FRAME16k, sub( shift, *Q_bwe_exc ) ); + scale_sig( White_exc16k, L_FRAME16k, sub( shift, Q_White_exc16k ) ); + + Q_exc16kWhtnd = Q_White_exc16k = shift; + move16(); + move16(); + *tbe_premph = shl_sat( *tbe_premph, sub( Q_White_exc16k, sub( *Q_bwe_exc, NOISE_QADJ ) ) ); + move16(); test(); IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { @@ -4693,11 +4711,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* mixing of LB and gaussian excitation in the first half of the frame */ FOR( k = 0; k < L_FRAME16k / 2; k++ ) { - // exc16kWhtnd[k] = (float)fact * (White_exc16k[k] * scale) + (float)(1 - fact) * exc16kWhtnd[k]; - // exc16kWhtnd[k] = add(mult_r(fact, mult(shl(White_exc16k[k], *Q_bwe_exc), scale)), mult_r(sub(32767, fact), exc16kWhtnd[k])); - L_tmp = L_add( L_shl( L_mult( fact, mult_r( White_exc16k[k], scale ) ), NOISE_QADJ ), - L_mult( sub( 32767, fact ), exc16kWhtnd[k] ) ); // Q_bwe_exc - exc16kWhtnd[k] = round_fx( L_tmp ); + exc16kWhtnd[k] = mac_r( L_mult( fact, mult_r( White_exc16k[k], scale ) ), + sub( 32767, fact ), exc16kWhtnd[k] ); // Q_exc16kWhtnd move16(); fact = add_sat( fact, step ); scale = add_sat( scale, step_scale ); @@ -4706,11 +4721,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* mixing of LB and gaussian excitation in the second half of the frame */ FOR( ; k < L_FRAME16k; k++ ) { - // exc16kWhtnd[k] = (float)new_fact * White_exc16k[k] + (float)(1 - new_fact) * exc16kWhtnd[k]; - // exc16kWhtnd[k] = add(mult_r(new_fact, shl(White_exc16k[k], *Q_bwe_exc)), mult_r(sub(32767, new_fact), exc16kWhtnd[k])); - L_tmp = L_add( L_shl( L_mult( new_fact, White_exc16k[k] ), NOISE_QADJ ), - mult_r( sub( 32767, new_fact ), exc16kWhtnd[k] ) ); // Q_bwe_exc - exc16kWhtnd[k] = round_fx( L_tmp ); + exc16kWhtnd[k] = mac_r( L_mult( new_fact, White_exc16k[k] ), + sub( 32767, new_fact ), exc16kWhtnd[k] ); // Q_exc16kWhtnd move16(); } } @@ -4718,14 +4730,9 @@ void GenShapedSHBExcitation_ivas_dec_fx( PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); } ELSE -#endif { -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( EQ_16( coder_type, UNVOICED ) || EQ_16( MSFlag, 1 ) ) -#else - IF( EQ_16( coder_type, UNVOICED ) ) -#endif { L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); test(); @@ -4737,16 +4744,12 @@ void GenShapedSHBExcitation_ivas_dec_fx( scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ FOR( k = 0; k < L_FRAME16k; k++ ) { - /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */ - L_tmp = L_mult( White_exc16k[k], scale ); - /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */ - exc16kWhtnd[k] = round_fx_sat( L_shl_sat( L_tmp, NOISE_QADJ ) ); + exc16kWhtnd[k] = mult_r_sat( White_exc16k[k], scale ); move16(); - /* exc16kWhtnd: Q_bwe_exc */ } PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); - /* i/o: exc16kWhtnd (Q_bwe_exc) */ - /* i/o: tbe_premph (Q_bwe_exc) */ + /* i/o: exc16kWhtnd (Q_exc16kWhtnd) */ + /* i/o: tbe_premph (Q_exc16kWhtnd) */ } ELSE { @@ -4809,11 +4812,10 @@ void GenShapedSHBExcitation_ivas_dec_fx( FOR( j = 0; j < lSubFr; j++ ) { /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */ - L_tmp = L_mult( temp2, White_exc16k[k + j] ); /* 16+(Q_bwe_exc-NOISE_QADJ)*/ - L_tmp = L_shl_sat( L_tmp, NOISE_QADJ ); /* 16+(Q_bwe_exc) */ + L_tmp = L_mult( temp2, White_exc16k[k + j] ); exc16kWhtnd[k + j] = mac_r_sat( L_tmp, temp1, exc16kWhtnd[k + j] ); move16(); - /* Q_bwe_exc */ + /* Q_exc16kWhtnd */ } k = add( k, lSubFr ); @@ -4827,19 +4829,18 @@ void GenShapedSHBExcitation_ivas_dec_fx( temp2 = add( temp, shl( temp1, -1 ) ); /* shift right by 1 to avoid overflow */ temp = div_s( temp, temp2 ); /* Q15 */ temp = mult_r( PREEMPH_FAC, temp ); - PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph ); - /* exc16kWhtnd: Q_bwe_exc; - tbe_premph: Q_bwe_exc*/ + /* exc16kWhtnd: Q_exc16kWhtnd; + tbe_premph: Q_exc16kWhtnd*/ } } } + *tbe_premph = shl_sat( *tbe_premph, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); + move16(); + Scale_sig( White_exc16k, L_FRAME16k, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); + Scale_sig( exc16kWhtnd, L_FRAME16k, sub( *Q_bwe_exc, Q_White_exc16k ) ); -#if 1 // def ADD_IVAS_TBE_CODE IF( LT_32( extl_brate, SWB_TBE_2k8 ) ) -#else - IF( LT_32( bitrate, ACELP_24k40 ) ) -#endif { Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 ); /* i: exc16kWhtnd in Q_bwe_exc */ -- GitLab From 3c7d0686de4aba38980c66de793f0ef358436540 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 28 Mar 2025 13:45:15 +0100 Subject: [PATCH 276/358] remove unnecessary moves16(), move32(), keep closer to original code --- lib_enc/speech_music_classif_fx.c | 40 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index fe0839954..067c5b51b 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -856,8 +856,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { /*mx = PS_norm[i] > st->past_PS[i] ? PS_norm[i] : st->past_PS[i];*/ - mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); - move16(); /*Q25 */ + mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); /*Q25 */ /*ps_sta += mx / (dPS[i] + 1e-5f);*/ IF( !dPS[i] ) @@ -1981,29 +1980,26 @@ Word16 ivas_smc_gmm_fx( move32(); /* [14] ps_sta (spectral stationarity) */ + Word32 ps_sta_fx = 0; + move32(); + Word16 ps_sta_exp = 0; + move16(); + Word32 avoid_divide_by_zero; + avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 + + FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - Word32 ps_sta_fx = 0; - move32(); - Word16 ps_sta_exp = 0; - move16(); - Word32 avoid_divide_by_zero; - avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 - FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) - { - Word32 tmp_max; - tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + Word32 tmp_max; + tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); - temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp - move32(); - ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); - move32(); - } - temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ - *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); - move32(); - MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); + temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp + ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); } + temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); + temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ + *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); + move32(); + MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); /* save ps_diff and ps_sta features for XTALK and UNCLR classifier */ IF( hStereoClassif != NULL ) -- GitLab From da9e603319c686969d5186d617c804ec80882239 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 13:55:52 -0400 Subject: [PATCH 277/358] replace EVS push_indice_fx with push_indice (from IVAS) --- lib_com/bitstream_fx.c | 6 +-- lib_com/gs_gains_fx.c | 28 ++++++------- lib_com/hq_tools_fx.c | 4 +- lib_com/pvq_com_fx.c | 2 +- lib_enc/FEC_enc_fx.c | 6 +-- lib_enc/acelp_core_enc_fx.c | 4 +- lib_enc/acelp_core_switch_enc_fx.c | 8 ++-- lib_enc/amr_wb_enc_fx.c | 2 +- lib_enc/avq_cod_fx.c | 20 +++++----- lib_enc/cng_enc_fx.c | 24 +++++------ lib_enc/cod2t32_fx.c | 6 +-- lib_enc/cod4t64_fx.c | 30 +++++++------- lib_enc/decision_matrix_enc_fx.c | 64 +++++++++++++++--------------- lib_enc/enc_amr_wb_fx.c | 4 +- lib_enc/enc_gen_voic_fx.c | 6 +-- lib_enc/enc_higher_acelp_fx.c | 4 +- lib_enc/enc_pit_exc_fx.c | 6 +-- lib_enc/enc_tran_fx.c | 62 ++++++++++++++--------------- lib_enc/enc_uv_fx.c | 2 +- lib_enc/eval_pit_contr_fx.c | 6 +-- lib_enc/fd_cng_enc_fx.c | 12 +++--- lib_enc/gain_enc_fx.c | 20 +++++----- lib_enc/gaus_enc_fx.c | 6 +-- lib_enc/gs_enc_fx.c | 20 +++++----- lib_enc/hq_classifier_enc_fx.c | 8 ++-- lib_enc/hq_core_enc_fx.c | 8 ++-- lib_enc/hq_env_enc_fx.c | 24 +++++------ lib_enc/hq_hr_enc_fx.c | 4 +- lib_enc/hq_lr_enc_fx.c | 62 ++++++++++++++--------------- lib_enc/hvq_enc_fx.c | 2 +- lib_enc/isf_enc_amr_wb_fx.c | 34 ++++++++-------- lib_enc/lsf_enc_fx.c | 18 ++++----- lib_enc/nelp_enc_fx.c | 8 ++-- lib_enc/peak_vq_enc_fx.c | 36 ++++++++--------- lib_enc/pit_enc_fx.c | 8 ++-- lib_enc/ppp_enc_fx.c | 8 ++-- lib_enc/range_enc_fx.c | 8 ++-- lib_enc/stat_noise_uv_enc_fx.c | 2 +- lib_enc/swb_bwe_enc_fx.c | 46 ++++++++++----------- lib_enc/swb_bwe_enc_hr_fx.c | 22 +++++----- lib_enc/swb_bwe_enc_lr_fx.c | 6 +-- lib_enc/swb_tbe_enc_fx.c | 28 ++++++------- lib_enc/tcq_core_enc_fx.c | 4 +- lib_enc/transition_enc_fx.c | 36 ++++++++--------- lib_enc/voiced_enc_fx.c | 2 +- 45 files changed, 363 insertions(+), 363 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index e144c2cc9..667958264 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -240,11 +240,11 @@ Word16 rate2EVSmode( } /*-------------------------------------------------------------------* - * push_indice_fx( ) + * push_indice( ) * * Push a new indice into the buffer *-------------------------------------------------------------------*/ - +#if 0 void push_indice_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ Word16 id, /* i : ID of the indice */ @@ -288,7 +288,7 @@ void push_indice_fx( return; } - +#endif /*-------------------------------------------------------------------* * push_next_indice_fx() * * Push a new indice into the buffer at the next position diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 35236b603..ecfe9aae0 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -1028,7 +1028,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ mean_4g[0] = round_fx( L_tmp ); move16(); idx_g = vquant_fx( mean_4g, Gain_meanNB_fx, mean_4g, Gain_mean_dicNB_fx, 1, 64 ); - push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); + push_indice( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); FOR( i = 0; i < Mbands_gn; i++ ) { @@ -1040,21 +1040,21 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); set16_fx( y_gain_tmp + 10, 0, MBANDS_GN - 10 ); idx_g = vquant_fx( y_gain_tmp, Mean_dic_NB_fx, y_gain_tmp, Gain_dic1_NB_fx, 3, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); IF( LT_32( core_brate, ACELP_9k60 ) ) { idx_g = vquant_fx( y_gain_tmp + 3, Mean_dic_NB_fx + 3, y_gain_tmp + 3, Gain_dic2_NB_fx, 3, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 6, Mean_dic_NB_fx + 6, y_gain_tmp + 6, Gain_dic3_NB_fx, 4, 16 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } ELSE { idx_g = vquant_fx( y_gain_tmp + 3, Mean_dic_NB_fx + 3, y_gain_tmp + 3, Gain_dic2_NBHR_fx, 3, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 6, Mean_dic_NB_fx + 6, y_gain_tmp + 6, Gain_dic3_NBHR_fx, 4, 128 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); } /*add end */ test(); @@ -1122,7 +1122,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); idx_g = vquant_fx( mean_4g, mean_m_fx, mean_4g, mean_gain_dic_fx, 1, 64 ); - push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); + push_indice( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); FOR( i = 0; i < Mbands_gn; i++ ) { @@ -1148,11 +1148,11 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); idx_g = vquant_fx( y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 3, YGain_mean_LR_fx + 3, y_gain_tmp2 + 3, YGain_dic2_LR_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 7, YGain_mean_LR_fx + 7, y_gain_tmp2 + 7, YGain_dic3_LR_fx, 5, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); set16_fx( y_gain_tmp2 + 12, 0, MBANDS_GN - 12 ); /* Update to quantized vector */ @@ -1185,13 +1185,13 @@ Word16 gsc_gainQ_fx( /*Q12*/ ELSE { idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx + 4, y_gain_tmp + 4, YG_dicMR_2_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16_fx + 8, y_gain_tmp + 8, YG_dicMR_3_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } } diff --git a/lib_com/hq_tools_fx.c b/lib_com/hq_tools_fx.c index cf3ce202e..0e00b9428 100644 --- a/lib_com/hq_tools_fx.c +++ b/lib_com/hq_tools_fx.c @@ -2036,7 +2036,7 @@ Word16 calc_nor_delta_hf_fx( /* updating norm & storing delta norm */ add_bits_denv = 2; move16(); - push_indice_fx( hBstr, IND_DELTA_ENV_HQ, sub( bitsforDelta, 2 ), 2 ); + push_indice( hBstr, IND_DELTA_ENV_HQ, sub( bitsforDelta, 2 ), 2 ); FOR( i = num_env_bands; i < nb_sfm; ++i ) { IF( Rsubband[i] != 0 ) @@ -2052,7 +2052,7 @@ Word16 calc_nor_delta_hf_fx( delta = min_delta; /*Q0*/ move16(); } - push_indice_fx( hBstr, IND_DELTA_ENV_HQ, delta - min_delta, bitsforDelta ); + push_indice( hBstr, IND_DELTA_ENV_HQ, delta - min_delta, bitsforDelta ); ynrm[i] = add( ynrm[i], delta ); /*Q0*/ move16(); add_bits_denv = add( add_bits_denv, bitsforDelta ); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 479bc04d9..9cf1226d8 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -622,7 +622,7 @@ void fine_gain_quant_fx( gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); - push_indice_fx( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); + push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); L_tmp = L_mult0( gain_dbq, 21771 ); /* 21771=0.05*log2(10) */ /* 14+17=31 */ L_tmp = L_shr( L_tmp, 15 ); /* Q16 */ diff --git a/lib_enc/FEC_enc_fx.c b/lib_enc/FEC_enc_fx.c index 87243e8d2..69b14eb9b 100644 --- a/lib_enc/FEC_enc_fx.c +++ b/lib_enc/FEC_enc_fx.c @@ -94,7 +94,7 @@ void FEC_encode_fx( index = 3; move16(); } - push_indice_fx( hBstr, IND_FEC_CLAS, index, FEC_BITS_CLS ); + push_indice( hBstr, IND_FEC_CLAS, index, FEC_BITS_CLS ); } /*-----------------------------------------------------------------* @@ -117,7 +117,7 @@ void FEC_encode_fx( tmpS = s_min( tmpS, 31 ); tmpS = s_max( tmpS, 0 ); - push_indice_fx( hBstr, IND_FEC_ENR, tmpS, FEC_BITS_ENR ); + push_indice( hBstr, IND_FEC_ENR, tmpS, FEC_BITS_ENR ); } /*-----------------------------------------------------------------* * Encode last glottal pulse position (8 bits) @@ -157,7 +157,7 @@ void FEC_encode_fx( maxi = add( maxi, 128 ); /* use 8 bits (MSB represent the sign of the pulse) Q0*/ } - push_indice_fx( hBstr, IND_FEC_POS, maxi, FEC_BITS_POS ); + push_indice( hBstr, IND_FEC_POS, maxi, FEC_BITS_POS ); } maxi = 0; move16(); diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index f9f941dbd..795f03403 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -472,7 +472,7 @@ ivas_error acelp_core_enc_fx( IF( nb_bits > 0 ) { Es_pred_enc_fx( &Es_pred_fx, &indice, st_fx->L_frame, res_fx, st_fx->voicing_fx, nb_bits, 0, Q_new ); - push_indice_fx( st_fx->hBstr, IND_ES_PRED, indice, nb_bits ); + push_indice( st_fx->hBstr, IND_ES_PRED, indice, nb_bits ); } @@ -619,7 +619,7 @@ ivas_error acelp_core_enc_fx( WHILE( nBits > 0 ) { i = s_min( nBits, 16 ); // Q0 - push_indice_fx( st_fx->hBstr, IND_UNUSED, 0, i ); + push_indice( st_fx->hBstr, IND_UNUSED, 0, i ); nBits = sub( nBits, i ); // Q0 } } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index f9058b9b9..9b0ed8b58 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -441,7 +441,7 @@ static void encod_gen_voic_core_switch_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*-----------------------------------------------------------------* @@ -489,7 +489,7 @@ static void encod_gen_voic_core_switch_fx( /* write reserved bits */ IF( unbits ) { - push_indice_fx( hBstr, IND_UNUSED, 0, unbits ); + push_indice( hBstr, IND_UNUSED, 0, unbits ); } /*-----------------------------------------------------------------* @@ -838,7 +838,7 @@ static void bwe_switch_enc_fx( } } - push_indice_fx( hBstr, IND_CORE_SWITCHING_AUDIO_DELAY, d1m_fx, AUDIODELAYBITS ); + push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_DELAY, d1m_fx, AUDIODELAYBITS ); tmp = add( i_mult2( d1m_fx, delta_fx ), fdelay_fx ); /* Q0 */ ptmp = &hb_synth_tmp_fx[tmp]; /* Q0 */ @@ -867,7 +867,7 @@ static void bwe_switch_enc_fx( L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */ - push_indice_fx( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); + push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); return; } diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index b1b2257e2..6f46e5c12 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -548,7 +548,7 @@ void amr_wb_enc_fx( * Write VAD information into the bitstream in AMR-WB IO mode *--------------------------------------------------------------------------------------*/ - push_indice_fx( st->hBstr, IND_VAD_FLAG, st->vad_flag, 1 ); + push_indice( st->hBstr, IND_VAD_FLAG, st->vad_flag, 1 ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 962b715cd..b3a49c59e 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -384,20 +384,20 @@ void AVQ_encmux_fx( /* write the unary code */ FOR( ; j > 16; j -= 16 ) { - push_indice_fx( hBstr, nq_ind, 65535, 16 ); + push_indice( hBstr, nq_ind, 65535, 16 ); bits = sub( bits, 16 ); } IF( j > 0 ) { - push_indice_fx( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j ); + push_indice( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j ); bits = sub( bits, j ); } } IF( !overflow ) { /* write the stop bit */ - push_indice_fx( hBstr, nq_ind, 0, 1 ); + push_indice( hBstr, nq_ind, 0, 1 ); bits = sub( bits, 1 ); } @@ -506,13 +506,13 @@ void AVQ_encmux_fx( IF( j > 0 ) { /* write the unary code */ - push_indice_fx( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j ); + push_indice( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j ); } IF( nq[i] != 0 ) { /* write the stop bit */ - push_indice_fx( hBstr, nq_ind, 0, 1 ); + push_indice( hBstr, nq_ind, 0, 1 ); } /*Compute AVQ code book number from unused Bits */ @@ -1099,32 +1099,32 @@ static void wrte_cv( ELSE IF( LT_16( nq, 5 ) ) /* Q2, Q3, Q4 */ { nq4 = shl( nq, 2 ); - push_indice_fx( hBstr, i_ind, I, nq4 ); + push_indice( hBstr, i_ind, I, nq4 ); bits = sub( bits, nq4 ); } ELSE IF( EQ_16( s_and( nq, 1 ), 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */ { - push_indice_fx( hBstr, i_ind, I, 4 * 4 ); + push_indice( hBstr, i_ind, I, 4 * 4 ); bits = sub( bits, 4 * 4 ); /*pos = (int16_t)(nq / 2 - 2);*/ /* Voronoi order determination */ pos = sub( shr( nq, 1 ), 2 ); FOR( j = 0; j < 8; j++ ) { - push_indice_fx( hBstr, kv_ind, kv[j], pos ); + push_indice( hBstr, kv_ind, kv[j], pos ); } bits = sub( bits, shl( pos, 3 ) ); } ELSE /* Q3 + Voronoi extensions r=1,2,3,... */ { - push_indice_fx( hBstr, i_ind, I, 4 * 3 ); + push_indice( hBstr, i_ind, I, 4 * 3 ); bits = sub( bits, 4 * 3 ); /*pos = (int16_t)(nq / 2 - 1);*/ /* Voronoi order determination */ pos = sub( shr( nq, 1 ), 1 ); FOR( j = 0; j < 8; j++ ) { - push_indice_fx( hBstr, kv_ind, kv[j], pos ); + push_indice( hBstr, kv_ind, kv[j], pos ); } bits = sub( bits, shl( pos, 3 ) ); diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index e2b29ba59..221454970 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -975,7 +975,7 @@ void CNG_enc_fx( hTdCngEnc->old_enr_index = enr_index; move16(); - push_indice_fx( hBstr, IND_ENERGY, enr_index, num_bits ); + push_indice( hBstr, IND_ENERGY, enr_index, num_bits ); if ( enr_index == 0 ) { enr_index = -5; @@ -1063,7 +1063,7 @@ void CNG_enc_fx( move16(); } } - push_indice_fx( hBstr, IND_CNG_ENV1, min1_idx, 6 ); + push_indice( hBstr, IND_CNG_ENV1, min1_idx, 6 ); /* get quantized res_env_details */ FOR( i = 0; i < NUM_ENV_CNG; i++ ) { @@ -1122,28 +1122,28 @@ void CNG_enc_fx( /* dithering bit for AMR-WB IO mode is always set to 0 */ IF( EQ_32( st_fx->core_brate, SID_1k75 ) ) { - push_indice_fx( hBstr, IND_DITHERING, 0, 1 ); + push_indice( hBstr, IND_DITHERING, 0, 1 ); } IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 0, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 0, 1 ); } - push_indice_fx( hBstr, IND_CNG_HO, s_min( hTdCngEnc->burst_ho_cnt, 7 ), 3 ); + push_indice( hBstr, IND_CNG_HO, s_min( hTdCngEnc->burst_ho_cnt, 7 ), 3 ); hTdCngEnc->num_ho = m; move16(); - push_indice_fx( hBstr, IND_SID_TYPE, 0, 1 ); + push_indice( hBstr, IND_SID_TYPE, 0, 1 ); test(); IF( LT_32( st_fx->input_Fs, 32000 ) && NE_16( st_fx->element_mode, IVAS_CPE_DFT ) ) { - push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); + push_indice( hBstr, IND_SID_BW, 0, 1 ); *sid_bw = 0; move16(); } @@ -2458,8 +2458,8 @@ static void shb_CNG_encod_fx( idx_ener_fx = s_max( idx_ener_fx, 0 ); } - push_indice_fx( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); - push_indice_fx( hBstr, IND_SID_BW, 1, 1 ); + push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); + push_indice( hBstr, IND_SID_BW, 1, 1 ); hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; move16(); @@ -2470,7 +2470,7 @@ static void shb_CNG_encod_fx( } else { - push_indice_fx( hBstr, IND_UNUSED, 0, 2 ); + push_indice( hBstr, IND_UNUSED, 0, 2 ); } hTdCngEnc->ho_sid_bw = L_shl( L_and( hTdCngEnc->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); hTdCngEnc->ho_sid_bw = L_or( hTdCngEnc->ho_sid_bw, 0x1L ); @@ -2482,7 +2482,7 @@ static void shb_CNG_encod_fx( IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) { hTdCngEnc->ho_sid_bw = L_shl( L_and( hTdCngEnc->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); - push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); + push_indice( hBstr, IND_SID_BW, 0, 1 ); } } diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index a948a4656..dc967e656 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -292,7 +292,7 @@ void acelp_2t32_fx( } { /* write index to array of indices */ - push_indice_fx( hBstr, IND_ALG_CDBK_2T32, index, 12 ); + push_indice( hBstr, IND_ALG_CDBK_2T32, index, 12 ); } return; } @@ -636,11 +636,11 @@ void acelp_1t64_fx( } IF( EQ_16( L_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_ALG_CDBK_1T64, index, 7 ); + push_indice( hBstr, IND_ALG_CDBK_1T64, index, 7 ); } ELSE /* L_subfr == 2*L_SUBFR */ { - push_indice_fx( hBstr, IND_ALG_CDBK_1T64, index, 8 ); + push_indice( hBstr, IND_ALG_CDBK_1T64, index, 8 ); } return; diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index 99b794b42..457a129b8 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -330,11 +330,11 @@ Word16 acelp_4t64_fx( bitcnt = s_and( nbbits, 15 ); FOR( i = 0; i < wordcnt; i++ ) { - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 ); } IF( bitcnt ) { - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt ); + push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt ); } } ELSE @@ -347,7 +347,7 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_1p_N1_fx( ind[k], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 5 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 5 ); } } ELSE IF( EQ_16( nbbits, 36 ) ) @@ -357,7 +357,7 @@ Word16 acelp_4t64_fx( k = i_mult2( track, NPMAXPT ); /* k = track * NPMAXPT;*/ index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 9 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); } } ELSE IF( EQ_16( nbbits, 44 ) ) /* AMR-WB pulse indexing */ @@ -366,14 +366,14 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 13 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) { k = i_mult2( track, NPMAXPT ); index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 9 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); } } ELSE IF( EQ_16( nbbits, 52 ) ) /* AMR-WB pulse indexing */ @@ -382,7 +382,7 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 13 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); } } ELSE IF( EQ_16( nbbits, 64 ) ) /* AMR-WB pulse indexing */ @@ -393,7 +393,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 14 ) & 3 ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); } FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) @@ -402,7 +402,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x3FFF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); } } ELSE IF( EQ_16( nbbits, 72 ) ) @@ -413,7 +413,7 @@ Word16 acelp_4t64_fx( L_index = quant_5p_5N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 10 ) & 0x03FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 10 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 10 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) @@ -422,7 +422,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 14 ) & 3 ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); } FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ ) @@ -431,7 +431,7 @@ Word16 acelp_4t64_fx( L_index = quant_5p_5N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x03FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 10 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 10 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) @@ -440,7 +440,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x3FFF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); } } ELSE IF( EQ_16( nbbits, 88 ) ) @@ -451,7 +451,7 @@ Word16 acelp_4t64_fx( L_index = quant_6p_6N_2_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 11 ) & 0x07FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 11 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 11 ); } FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) @@ -460,7 +460,7 @@ Word16 acelp_4t64_fx( L_index = quant_6p_6N_2_fx( &ind[k], 4 ); index = extract_l( L_index & 0x07FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 11 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 11 ); } } } diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index c95bc9d5b..63a13aa1a 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -449,14 +449,14 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, nBits ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, sub( idx, start_idx ), nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, sub( idx, start_idx ), nBits ); } /* HQ/TCX core switching flag */ num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_MDCT_CORE, 1, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 1, 1 ); } } ELSE @@ -467,7 +467,7 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_CORE, 1, 1 ); + push_indice( hBstr, IND_CORE, 1, 1 ); } } @@ -475,7 +475,7 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_MDCT_CORE, 1, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 1, 1 ); } num_bits = add( num_bits, 2 ); @@ -484,19 +484,19 @@ Word16 signalling_mode1_tcx20_enc_fx( /* write band-width (needed for different I/O sampling rate support) */ IF( EQ_16( st->bwidth, NB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 0, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 0, 2 ); } ELSE IF( EQ_16( st->bwidth, WB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 1, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 1, 2 ); } ELSE IF( EQ_16( st->bwidth, SWB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 2, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 2, 2 ); } ELSE /* st->bwidth == FB */ { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 3, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 3, 2 ); } } } @@ -534,21 +534,21 @@ void signalling_enc_fx( test(); IF( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 0, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 0, 1 ); } ELSE { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 1, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 1, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); } return; @@ -574,7 +574,7 @@ void signalling_enc_fx( IF( EQ_16( ppp_mode, 1 ) || EQ_16( nelp_mode, 1 ) ) { /* 1 bit to distinguish between 2.8kbps PPP/NELP frame and SID frame */ - push_indice_fx( hBstr, IND_CORE, 0, 1 ); + push_indice( hBstr, IND_CORE, 0, 1 ); /* SC-VBR: 0 - PPP_NB, 1 - PPP_WB, 2 - NELP_NB, 3 - NELP_WB */ test(); test(); @@ -586,19 +586,19 @@ void signalling_enc_fx( test(); IF( EQ_16( st_fx->coder_type, VOICED ) && EQ_16( st_fx->bwidth, NB ) && EQ_16( ppp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 0, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 0, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, VOICED ) && NE_16( st_fx->bwidth, NB ) && EQ_16( ppp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 1, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 1, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, UNVOICED ) && EQ_16( st_fx->bwidth, NB ) && EQ_16( nelp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 2, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 2, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, UNVOICED ) && NE_16( st_fx->bwidth, NB ) && EQ_16( nelp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 3, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 3, 2 ); } } ELSE IF( NE_32( st_fx->core_brate, SID_2k40 ) && ( st_fx->core_brate != FRAME_NO_DATA ) ) @@ -606,7 +606,7 @@ void signalling_enc_fx( /* write the ACELP/HQ core selection bit */ IF( GE_32( st_fx->total_brate, ACELP_24k40 ) ) { - push_indice_fx( hBstr, IND_CORE, 0, 1 ); + push_indice( hBstr, IND_CORE, 0, 1 ); } /* find the section in the ACELP signalling table corresponding to bitrate */ @@ -652,7 +652,7 @@ void signalling_enc_fx( idx++; } - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); } /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ @@ -664,11 +664,11 @@ void signalling_enc_fx( test(); IF( EQ_16( st_fx->extl, WB_TBE ) || EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) ) { - push_indice_fx( hBstr, IND_BWE_FLAG, 0, 1 ); + push_indice( hBstr, IND_BWE_FLAG, 0, 1 ); } ELSE IF( EQ_16( st_fx->extl, WB_BWE ) || EQ_16( st_fx->extl, SWB_BWE ) || EQ_16( st_fx->extl, FB_BWE ) ) { - push_indice_fx( hBstr, IND_BWE_FLAG, 1, 1 ); + push_indice( hBstr, IND_BWE_FLAG, 1, 1 ); } } } @@ -678,24 +678,24 @@ void signalling_enc_fx( test(); IF( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 0, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 0, 1 ); } ELSE { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 1, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 1, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); } /* HQ/TCX core switching flag */ - push_indice_fx( hBstr, IND_MDCT_CORE, 0, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 0, 1 ); /* Use ACELP signaling for LR MDCT */ IF( LE_32( st_fx->total_brate, ACELP_16k40 ) ) @@ -719,7 +719,7 @@ void signalling_enc_fx( idx++; } - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); } ELSE { @@ -727,25 +727,25 @@ void signalling_enc_fx( IF( LE_32( st_fx->core_brate, ACELP_64k ) ) { /* write ACELP/HQ core indication flag */ - push_indice_fx( hBstr, IND_CORE, 1, 1 ); + push_indice( hBstr, IND_CORE, 1, 1 ); } /* write band-width (needed for different I/O sampling rate support) */ IF( EQ_16( st_fx->bwidth, NB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 0, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 0, 2 ); } ELSE IF( EQ_16( st_fx->bwidth, WB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 1, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 1, 2 ); } ELSE IF( EQ_16( st_fx->bwidth, SWB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 2, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 2, 2 ); } ELSE /* st_fx->bwidth == FB */ { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 3, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 3, 2 ); } } } diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index 08a20bbb9..4c5268017 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -170,7 +170,7 @@ void encod_amr_wb_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*-----------------------------------------------------------------* @@ -243,7 +243,7 @@ void encod_amr_wb_fx( hVAD->hangover_cnt, &hAmrwb_IO->gain_alpha_fx, &hf_gain_fx[i_subfr / L_SUBFR], add( Q_new, 1 ), st->Q_syn ); } - push_indice_fx( hBstr, IND_HF_GAIN_MODIFICATION, hf_gain_fx[i_subfr / L_SUBFR], 4 ); + push_indice( hBstr, IND_HF_GAIN_MODIFICATION, hf_gain_fx[i_subfr / L_SUBFR], 4 ); } p_Aw += ( M + 1 ); diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 62f740fb2..00c7d28d7 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -179,7 +179,7 @@ void encod_gen_voic_fx( move16(); } - push_indice_fx( hBstr, IND_HARM_FLAG_ACELP, harm_flag_acelp, 1 ); + push_indice( hBstr, IND_HARM_FLAG_ACELP, harm_flag_acelp, 1 ); } /*------------------------------------------------------------------* @@ -239,7 +239,7 @@ void encod_gen_voic_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ @@ -387,7 +387,7 @@ void encod_gen_voic_fx( WHILE( unbits_PI_fx > 0 ) { i = s_min( unbits_PI_fx, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI_fx -= i; } IF( st_fx->Opt_SC_VBR ) diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 64a11be5b..bf248bb5a 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -242,7 +242,7 @@ void transf_cdbk_enc_fx( Ltmp = L_shl( Ltmp, add( e_den, 9 ) ); /* Q18*/ *gain_preQ = round_fx( Ltmp ); /* Q2*/ } - push_indice_fx( st_fx->hBstr, IND_AVQ_GAIN, index, G_AVQ_BITS ); + push_indice( st_fx->hBstr, IND_AVQ_GAIN, index, G_AVQ_BITS ); /*--------------------------------------------------------------* * Encode and multiplex subvectors into bit-stream @@ -276,7 +276,7 @@ void transf_cdbk_enc_fx( WHILE( *unbits > 0 ) { i = s_min( *unbits, 16 ); - push_indice_fx( st_fx->hBstr, IND_UNUSED, 0, i ); + push_indice( st_fx->hBstr, IND_UNUSED, 0, i ); *unbits -= i; } } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 957e41516..3cb2cc066 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -291,7 +291,7 @@ void enc_pit_exc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit;*/ @@ -312,12 +312,12 @@ void enc_pit_exc_fx( IF( GE_32( st_fx->core_brate, MIN_RATE_FCB ) ) { pit_idx = vquant_fx( &gain_pit, mean_gp_fx, &gain_pit, dic_gp_fx, 1, 32 ); /* Q0 */ - push_indice_fx( hBstr, IND_PIT_IDX, pit_idx, 5 ); + push_indice( hBstr, IND_PIT_IDX, pit_idx, 5 ); } ELSE { pit_idx = vquant_fx( &gain_pit, mean_gp_fx, &gain_pit, dic_gp_fx, 1, 16 ); /* Q0 */ - push_indice_fx( hBstr, IND_PIT_IDX, pit_idx, 4 ); + push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 4cda393d5..d6935dd0c 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -327,7 +327,7 @@ Word16 encod_tran_fx( WHILE( unbits_PI > 0 ) { i = s_min( unbits_PI, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI -= i; } @@ -336,72 +336,72 @@ Word16 encod_tran_fx( { IF( EQ_16( tc_subfr, TC_0_0 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_64 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_128 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_192 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } } ELSE /* L_frame == L_FRAME16k */ { IF( tc_subfr == 0 ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 2 ); } ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 2 ); } ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 2, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 2, 2 ); } ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } ELSE IF( EQ_16( tc_subfr, 4 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } } diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 8a77b9e2b..a8612725b 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -153,7 +153,7 @@ void encod_unvoiced_fx( #ifdef DEBUGGING assert( st_fx->acelp_cfg.gains_mode[i_subfr_idx] == 7 && "Error: UC two-stage, only 5+2 gain Q is supported" ); #endif - push_indice_fx( st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx] ); + push_indice( st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx] ); gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index aef5fd637..df629f295 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -409,17 +409,17 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 1 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 3 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 3 ); } } ELSE { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 4 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 4 ); } return last_pit_bin; diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index e51e2b682..2eb13646c 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1217,21 +1217,21 @@ void FdCng_encodeSID_fx( HANDLE_FD_CNG_ENC stenc, /* i/o: pointer to FD_CNG stru } ELSE { - push_indice_fx( hBstr, IND_SID_TYPE, 1, 1 ); - push_indice_fx( hBstr, IND_ACELP_16KHZ, corest->bwidth, 2 ); + push_indice( hBstr, IND_SID_TYPE, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, corest->bwidth, 2 ); IF( EQ_16( corest->L_frame, L_FRAME16k ) ) { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 0, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 0, 1 ); } FOR( i = 0; i < stages_37bits; i++ ) { - push_indice_fx( hBstr, IND_LSF, indices[i], bits_37bits[i] ); + push_indice( hBstr, IND_LSF, indices[i], bits_37bits[i] ); } - push_indice_fx( hBstr, IND_ENERGY, index, 7 ); + push_indice( hBstr, IND_ENERGY, index, 7 ); } /* Interpolate the bin/band-wise levels from the partition levels */ diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index 0321cd763..0ccb31ccf 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -428,7 +428,7 @@ void gain_enc_mless_fx( tmp1 = mult_r( G_PITCH_MAX_MINUS_MIN_TC192_Q13, div_s( 1, sub( shl( 1, nBits ), 1 ) ) ); /*Q13*/ /* set quantization step */ index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_TC192_Q14, tmp1, shl( 1, nBits ) ); move16(); - push_indice_fx( hBstr, IND_GAIN_PIT, index, nBits ); + push_indice( hBstr, IND_GAIN_PIT, index, nBits ); /* gain_code Q */ /**gain_code /= gcode0;*/ @@ -441,7 +441,7 @@ void gain_enc_mless_fx( } index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg ); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits2 ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits2 ); L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/ } @@ -508,7 +508,7 @@ void gain_enc_mless_fx( * search for the best quantizer *-----------------------------------------------------------------*/ index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, qua_table, size ); // Q0 - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); } /* *norm_gain_code = *gain_code / *gain_inov; */ @@ -1108,7 +1108,7 @@ void gain_enc_SQ_fx( tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */ index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0 - push_indice_fx( hBstr, IND_GAIN_PIT, index, nBits_pitch ); + push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); /* gain_code Q */ /* *gain_code /= gcode0; */ @@ -1121,7 +1121,7 @@ void gain_enc_SQ_fx( } index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg ); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits_code ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits_code ); L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); move32(); /*Q16*/ @@ -1601,7 +1601,7 @@ void gain_enc_tc_fx( *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ move32(); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } ELSE { @@ -1632,7 +1632,7 @@ void gain_enc_tc_fx( L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) ); move32(); /* Q14 -> Q16 */ - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } ELSE /* nBits == 3 */ { @@ -1642,7 +1642,7 @@ void gain_enc_tc_fx( L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) ); move32(); /* Q14 -> Q16 */ - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } } @@ -2438,7 +2438,7 @@ void gain_enc_lbr_fx( *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 move32(); { - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); } return; } @@ -3223,7 +3223,7 @@ void gain_enc_amr_wb_fx( *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 move32(); - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); return; } diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index edddc6a88..081cf7ef0 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -96,7 +96,7 @@ Word16 gaus_encode_fx( move16(); /* low bound = -30; stepSize = 1.71875; inv_stepSize = 0.5818181 */ idx = gain_enc_gaus_fx( gain_code, nb_bits, -7680, 28160, 19065 ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_GAIN, idx, nb_bits ); + push_indice( st_fx->hBstr, IND_GAIN, idx, nb_bits ); /*----------------------------------------------------------------* * Total excitation for Unvoiced coders @@ -638,8 +638,8 @@ void gauss2v_fx( idx = cod_2pos_fx( i, j, sign1, sign2, nvec ); /* Q0 */ move16(); - push_indice_fx( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 ); - push_indice_fx( hBstr, IND_TILT_FACTOR, index_delta, 3 ); + push_indice( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 ); + push_indice( hBstr, IND_TILT_FACTOR, index_delta, 3 ); /*----------------------------------------------------------------* * Find quantized gain diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 1642d1253..1a3d2cb56 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -82,16 +82,16 @@ void encod_audio_fx( test(); IF( ( st_fx->element_mode > EVS_MONO ) && st_fx->idchan == 0 ) { - push_indice_fx( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 ); + push_indice( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 ); } #endif IF( attack_flag > 0 ) { - push_indice_fx( hBstr, IND_GSC_ATTACK, 1, 1 ); + push_indice( hBstr, IND_GSC_ATTACK, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_GSC_ATTACK, 0, 1 ); + push_indice( hBstr, IND_GSC_ATTACK, 0, 1 ); } @@ -105,7 +105,7 @@ void encod_audio_fx( IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( NE_16( st_fx->coder_type, INACTIVE ) && ( ( EQ_16( st_fx->element_mode, EVS_MONO ) && GE_32( st_fx->total_brate, ACELP_13k20 ) ) || ( GT_16( st_fx->element_mode, EVS_MONO ) && GT_32( st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG ) && GE_16( st_fx->bwidth, SWB ) && !st_fx->flag_ACELP16k ) ) ) ) { - push_indice_fx( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 ); + push_indice( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 ); } /*---------------------------------------------------------------* * Find and encode the number of subframes @@ -185,12 +185,12 @@ void encod_audio_fx( IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) ) { - push_indice_fx( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 ); + push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 ); } ELSE IF( GE_32( st_fx->core_brate, ACELP_9k60 ) ) { /* nb_subfr_flag can only have the value 0 or 1 */ - push_indice_fx( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 ); + push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 ); } } test(); @@ -227,7 +227,7 @@ void encod_audio_fx( move16(); } Es_pred_enc_fx( &Es_pred, &indice, st_fx->L_frame, res, st_fx->voicing_fx, nb_bits, 0, Q_new ); - push_indice_fx( hBstr, IND_ES_PRED, indice, nb_bits ); + push_indice( hBstr, IND_ES_PRED, indice, nb_bits ); } enc_pit_exc_fx( st_fx, speech, Aw, Aq, Es_pred, res, synth, exc, &T0_tmp, @@ -290,7 +290,7 @@ void encod_audio_fx( { hGSCEnc->noise_lev = s_max( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ); move16(); - push_indice_fx( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 ); + push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 ); } ELSE IF( st_fx->GSC_noisy_speech ) { @@ -300,7 +300,7 @@ void encod_audio_fx( } ELSE { - push_indice_fx( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 ); + push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 ); } /*---------------------------------------------------------------* @@ -931,7 +931,7 @@ void gsc_enc_fx( WHILE( bit > 0 ) { i = s_min( bit, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); bit = sub( bit, i ); } /* Reorder Q bands */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 2b53082f7..300e31e8e 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -258,16 +258,16 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits { IF( GE_16( *hqswb_clas, HQ_GEN_SWB ) ) { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas - 5, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas - 5, bits ); } ELSE { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); } } ELSE { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); } test(); @@ -343,7 +343,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits move16(); } /* write signalling info to the bitstream */ - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); IF( LE_32( st_fx->core_brate, HQ_32k ) && EQ_16( *hqswb_clas, HQ_NORMAL ) ) { diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index ff19cfebc..66430cb8e 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -229,12 +229,12 @@ void hq_core_enc_fx( { IF( Voicing_flag > 0 ) { - push_indice_fx( hBstr, IND_HQ_VOICING_FLAG, 1, 1 ); + push_indice( hBstr, IND_HQ_VOICING_FLAG, 1, 1 ); num_bits = sub( num_bits, 1 ); } ELSE { - push_indice_fx( hBstr, IND_HQ_VOICING_FLAG, 0, 1 ); + push_indice( hBstr, IND_HQ_VOICING_FLAG, 0, 1 ); num_bits = sub( num_bits, 1 ); } } @@ -278,13 +278,13 @@ void hq_core_enc_fx( WHILE( num_bits >= 16 ) { - push_indice_fx( hBstr, IND_UNUSED, 0, 16 ); + push_indice( hBstr, IND_UNUSED, 0, 16 ); num_bits = sub( num_bits, 16 ); } IF( num_bits != 0 ) { - push_indice_fx( hBstr, IND_UNUSED, 0, num_bits ); + push_indice( hBstr, IND_UNUSED, 0, num_bits ); } #ifdef ADD_IVAS_HQ_CODE if ( st->element_mode > EVS_MONO && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) diff --git a/lib_enc/hq_env_enc_fx.c b/lib_enc/hq_env_enc_fx.c index 5d47710ed..f033bd685 100644 --- a/lib_enc/hq_env_enc_fx.c +++ b/lib_enc/hq_env_enc_fx.c @@ -295,13 +295,13 @@ Word16 encode_envelope_indices_fx( /* o : Number of b test(); IF( EQ_16( flag_HQ2, LOW_RATE_HQ_CORE_TRAN ) || EQ_16( flag_HQ2, LOW_RATE_HQ_CORE ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_HMODE, *LCmode, BITS_DE_HMODE ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, difidx[0], BITS_DE_FCOMP ); + push_indice( hBstr, IND_HQ2_DENG_HMODE, *LCmode, BITS_DE_HMODE ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, difidx[0], BITS_DE_FCOMP ); } ELSE { - push_indice_fx( hBstr, IND_LC_MODE, *LCmode, 2 ); - push_indice_fx( hBstr, IND_YNRM, difidx[0], NORM0_BITS ); + push_indice( hBstr, IND_LC_MODE, *LCmode, 2 ); + push_indice( hBstr, IND_YNRM, difidx[0], NORM0_BITS ); } test(); @@ -331,7 +331,7 @@ Word16 encode_envelope_indices_fx( /* o : Number of b m = lshr( m, 1 ); /* Q0 */ } - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); } } ELSE @@ -370,7 +370,7 @@ Word16 encode_envelope_indices_fx( /* o : Number of b move16(); } } - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); prevj = j; move16(); } @@ -419,11 +419,11 @@ Word16 encode_envelope_indices_fx( /* o : Number of b IF( EQ_16( flag_HQ2, LOW_RATE_HQ_CORE ) ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); } ELSE { - push_indice_fx( hBstr, IND_YNRM, m, r ); + push_indice( hBstr, IND_YNRM, m, r ); } prevj = j; @@ -515,11 +515,11 @@ Word16 encode_envelope_indices_fx( /* o : Number of b IF( flag_HQ2 == 0 ) { - push_indice_fx( hBstr, IND_YNRM, v, r ); + push_indice( hBstr, IND_YNRM, v, r ); } ELSE { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); } } } @@ -536,14 +536,14 @@ Word16 encode_envelope_indices_fx( /* o : Number of b r = huffsizn[j]; /* Q0 */ move16(); - push_indice_fx( hBstr, IND_YNRM, m, r ); + push_indice( hBstr, IND_YNRM, m, r ); } } ELSE { FOR( i = 1; i < num_sfm; i++ ) { - push_indice_fx( hBstr, IND_YNRM, difidx[i], NORMI_BITS ); + push_indice( hBstr, IND_YNRM, difidx[i], NORMI_BITS ); } } } diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index 1cd516b43..705db9ecd 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -236,12 +236,12 @@ void hq_hr_enc_fx( IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || EQ_16( hqswb_clas, HQ_GEN_FB ) ) { nf_idx = noise_adjust_fx( t_audio_norm, 12, R, sfm_start, sfm_end, s_max( core_sfm, sub( num_env_bands, 1 ) ) ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); + push_indice( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); } ELSE { nf_idx = noise_adjust_fx( t_audio_norm, 12, R, sfm_start, sfm_end, core_sfm ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); + push_indice( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); } } /* updates */ diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index 9aca0f646..af2780682 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -115,7 +115,7 @@ static void spt_shorten_domain_set_fx( move16(); } } - push_indice_fx( st_fx->hBstr, IND_HQ2_SPT_SHORTEN, spt_shorten_flag[j], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_SPT_SHORTEN, spt_shorten_flag[j], 1 ); *bit_budget = sub( *bit_budget, 1 ); /* Q0 */ move16(); } @@ -313,7 +313,7 @@ void hq_lr_enc_fx( } /* write the classification information into the bitstream */ - push_indice_fx( hBstr, IND_HQ2_SWB_CLAS, hqswb_clas_fx, 2 ); + push_indice( hBstr, IND_HQ2_SWB_CLAS, hqswb_clas_fx, 2 ); ( *num_bits_fx ) = sub( *num_bits_fx, 2 ); move16(); IF( EQ_16( hqswb_clas_fx, HQ_NORMAL ) ) @@ -325,7 +325,7 @@ void hq_lr_enc_fx( ELSE { /* write the transient bit into the bitstream */ - push_indice_fx( st_fx->hBstr, IND_HQ2_SWB_CLAS, is_transient_fx, 1 ); + push_indice( st_fx->hBstr, IND_HQ2_SWB_CLAS, is_transient_fx, 1 ); /* subtract one bit for the transient flag */ ( *num_bits_fx ) = sub( ( *num_bits_fx ), 1 ); @@ -741,7 +741,7 @@ void hq_lr_enc_fx( /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR( i = 0; i < 2; i++ ) { - push_indice_fx( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); } } ELSE IF( is_transient_fx == 0 && EQ_16( inner_frame_fx, L_FRAME16k ) ) @@ -970,7 +970,7 @@ void hq_lr_enc_fx( /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR( i = 0; i < 2; i++ ) { - push_indice_fx( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); } } ELSE IF( EQ_16( st_fx->bwidth, SWB ) && EQ_16( hqswb_clas_fx, HQ_HARMONIC ) && ( EQ_32( L_bwe_br, HQ_16k40 ) || EQ_32( L_bwe_br, HQ_13k20 ) ) ) @@ -2213,7 +2213,7 @@ static Word16 small_symbol_enc_fx( /* o : bits /* Encoding LSB bit packing */ FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, LSB[i], BITS_DE_LSB ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, LSB[i], BITS_DE_LSB ); } } @@ -2526,74 +2526,74 @@ static Word16 large_symbol_enc_fx( /* o : bits /* Encoding MSB bits */ IF( *hLCmode0 == 0 ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE, 0, BITS_DE_8SMODE ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE, 0, BITS_DE_8SMODE ); bits = BITS_DE_8SMODE; move16(); IF( cnt_outlyer0 == 0 ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N0, 0, BITS_DE_8SMODE_N0 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N0, 0, BITS_DE_8SMODE_N0 ); bits = add( bits, BITS_DE_8SMODE_N0 ); IF( EQ_16( cnt_outlyer, 1 ) ) { /* 01 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); + push_indice( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); bits = add( bits, BITS_DE_8SPOS ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); } ELSE { /* 00 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ } FOR( i = 0; i < pos_outlyer; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bitsmode0 = add( bitsmode0, hessize[tdifidx0[i] + 4] ); /* Q0 */ } FOR( i = ( pos_outlyer + 1 ); i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bitsmode0 = add( bitsmode0, hessize[tdifidx0[i] + 4] ); /* Q0 */ } } ELSE IF( EQ_16( cnt_outlyer0, 1 ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N0, 1, BITS_DE_8SMODE_N0 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N0, 1, BITS_DE_8SMODE_N0 ); bits = add( bits, BITS_DE_8SMODE_N0 ); IF( EQ_16( cnt_outlyer, 1 ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); + push_indice( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); bits = add( bits, BITS_DE_8SPOS ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); } ELSE { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); /* Q0 */ } FOR( i = 1; i < pos_outlyer; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bits = add( bits, hessize[tdifidx0[i] + 4] ); /* Q0 */ } FOR( i = pos_outlyer + 1; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bits = add( bits, hessize[tdifidx0[i] + 4] ); /* Q0 */ } } @@ -2601,12 +2601,12 @@ static Word16 large_symbol_enc_fx( /* o : bits ELSE { bits = add( BITS_DE_8SMODE, BITS_MAX_DEPTH ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE, 1, BITS_DE_8SMODE ); - push_indice_fx( hBstr, IND_HQ2_DENG_8SDEPTH, lsbdepth1, BITS_MAX_DEPTH ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE, 1, BITS_DE_8SMODE ); + push_indice( hBstr, IND_HQ2_DENG_8SDEPTH, lsbdepth1, BITS_MAX_DEPTH ); FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx1[i] + 4], hessize[tdifidx1[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx1[i] + 4], hessize[tdifidx1[i] + 4] ); bits = add( bits, hessize[tdifidx1[i] + 4] ); /* Q0 */ } @@ -2614,7 +2614,7 @@ static Word16 large_symbol_enc_fx( /* o : bits { FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, LSB1[i], lsbdepth1 ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, LSB1[i], lsbdepth1 ); } /*bits += BANDS * lsbdepth1; */ bits = add( bits, extract_h( L_shl( L_mult( BANDS, lsbdepth1 ), 15 ) ) ); /* Q0 */ @@ -3115,7 +3115,7 @@ static Word16 band_energy_quant_fx( { deng_cmode = 0; move16(); - push_indice_fx( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); + push_indice( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); large_symbol_enc_fx( hBstr, bq2_fx, bands_fx, &hLCmode0, 1 ); deng_bits = add( ebits, BITS_DE_CMODE ); /* Q0 */ } @@ -3124,7 +3124,7 @@ static Word16 band_energy_quant_fx( /* setting energy difference coding mode and storing it */ deng_cmode = 1; move16(); - push_indice_fx( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); + push_indice( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); deng_bits = add( hbits, BITS_DE_CMODE ); /* Q0 */ @@ -3479,7 +3479,7 @@ static Word16 p2a_threshold_quant_fx( move16(); } - push_indice_fx( hBstr, IND_HQ2_P2A_FLAGS, p2a_flags_fx[k], 1 ); + push_indice( hBstr, IND_HQ2_P2A_FLAGS, p2a_flags_fx[k], 1 ); j = add( j, 1 ); } @@ -3768,7 +3768,7 @@ static void mdct_spectrum_fine_gain_enc_fx( move16(); } - push_indice_fx( st_fx->hBstr, IND_HQ2_SUBBAND_GAIN, imin_fx, gqbits ); + push_indice( st_fx->hBstr, IND_HQ2_SUBBAND_GAIN, imin_fx, gqbits ); } return; diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index b06a1734d..a0acd0bfd 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -335,7 +335,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits q_noise_level[i] = 0; move16(); } - push_indice_fx( st_fx->hBstr, IND_HVQ_BWE_NL, q_noise_level_idx[i], 2 ); + push_indice( st_fx->hBstr, IND_HVQ_BWE_NL, q_noise_level_idx[i], 2 ); bits_used = add( bits_used, 2 ); noise_level[i] = q_noise_level[i]; /* in Q15 */ diff --git a/lib_enc/isf_enc_amr_wb_fx.c b/lib_enc/isf_enc_amr_wb_fx.c index 4851ed155..d58998565 100644 --- a/lib_enc/isf_enc_amr_wb_fx.c +++ b/lib_enc/isf_enc_amr_wb_fx.c @@ -173,11 +173,11 @@ static void qisf_ns_28b_fx( indice[4] = add( sub_VQ_fx( &isf[12], dico5_ns_28b_fx + 4, 4, DICO5_NS_28b - 1, &tmp ), 1 ); /* First vector has a problem -> do not allow */ move16(); /* write indices to array */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 6 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 6 ); - push_indice_fx( hBstr, IND_ISF_0_2, indice[2], 6 ); - push_indice_fx( hBstr, IND_ISF_0_3, indice[3], 5 ); - push_indice_fx( hBstr, IND_ISF_0_4, indice[4], 5 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 6 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 6 ); + push_indice( hBstr, IND_ISF_0_2, indice[2], 6 ); + push_indice( hBstr, IND_ISF_0_3, indice[3], 5 ); + push_indice( hBstr, IND_ISF_0_4, indice[4], 5 ); /* decoding the ISFs */ disf_ns_28b_fx( indice, isf ); @@ -305,11 +305,11 @@ static void qisf_2s_36b_fx( indice[0] = Indirect_dico1[indice[0]]; move16(); /* Make interoperable with G722.2 */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 8 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 8 ); - push_indice_fx( hBstr, IND_ISF_1_0, indice[2], 7 ); - push_indice_fx( hBstr, IND_ISF_1_1, indice[3], 7 ); - push_indice_fx( hBstr, IND_ISF_1_2, indice[4], 6 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 8 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 8 ); + push_indice( hBstr, IND_ISF_1_0, indice[2], 7 ); + push_indice( hBstr, IND_ISF_1_1, indice[3], 7 ); + push_indice( hBstr, IND_ISF_1_2, indice[4], 6 ); return; } @@ -442,13 +442,13 @@ static void qisf_2s_46b_fx( indice[0] = Indirect_dico1[indice[0]]; move16(); /* Make interoperable with G722.2 */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 8 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 8 ); - push_indice_fx( hBstr, IND_ISF_1_0, indice[2], 6 ); - push_indice_fx( hBstr, IND_ISF_1_1, indice[3], 7 ); - push_indice_fx( hBstr, IND_ISF_1_2, indice[4], 7 ); - push_indice_fx( hBstr, IND_ISF_1_3, indice[5], 5 ); - push_indice_fx( hBstr, IND_ISF_1_4, indice[6], 5 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 8 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 8 ); + push_indice( hBstr, IND_ISF_1_0, indice[2], 6 ); + push_indice( hBstr, IND_ISF_1_1, indice[3], 7 ); + push_indice( hBstr, IND_ISF_1_2, indice[4], 7 ); + push_indice( hBstr, IND_ISF_1_3, indice[5], 5 ); + push_indice( hBstr, IND_ISF_1_4, indice[6], 5 ); return; } diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index e6d08c49d..8fe425d74 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -647,11 +647,11 @@ static void lsfq_CNG_fx( Vr_add( qlsf, &CNG_SN1_fx[idx_cv * M], qlsf, M ); /* write the VQ index to the bitstream */ - push_indice_fx( hBstr, IND_ISF_0_0, idx_cv, 4 ); + push_indice( hBstr, IND_ISF_0_0, idx_cv, 4 ); /* write the LVQ index to the bitstream */ - push_indice_fx( hBstr, IND_ISF_0_1, idx_lvq[0], LEN_INDICE ); - push_indice_fx( hBstr, IND_ISF_0_1, idx_lvq[1], LSF_BITS_CNG - 4 - LEN_INDICE ); + push_indice( hBstr, IND_ISF_0_1, idx_lvq[0], LEN_INDICE ); + push_indice( hBstr, IND_ISF_0_1, idx_lvq[1], LSF_BITS_CNG - 4 - LEN_INDICE ); return; } @@ -1117,13 +1117,13 @@ void lsf_end_enc_fx( IF( EQ_16( coder_type_org, GENERIC ) && EQ_32( st->sr_core, INT_FS_16k ) ) { /* VOICED =2 and GENERIC=3, so "coder_type-2" means VOICED =0 and GENERIC=1*/ - push_indice_fx( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, sub( coder_type, 2 ), 1 ); + push_indice( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, sub( coder_type, 2 ), 1 ); } /* write predictor selection bit */ IF( EQ_16( predmode, 2 ) ) { - push_indice_fx( st->hBstr, IND_LSF_PREDICTOR_SELECT_BIT, safety_net, 1 ); + push_indice( st->hBstr, IND_LSF_PREDICTOR_SELECT_BIT, safety_net, 1 ); } test(); @@ -1134,7 +1134,7 @@ void lsf_end_enc_fx( Bit_alloc1 = &BC_TCVQ_BIT_ALLOC_40B[1]; FOR( i = 0; i < ( M / 2 ) + 3; i++ ) { - push_indice_fx( hBstr, IND_LSF, TCQIdx[i], Bit_alloc1[i] ); + push_indice( hBstr, IND_LSF, TCQIdx[i], Bit_alloc1[i] ); } } ELSE @@ -1175,7 +1175,7 @@ void lsf_end_enc_fx( move16(); cumleft -= num_bits; move16(); - push_indice_fx( hBstr, IND_LSF, indice[i], num_bits ); + push_indice( hBstr, IND_LSF, indice[i], num_bits ); } WHILE( cumleft > 0 ) @@ -1195,7 +1195,7 @@ void lsf_end_enc_fx( } cumleft = sub( cumleft, num_bits ); - push_indice_fx( hBstr, IND_LSF, indice[i], num_bits ); + push_indice( hBstr, IND_LSF, indice[i], num_bits ); i = add( i, 1 ); } } @@ -3636,7 +3636,7 @@ static void lsf_mid_enc_fx( /* convert LSFs back to LSPs */ lsf2lsp_fx( qlsf, lsp, M, int_fs ); - push_indice_fx( hBstr, IND_MID_FRAME_LSF_INDEX, idx, nb_bits ); + push_indice( hBstr, IND_MID_FRAME_LSF_INDEX, idx, nb_bits ); return; } diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index a7588283a..391191175 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -698,9 +698,9 @@ void nelp_encoder_fx( } ELSE { - push_indice_fx( hBstr, IND_IG1, iG1_fx, 5 ); - push_indice_fx( hBstr, IND_IG2A, iG2_fx[0], 6 ); - push_indice_fx( hBstr, IND_IG2B, iG2_fx[1], 6 ); + push_indice( hBstr, IND_IG1, iG1_fx, 5 ); + push_indice( hBstr, IND_IG2A, iG2_fx[0], 6 ); + push_indice( hBstr, IND_IG2B, iG2_fx[1], 6 ); } test(); @@ -1019,7 +1019,7 @@ void nelp_encoder_fx( } ELSE { - push_indice_fx( hBstr, IND_NELP_FID, fid, 2 ); + push_indice( hBstr, IND_NELP_FID, fid, 2 ); } } diff --git a/lib_enc/peak_vq_enc_fx.c b/lib_enc/peak_vq_enc_fx.c index aa4763aa6..dffab4900 100644 --- a/lib_enc/peak_vq_enc_fx.c +++ b/lib_enc/peak_vq_enc_fx.c @@ -559,13 +559,13 @@ Word16 peak_vq_enc_fx( move32(); nf_gains[i] = L_shr( acc, 1 + 2 ); /* nf_gains in Q12. dicn_fx is in Q14. Need extra shift +2. */ move32(); - push_indice_fx( hBstr, IND_HVQ_NF_GAIN, indx, 5 ); + push_indice( hBstr, IND_HVQ_NF_GAIN, indx, 5 ); bits = add( bits, 5 ); } /* Signal number of peaks */ i = sub( max_peaks, vq_peaks ); - push_indice_fx( hBstr, IND_NUM_PEAKS, i, 5 ); + push_indice( hBstr, IND_NUM_PEAKS, i, 5 ); bits = add( bits, 5 ); /* Identify position of first peak and arrange peak gains by position */ @@ -677,8 +677,8 @@ Word16 peak_vq_enc_fx( move16(); } - push_indice_fx( hBstr, IND_FLAGN, FlagN, 1 ); - push_indice_fx( hBstr, IND_PG_IDX, pgain_difidx[0], GAIN0_BITS ); + push_indice( hBstr, IND_FLAGN, FlagN, 1 ); + push_indice( hBstr, IND_PG_IDX, pgain_difidx[0], GAIN0_BITS ); IF( FlagN ) { @@ -692,7 +692,7 @@ Word16 peak_vq_enc_fx( r = pgain_huffsizn[j]; move16(); - push_indice_fx( hBstr, IND_PG_IDX, m, r ); + push_indice( hBstr, IND_PG_IDX, m, r ); } } ELSE @@ -700,7 +700,7 @@ Word16 peak_vq_enc_fx( pPgainDifIdx = &pgain_difidx[1]; FOR( i = 0; i < vqPeaksMinus1; i++ ) { - push_indice_fx( hBstr, IND_PG_IDX, ( *pPgainDifIdx++ ), GAINI_BITS ); + push_indice( hBstr, IND_PG_IDX, ( *pPgainDifIdx++ ), GAINI_BITS ); } } @@ -727,13 +727,13 @@ Word16 peak_vq_enc_fx( num_overlap_bins = sub( 5, sub( vq_peak_idx[i + 1], vq_peak_idx[i] ) ); indx = sub( vq_peak_idx[i], 2 ); quant_peaks_fx( hBstr, &coefs[indx], &coefs_out[indx], &peak_gains[i], &vq_cb_idx, num_overlap_bins, core_brate, vq_peaks ); - push_indice_fx( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); + push_indice( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); bits = add( bits, 9 ); } indx = sub( vq_peak_idx[i], 2 ); quant_peaks_fx( hBstr, &coefs[indx], &coefs_out[indx], &peak_gains[i], &vq_cb_idx, 0, core_brate, vq_peaks ); - push_indice_fx( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); + push_indice( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); bits = add( bits, 9 ); /* Quantize peak positions and sign with HVQ */ @@ -826,7 +826,7 @@ Word16 peak_vq_enc_fx( move16(); } - push_indice_fx( hBstr, IND_HVQ_PVQ_GAIN, pvq_norm[k], HVQ_PVQ_GAIN_BITS ); + push_indice( hBstr, IND_HVQ_PVQ_GAIN, pvq_norm[k], HVQ_PVQ_GAIN_BITS ); pvq_bits = add( pvq_bits, HVQ_PVQ_GAIN_BITS ); pvq_norm[k] = add( pvq_norm[k], 8 ); @@ -1148,7 +1148,7 @@ static void quant_peaks_fx( { *vq_idx = w_vquant_fx( x, Qx, weights, xq, hvq_peak_cb_fx, cbSize, 0 ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 0, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 0, 1 ); } ELSE IF( EQ_16( cb_class, 1 ) ) { @@ -1157,7 +1157,7 @@ static void quant_peaks_fx( move16(); *vq_idx = add( *vq_idx, sub( HVQ_CB_SIZE / 2, search_overlap ) ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 0, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 0, 1 ); } ELSE IF( EQ_16( cb_class, 2 ) ) { @@ -1166,13 +1166,13 @@ static void quant_peaks_fx( move16(); *vq_idx = add( *vq_idx, sub( HVQ_CB_SIZE / 2, search_overlap ) ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 1, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 1, 1 ); } ELSE { *vq_idx = w_vquant_fx( x, Qx, weights, xq, hvq_peak_cb_fx, cbSize, 1 ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 1, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 1, 1 ); } FOR( i = 0; i < 4; i++ ) @@ -1458,23 +1458,23 @@ static Word16 hvq_code_pos_fx( test(); IF( GT_16( delta_bits, sparse_bits ) || delta_bits < 0 ) { - push_indice_fx( hBstr, IND_POS_IDX, HVQ_CP_SPARSE, 1 ); + push_indice( hBstr, IND_POS_IDX, HVQ_CP_SPARSE, 1 ); FOR( i = 0; i < sparse_bits; i++ ) { - push_indice_fx( hBstr, IND_POS_IDX, sparse_result[i], 1 ); + push_indice( hBstr, IND_POS_IDX, sparse_result[i], 1 ); } bits = add( add( bits, sparse_bits ), 1 ); } ELSE { - push_indice_fx( hBstr, IND_POS_IDX, HVQ_CP_DELTA, 1 ); + push_indice( hBstr, IND_POS_IDX, HVQ_CP_DELTA, 1 ); FOR( i = 0; i < num_peaks; i++ ) { j = delta[i]; move16(); - push_indice_fx( hBstr, IND_POS_IDX, hvq_cp_huff_val[j], hvq_cp_huff_len[j] ); + push_indice( hBstr, IND_POS_IDX, hvq_cp_huff_val[j], hvq_cp_huff_len[j] ); } bits = add( add( bits, delta_bits ), 1 ); } @@ -1489,7 +1489,7 @@ static Word16 hvq_code_pos_fx( tmp = 0; move16(); } - push_indice_fx( hBstr, IND_POS_IDX, tmp, 1 ); + push_indice( hBstr, IND_POS_IDX, tmp, 1 ); } bits = add( bits, num_peaks ); diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index b19fb7e56..8eea1b3d5 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -1787,7 +1787,7 @@ void pit_Q_enc_fx( } { - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } return; @@ -1919,7 +1919,7 @@ void pit16k_Q_enc_fx( } } - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */ { @@ -1949,14 +1949,14 @@ void pit16k_Q_enc_fx( } } - push_indice_fx( hBstr, IND_PITCH, pitch_index, 9 ); + push_indice( hBstr, IND_PITCH, pitch_index, 9 ); } ELSE /* nBits == 6 */ /* relative encoding with 6 bits */ { /*pitch_index = (T0 - *T0_min) * 4 + T0_frac;*/ pitch_index = add( shl( sub( T0, *T0_min ), 2 ), T0_frac ); - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max ); diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c index 9afb27065..ac3d5836a 100644 --- a/lib_enc/ppp_enc_fx.c +++ b/lib_enc/ppp_enc_fx.c @@ -171,9 +171,9 @@ ivas_error ppp_quarter_encoder_fx( CURRCW_Q_FX->upper_cut_off_freq_of_interest_fx = (Word16) find_remd( Ltempn, 20971, &Ltempd ); move16(); - push_indice_fx( hBstr, IND_AMP0, AMP_IDX_fx[0], 6 ); - push_indice_fx( hBstr, IND_AMP1, AMP_IDX_fx[1], 6 ); - push_indice_fx( hBstr, IND_POWER, POWER_IDX_FX, 6 ); + push_indice( hBstr, IND_AMP0, AMP_IDX_fx[0], 6 ); + push_indice( hBstr, IND_AMP1, AMP_IDX_fx[1], 6 ); + push_indice( hBstr, IND_POWER, POWER_IDX_FX, 6 ); /*Phase copying is done through copy_phase instead of car2pol and pol2car */ copy_phase_fx( TARGETCW_FX, *CURRCW_Q_FX, TARGETCW_FX ); @@ -199,7 +199,7 @@ ivas_error ppp_quarter_encoder_fx( /*DTFS_phaseShift( CURRCW_Q,(float)(PI2*tmp/CURRCW_Q->lag) ); */ Q2phaseShift_fx( CURRCW_Q_FX, tmp_fx, CURRCW_Q_FX->lag_fx, S_fx, C_fx ); - push_indice_fx( hBstr, IND_GLOBAL_ALIGNMENT, shr( add( tmp_fx, 12 ), 2 ), 3 ); + push_indice( hBstr, IND_GLOBAL_ALIGNMENT, shr( add( tmp_fx, 12 ), 2 ), 3 ); free( PREVDTFS_FX ); return error; diff --git a/lib_enc/range_enc_fx.c b/lib_enc/range_enc_fx.c index 689b313d8..767b2ecb5 100644 --- a/lib_enc/range_enc_fx.c +++ b/lib_enc/range_enc_fx.c @@ -423,14 +423,14 @@ void rc_enc_bits_fx( IF( GT_16( bits, 16 ) ) { - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_lshr( value, 16 ) ), sub( bits, 16 ) ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_lshr( value, 16 ) ), sub( bits, 16 ) ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_and( value, 0x0000ffff ) ), 16 ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_and( value, 0x0000ffff ) ), 16 ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 } ELSE { - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( value ), bits ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( value ), bits ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 } } @@ -516,7 +516,7 @@ static void rc_enc_write_fx( Word16 bits /* i : Number of bits Q0*/ ) { - push_indice_fx( hBstr, IND_RC_START, byte, bits ); + push_indice( hBstr, IND_RC_START, byte, bits ); return; } diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index 0a20db8ed..1445559a1 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -94,7 +94,7 @@ void stat_noise_uv_enc_fx( noisiness = s_max( noisiness, 0 ); noisiness = s_min( noisiness, 31 ); - push_indice_fx( st_fx->hBstr, IND_NOISINESS, noisiness, 5 ); + push_indice( st_fx->hBstr, IND_NOISINESS, noisiness, 5 ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 26c8382ca..1ebef7404 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -186,7 +186,7 @@ void wb_bwe_enc_fx( Q_synth = sub( add( sub( new_input_fx_exp, 16 ), scl ), 1 ); mode = WB_BWE_encoding_fx( coder_type, yorig_fx, WB_fenv_fx, st_fx, Q_synth, Q_synth ); - push_indice_fx( st_fx->hBstr, IND_WB_CLASS, sub( mode, 2 ), 1 ); + push_indice( st_fx->hBstr, IND_WB_CLASS, sub( mode, 2 ), 1 ); } hBWE_FD->prev_mode = mode; @@ -820,7 +820,7 @@ void swb_bwe_enc_fx( /* write FB BWE frame gain to the bitstream */ IF( EQ_16( st_fx->extl, FB_BWE ) ) { - push_indice_fx( st_fx->hBstr, IND_FB_SLOPE, idxGain, NUM_BITS_FB_FRAMEGAIN ); + push_indice( st_fx->hBstr, IND_FB_SLOPE, idxGain, NUM_BITS_FB_FRAMEGAIN ); } return; @@ -2476,7 +2476,7 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb index = WB_BWE_fenv_q_fx( WB_fenv_fx, F_2_5_fx, 32, 2 ); - push_indice_fx( st_fx->hBstr, IND_WB_FENV, index, 5 ); + push_indice( st_fx->hBstr, IND_WB_FENV, index, 5 ); return ( mode ); } @@ -2665,7 +2665,7 @@ static Word16 SWB_BWE_encoding_fx( { mode = IsTransient; move16(); - push_indice_fx( hBstr, IND_SWB_CLASS, mode, 2 ); + push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); /* Energy for the different bands and global energies */ global_gain_fx = L_deposit_l( 0 ); @@ -2924,13 +2924,13 @@ static Word16 SWB_BWE_encoding_fx( index = shr( add( SWB_tenv_tmp_fx[n_band], 1024 ), 11 ); } - push_indice_fx( hBstr, IND_SWB_TENV, index, 4 ); + push_indice( hBstr, IND_SWB_TENV, index, 4 ); } MSVQ_Interpol_Tran_fx( SWB_fenv_fx, indice ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[0], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[1], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[0], 7 ); + push_indice( hBstr, IND_SWB_FENV, indice[1], 6 ); } ELSE { @@ -2955,7 +2955,7 @@ static Word16 SWB_BWE_encoding_fx( global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ mode = FD_BWE_class_fx( yos_fx, global_gain_fx, tilt_nb_fx, Q_synth, Q_shb, st_fx ); - push_indice_fx( hBstr, IND_SWB_CLASS, mode, 2 ); + push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); energy_control_fx( st_fx, ACELP_CORE, mode, -1, yos_fx, st_offset, energy_factor_fx, Q_synth_lf ); @@ -2990,11 +2990,11 @@ static Word16 SWB_BWE_encoding_fx( /* Energy VQ */ msvq_interpol_fx( SWB_fenv_fx, w_env_fx, indice ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[0], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[1], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[2], 6 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[3], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[4], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[0], 5 ); + push_indice( hBstr, IND_SWB_FENV, indice[1], 7 ); + push_indice( hBstr, IND_SWB_FENV, indice[2], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[3], 5 ); + push_indice( hBstr, IND_SWB_FENV, indice[4], 6 ); } hBWE_FD->prev_mode = mode; move16(); @@ -3939,7 +3939,7 @@ void hq_generic_encoding_fx( IF( EQ_16( hHQ_core->hq_generic_speech_class, 1 ) ) { - push_indice_fx( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 1, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 1, 1 ); *hq_generic_exc_clas = HQ_GENERIC_SP_EXC; move16(); } @@ -3947,8 +3947,8 @@ void hq_generic_encoding_fx( { *hq_generic_exc_clas = decision_hq_generic_class_fx_32( coefs_fx, hq_generic_offset ); move16(); - push_indice_fx( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 0, 1 ); - push_indice_fx( hBstr, IND_HQ_SWB_EXC_CLAS, *hq_generic_exc_clas, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 0, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_CLAS, *hq_generic_exc_clas, 1 ); } FOR( n_band = 0; n_band < nenv; n_band++ ) @@ -4069,23 +4069,23 @@ void hq_generic_encoding_fx( move16(); } - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[0], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[1], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[2], 6 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[3], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[0], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[1], 7 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[2], 6 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[3], 5 ); IF( LE_16( hq_generic_offset, HQ_GENERIC_FOFFSET_24K4 ) ) { - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[4], 6 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[4], 6 ); } ELSE { - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[4], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[4], 5 ); } IF( EQ_16( st_fx->bwidth, FB ) ) { - push_indice_fx( hBstr, IND_FB_FENV_HQ, indice[5], 5 ); + push_indice( hBstr, IND_FB_FENV_HQ, indice[5], 5 ); } FOR( n_band = 0; n_band < nenv; n_band++ ) diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index fd4a9f125..8b5a17353 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -189,7 +189,7 @@ void swb_bwe_enc_hr_fx( st_fx->EnergyLT_fx_exp = exp1; move16(); - push_indice_fx( hBstr, IND_HR_IS_TRANSIENT, is_transient, 1 ); + push_indice( hBstr, IND_HR_IS_TRANSIENT, is_transient, 1 ); /*---------------------------------------------------------------------* * OLA and MDCT @@ -309,7 +309,7 @@ void swb_bwe_enc_hr_fx( ind1 = gain_quant_fx( &L_gain_fx, &gain1_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp1 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalization with global gain */ @@ -353,7 +353,7 @@ void swb_bwe_enc_hr_fx( { ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code3_fx, NUM_ENVLOPE_CODE_HR_TR ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR_TR ); ind2 = ind1; move16(); @@ -369,7 +369,7 @@ void swb_bwe_enc_hr_fx( ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code3_fx + ( NUM_ENVLOPE_CODE_HR_TR2 * 2 ), NUM_ENVLOPE_CODE_HR_TR2 ); } - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR - 1 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR - 1 ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR_TR - 1 ); } @@ -439,7 +439,7 @@ void swb_bwe_enc_hr_fx( L_en_noncoded_fx = L_deposit_h( en_band_fx[N_BANDS_TRANS_BWE_HR - 1] ); /* to Put in Q16+9 */ } - push_indice_fx( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_HF_GAIN_BWE_HR ); } ELSE @@ -507,7 +507,7 @@ void swb_bwe_enc_hr_fx( L_gain_fx = L_shr( L_tmp, sub( 31 - 16, exp2 ) ); /* 31: 'L_tmp' is already in Q31 */ ind1 = gain_quant_fx( &L_gain_fx, &gain1_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp1 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalization with global gain */ @@ -547,8 +547,8 @@ void swb_bwe_enc_hr_fx( ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code1_fx, NUM_ENVLOPE_CODE_HR1 ); ind2 = en_band_quant_fx( en_band_fx + 2, swb_hr_env_code2_fx, NUM_ENVLOPE_CODE_HR2 ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR1 ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind2, NBITS_ENVELOPE_BWE_HR2 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR1 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind2, NBITS_ENVELOPE_BWE_HR2 ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR1 + NBITS_ENVELOPE_BWE_HR2 ); @@ -673,7 +673,7 @@ void swb_bwe_enc_hr_fx( L_en_noncoded_fx = L_mult0( min_env_fx, 16384 ); } - push_indice_fx( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_HF_GAIN_BWE_HR ); } ELSE @@ -758,7 +758,7 @@ void swb_bwe_enc_hr_fx( /* Put in Q16 */ L_gain_fx = L_shr( L_temp, sub( 31 - 16, temp2 ) ); /* 31: 'L_temp' is already in Q31 */ ind1 = gain_quant_fx( &L_gain_fx, &gain2_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp2 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalize with global gain */ @@ -784,7 +784,7 @@ void swb_bwe_enc_hr_fx( WHILE( nBits > 0 ) { i = s_min( nBits, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); nBits = sub( nBits, i ); } return; diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index 1a397c514..938cdd971 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -806,7 +806,7 @@ static void gethar_noisegn_fx( } } - push_indice_fx( hBstr, IND_NOISEG, imin_fx, 2 ); + push_indice( hBstr, IND_NOISEG, imin_fx, 2 ); /*g=(float) pow (10.0f,gain_table[imin]);*/ L_temp = L_mult( gain_table_SWB_BWE_fx[imin_fx], 27213 ); /* Q14+Q13+1=Q28 log(10)/log(2)=3.3219 27213.23(Q13) */ @@ -909,7 +909,7 @@ static void EncodeSWBSubbands_fx( /* Write the indices into the bitstream */ FOR( k = 0; k < nBands_search_fx; k++ ) { - push_indice_fx( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] ); + push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] ); } IF( flag_dis == 0 ) @@ -974,7 +974,7 @@ static void EncodeSWBSubbands_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] ); + push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] ); } } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index c5d5e651e..1a14e7acb 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -866,7 +866,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_LBR_WB_LSF ); + push_indice( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_LBR_WB_LSF ); } Copy( lbr_wb_bwe_lsfvq_cbook_2bit_fx + i * LPC_SHB_ORDER_LBR_WB, lsp_wb, LPC_SHB_ORDER_LBR_WB ); @@ -928,7 +928,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_WB_LSF ); + push_indice( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_WB_LSF ); } Copy( wb_bwe_lsfvq_cbook_8bit_fx + i * LPC_SHB_ORDER_WB, lsp_wb, LPC_SHB_ORDER_WB ); @@ -1162,7 +1162,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_UV_FLAG, uv_flag, 1 ); + push_indice( st_fx->hBstr, IND_UV_FLAG, uv_flag, 1 ); /* Quantization of the subframe gain parameter */ QuantizeSHBsubgains_fx( st_fx, GainShape, st_fx->extl ); @@ -2482,7 +2482,7 @@ void swb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_VF, vf_ind_fx, NUM_BITS_SHB_VF ); + push_indice( st_fx->hBstr, IND_SHB_VF, vf_ind_fx, NUM_BITS_SHB_VF ); } } @@ -5330,7 +5330,7 @@ static void QuantizeSHBsubgains_fx( idxSubGain = closest_centroid_lc_fx( subgains + NUM_SHB_SUBFR / 4, HBCB_SubGain5bit_fx, 1 << NUM_BITS_SHB_SUBGAINS ); Copy( HBCB_SubGain5bit_fx + idxSubGain * NUM_SHB_SUBFR / 4, subgains, NUM_SHB_SUBFR / 4 ); - push_indice_fx( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); + push_indice( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); FOR( i = 0; i < NUM_SHB_SUBFR / 4; i++ ) { @@ -5401,7 +5401,7 @@ static void QuantizeSHBsubgains_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); + push_indice( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); } } @@ -5596,7 +5596,7 @@ static void Quant_shb_ener_sf_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); + push_indice( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); } return; } @@ -5683,7 +5683,7 @@ static void Quant_shb_res_gshape_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_RES_GS1 + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); + push_indice( st_fx->hBstr, IND_SHB_RES_GS1 + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); } } } @@ -5787,7 +5787,7 @@ static void QuantizeSHBframegain_fx( 1 << NUM_BITS_SHB_FrameGain, &idxFrameGain, &Q_GainFrame, SHBCB_FrameGain64_fx ); - push_indice_fx( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FrameGain ); + push_indice( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FrameGain ); *rf_gainFrame_ind = idxFrameGain; move16(); /* Q18 */ } @@ -5852,7 +5852,7 @@ static void QuantizeSHBframegain_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); + push_indice( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); } *rf_gainFrame_ind = idxFrameGain; move16(); @@ -7176,7 +7176,7 @@ static void Quant_BWE_LSF_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_LSF, lsf_idx[i], lsf_q_num_bits[i] ); + push_indice( hBstr, IND_SHB_LSF, lsf_idx[i], lsf_q_num_bits[i] ); } } @@ -7186,7 +7186,7 @@ static void Quant_BWE_LSF_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_MIRROR, m_idx, MIRROR_POINT_BITS ); + push_indice( hBstr, IND_SHB_MIRROR, m_idx, MIRROR_POINT_BITS ); } grid_idx = Find_LSF_grid_fx( lsf, lsf_q, m ); @@ -7194,7 +7194,7 @@ static void Quant_BWE_LSF_fx( hBWE_TD->grid_idx = grid_idx; IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_GRID, grid_idx, NUM_LSF_GRID_BITS ); + push_indice( hBstr, IND_SHB_GRID, grid_idx, NUM_LSF_GRID_BITS ); } FOR( i = 0; i < LPC_SHB_ORDER; i++ ) @@ -7407,7 +7407,7 @@ void fb_tbe_enc_fx( } ELSE { - push_indice_fx( st->hBstr, IND_FB_SLOPE, idxGain, 4 ); + push_indice( st->hBstr, IND_FB_SLOPE, idxGain, 4 ); } return; diff --git a/lib_enc/tcq_core_enc_fx.c b/lib_enc/tcq_core_enc_fx.c index 82088be50..d5841094f 100644 --- a/lib_enc/tcq_core_enc_fx.c +++ b/lib_enc/tcq_core_enc_fx.c @@ -449,11 +449,11 @@ ivas_error tcq_core_LR_enc_fx( j = sub( bit_budget, shl( nb_bytes, 3 ) ); FOR( i = 0; i < nb_bytes; i++ ) { - push_indice_fx( hBstr, IND_HQ2_SUBBAND_TCQ, pbs_fx->buf[i], 8 ); + push_indice( hBstr, IND_HQ2_SUBBAND_TCQ, pbs_fx->buf[i], 8 ); } IF( j > 0 ) { - push_indice_fx( hBstr, IND_HQ2_SUBBAND_TCQ, shr( pbs_fx->buf[nb_bytes], ( 8 - j ) ), j ); + push_indice( hBstr, IND_HQ2_SUBBAND_TCQ, shr( pbs_fx->buf[nb_bytes], ( 8 - j ) ), j ); } /* Clear decoding buffer */ set32_fx( coefs_quant_fx, 0, sfm_end[BANDS - 1] + 1 ); diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 7fe813d12..253cc9717 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -389,7 +389,7 @@ void transition_enc_fx( /* 7bit ENCODER */ /* index = (*T0-pit_start)*2 + *T0_frac/2;*/ index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -438,7 +438,7 @@ void transition_enc_fx( limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max for delta search */ index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -502,7 +502,7 @@ void transition_enc_fx( *T0_frac = 0; move16(); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -526,7 +526,7 @@ void transition_enc_fx( *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR ); move16(); index = delta_pit_enc_fx( 2, *T0, *T0_frac, *T0_min ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -607,7 +607,7 @@ void transition_enc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } } @@ -768,7 +768,7 @@ void transition_enc_fx( /*index = (*T0)*2 + ((*T0_frac)>>1) - (PIT16k_FR2_TC0_2SUBFR*2) + ((PIT16k_FR2_TC0_2SUBFR-PIT16k_MIN)*4);*/ index = add( sub( add( shl( *T0, 1 ), shr( *T0_frac, 1 ) ), ( PIT16k_FR2_TC0_2SUBFR * 2 ) ), ( PIT16k_FR2_TC0_2SUBFR - PIT16k_MIN ) * 4 ); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } ELSE IF( EQ_16( nBits, 6 ) ) { @@ -777,7 +777,7 @@ void transition_enc_fx( move16(); index = delta_pit_enc_fx( 4, *T0, *T0_frac, *T0_min ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } IF( EQ_16( nBits, 6 ) ) { @@ -804,7 +804,7 @@ void transition_enc_fx( move16(); set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ - push_indice_fx( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ + push_indice( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ set16_fx( y1_fx, 0, L_SUBFR ); /* set filtered adaptive excitation to 0 */ @@ -839,7 +839,7 @@ void transition_enc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } *Jopt_flag = 1; @@ -1886,7 +1886,7 @@ static void tc_enc_fx( /* write pitch index */ IF( ( GE_16( *T0, L_SUBFR ) ) && ( NE_16( *tc_subfr, 3 * L_SUBFR ) ) ) { - push_indice_fx( hBstr, IND_PITCH, 0, nBits ); + push_indice( hBstr, IND_PITCH, 0, nBits ); } ELSE IF( EQ_16( *tc_subfr, 3 * L_SUBFR ) ) { @@ -1898,7 +1898,7 @@ static void tc_enc_fx( { index = abs_pit_enc_fx( 2, 0, *T0, *T0_frac ); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); limit_T0_fx( L_FRAME, 8, 0, 0, *T0, 0, T0_min, T0_max ); } @@ -1907,12 +1907,12 @@ static void tc_enc_fx( IF( EQ_16( nBits, 6 ) ) { index = delta_pit_enc_fx( 2, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } ELSE { index = delta_pit_enc_fx( 0, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } } } @@ -1926,13 +1926,13 @@ static void tc_enc_fx( ELSE IF( EQ_16( nBits, 6 ) ) { index = add( shl( sub( *T0, PIT16k_MIN ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } } - push_indice_fx( hBstr, IND_TC_IMP_SHAPE, imp_shape, 3 ); - push_indice_fx( hBstr, IND_TC_IMP_POS, imp_pos, 6 ); - push_indice_fx( hBstr, IND_TC_IMP_SIGN, pitch_sign_fx, 1 ); - push_indice_fx( hBstr, IND_TC_IMP_GAIN, pitch_index, 3 ); + push_indice( hBstr, IND_TC_IMP_SHAPE, imp_shape, 3 ); + push_indice( hBstr, IND_TC_IMP_POS, imp_pos, 6 ); + push_indice( hBstr, IND_TC_IMP_SIGN, pitch_sign_fx, 1 ); + push_indice( hBstr, IND_TC_IMP_GAIN, pitch_index, 3 ); *position = add( imp_pos, i_subfr ); move16(); diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index b0dba61de..8081b2909 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -1156,7 +1156,7 @@ ivas_error ppp_voiced_encoder_fx( { Q_delta_lag = add( delta_lag_E, 11 ); /* to make it positive always */ - push_indice_fx( hBstr, IND_DELTALAG, Q_delta_lag, 5 ); + push_indice( hBstr, IND_DELTALAG, Q_delta_lag, 5 ); } WIsyn_fx( *dtfs_temp_fx, CURRP_Q_E_FX, lpc2_fx, &( hSC_VBR->ph_offset_E_fx ), out_fx, L_FRAME, 0, S_fx, C_fx, -- GitLab From 5e088823aeb430144a4f3d0827e8efaff2d11a4e Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 14:01:42 -0400 Subject: [PATCH 278/358] fix clang --- lib_enc/transition_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 253cc9717..6718552c5 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -803,7 +803,7 @@ void transition_enc_fx( *Jopt_flag = 0; move16(); - set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ + set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ push_indice( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ -- GitLab From 7b1d6dbda6d6917bedda67b9bcd73a99f1bee6ea Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 14:05:40 -0400 Subject: [PATCH 279/358] replace EVS push_next_indice_fx byt IVAS one --- lib_com/bitstream_fx.c | 4 +- lib_com/igf_base_fx.c | 2 +- lib_com/parameter_bitmaping_fx.c | 2 +- lib_enc/ACcontextMapping_enc_fx.c | 2 +- lib_enc/ari_hm_enc_fx.c | 4 +- lib_enc/decision_matrix_enc_fx.c | 4 +- lib_enc/enc_prm_fx.c | 130 +++++++++++++++--------------- lib_enc/evs_enc_fx.c | 14 ++-- lib_enc/fd_cng_enc_fx.c | 4 +- lib_enc/guided_plc_enc_fx.c | 6 +- lib_enc/igf_enc_fx.c | 4 +- lib_enc/igf_scf_enc_fx.c | 2 +- lib_enc/lsf_msvq_ma_enc_fx.c | 10 +-- lib_enc/qlpc_avq_fx.c | 20 ++--- lib_enc/swb_tbe_enc_fx.c | 28 +++---- 15 files changed, 118 insertions(+), 118 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 667958264..8cb968bf1 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -288,9 +288,8 @@ void push_indice_fx( return; } -#endif /*-------------------------------------------------------------------* - * push_next_indice_fx() * + * push_next_indice() * * Push a new indice into the buffer at the next position *-------------------------------------------------------------------*/ @@ -315,6 +314,7 @@ void push_next_indice_fx( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index fbccdb519..44cf27c5f 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1242,7 +1242,7 @@ void IGFCommonFuncsWriteSerialBit( IF( hBstr ) { - push_next_indice_fx( hBstr, bit, 1 ); + push_next_indice( hBstr, bit, 1 ); } *pBitOffset = add( *pBitOffset, 1 ); move16(); diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index 0846c618b..923872090 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -21,7 +21,7 @@ static Word16 PutIntoBitstream_fx( value = *( *pStream )++; codedValue = EncodeValue( value, index ); - push_next_indice_fx( hBstr, codedValue, nBits ); + push_next_indice( hBstr, codedValue, nBits ); return value; } diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index c52fddf97..4e02b1f11 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -343,7 +343,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( /* Push number of encoded tuples */ value = sub( shr( lastnz, 1 ), 1 ); /* Q0 */ - push_next_indice_fx( hBstr, value, nbbits_ntuples ); + push_next_indice( hBstr, value, nbbits_ntuples ); /* Push arithmetic coded bits */ push_next_bits_fx( hBstr, &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c index 76d48ccf4..343f1890f 100644 --- a/lib_enc/ari_hm_enc_fx.c +++ b/lib_enc/ari_hm_enc_fx.c @@ -42,12 +42,12 @@ Word16 EncodeIndex_fx( NumRatioBitsBwLtpIndx = NumRatioBits[Bandwidth][LtpPitchIndex]; move16(); - push_next_indice_fx( hBst, s_and( PeriodicityIndex, 0xff ), NumRatioBitsBwLtpIndx ); + push_next_indice( hBst, s_and( PeriodicityIndex, 0xff ), NumRatioBitsBwLtpIndx ); return NumRatioBitsBwLtpIndx; } ELSE { - push_next_indice_fx( hBst, PeriodicityIndex, 8 ); + push_next_indice( hBst, PeriodicityIndex, 8 ); return 8; } } diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index 63a13aa1a..bc5feeb6b 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -527,8 +527,8 @@ void signalling_enc_fx( assert( !st_fx->tcxonly ); assert( st_fx->core == HQ_CORE ); - push_next_indice_fx( hBstr, 1, 1 ); /* TCX */ - push_next_indice_fx( hBstr, 1, 1 ); /* HQ_CORE */ + push_next_indice( hBstr, 1, 1 ); /* TCX */ + push_next_indice( hBstr, 1, 1 ); /* HQ_CORE */ /* write ACELP->HQ core switching flag */ test(); diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index ecd4e2f01..6c052e596 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -33,7 +33,7 @@ static void enc_prm_hm( } /* Flag */ - push_next_indice_fx( hBstr, prm_hm[0], 1 ); + push_next_indice( hBstr, prm_hm[0], 1 ); IF( prm_hm[0] ) { @@ -50,7 +50,7 @@ static void enc_prm_hm( IF( EQ_16( st->hTcxCfg->coder_type, VOICED ) ) { /* Gain index */ - push_next_indice_fx( hBstr, prm_hm[2], kTcxHmNumGainBits ); + push_next_indice( hBstr, prm_hm[2], kTcxHmNumGainBits ); } } } @@ -152,7 +152,7 @@ void enc_prm_rf_ivas_fx( index = 3; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { @@ -296,9 +296,9 @@ void enc_prm_rf_fx( /* LSF indices */ IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], lsf_numbits[0] ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], lsf_numbits[1] ); /* VQ 2 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][2], lsf_numbits[2] ); /* VQ 3 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], lsf_numbits[0] ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], lsf_numbits[1] ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][2], lsf_numbits[2] ); /* VQ 3 */ } /* classification */ @@ -324,12 +324,12 @@ void enc_prm_rf_fx( index = 3; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { /* TCX global gain = 7 bits */ - push_next_indice_fx( hBstr, hRF->rf_gain_tcx[fec_offset], 7 ); + push_next_indice( hBstr, hRF->rf_gain_tcx[fec_offset], 7 ); /*window info 1 bit for long overlap 2 if minimum or half overlap*/ @@ -345,35 +345,35 @@ void enc_prm_rf_fx( test(); IF( ( EQ_16( rf_frame_type, RF_TCXTD1 ) || EQ_16( rf_frame_type, RF_TCXTD2 ) ) && hTcxEnc->tcxltp != 0 ) { - push_next_indice_fx( hBstr, hRF->rf_tcxltp_param[fec_offset], 9 ); + push_next_indice( hBstr, hRF->rf_tcxltp_param[fec_offset], 9 ); } } } ELSE IF( EQ_16( rf_frame_type, 7 ) ) /* NELP bitstream writing */ { /* LSF indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ /* NELP gain indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG1[fec_offset], 5 ); - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][0], 6 ); - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][1], 6 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG1[fec_offset], 5 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][0], 6 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][1], 6 ); /* NELP filter selection index */ - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_fid[fec_offset], 2 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_fid[fec_offset], 2 ); /* tbe gainFr */ - push_next_indice_fx( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 5 ); + push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 5 ); } ELSE IF( GE_16( rf_frame_type, 4 ) ) /* rf_frame_type ALL_PRED: 4, NO_PRED: 5, GEN_PRED: 6 */ { /* LSF indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ /* ES pred */ - push_next_indice_fx( hBstr, hRF->rf_indx_EsPred[fec_offset], 3 ); + push_next_indice( hBstr, hRF->rf_indx_EsPred[fec_offset], 3 ); ltp_mode = ACELP_LTP_MODE[1][1][rf_frame_type]; /* Q0 */ ltf_mode = ACELP_LTF_MODE[1][1][rf_frame_type]; /* Q0 */ @@ -386,13 +386,13 @@ void enc_prm_rf_fx( n = ACELP_LTP_BITS_SFR[ltp_mode][sfr]; IF( n != 0 ) { - push_next_indice_fx( hBstr, hRF->rf_indx_pitch[fec_offset][sfr], n ); + push_next_indice( hBstr, hRF->rf_indx_pitch[fec_offset][sfr], n ); } /* Adaptive codebook filtering (1 bit) */ IF( EQ_16( ltf_mode, 2 ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_ltfMode[fec_offset][sfr], 1 ); + push_next_indice( hBstr, hRF->rf_indx_ltfMode[fec_offset][sfr], 1 ); } /*Innovative codebook*/ @@ -403,7 +403,7 @@ void enc_prm_rf_fx( ( EQ_16( rf_frame_type, RF_GENPRED ) && ( sfr == 0 || EQ_16( sfr, 2 ) ) ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_fcb[fec_offset][sfr], 7 ); + push_next_indice( hBstr, hRF->rf_indx_fcb[fec_offset][sfr], 7 ); } /* Gains (5b, 6b or 7b / subfr) */ @@ -411,11 +411,11 @@ void enc_prm_rf_fx( IF( sfr == 0 || EQ_16( sfr, 2 ) ) { n = ACELP_GAINS_BITS[gains_mode]; - push_next_indice_fx( hBstr, hRF->rf_indx_gain[fec_offset][sfr], n ); + push_next_indice( hBstr, hRF->rf_indx_gain[fec_offset][sfr], n ); } } /* tbe gainFr */ - push_next_indice_fx( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 2 ); + push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 2 ); } /***************/ @@ -429,15 +429,15 @@ void enc_prm_rf_fx( test(); IF( EQ_16( fec_offset, 2 ) ) { - push_next_indice_fx( hBstr, 0, 2 ); + push_next_indice( hBstr, 0, 2 ); } ELSE IF( EQ_16( fec_offset, 3 ) || EQ_16( fec_offset, 5 ) || EQ_16( fec_offset, 7 ) ) { - push_next_indice_fx( hBstr, ( fec_offset - 1 ) / 2, 2 ); + push_next_indice( hBstr, ( fec_offset - 1 ) / 2, 2 ); } /* write RF frame type last in the bitstream */ - push_next_indice_fx( hBstr, rf_frame_type, 3 ); + push_next_indice( hBstr, rf_frame_type, 3 ); } @@ -533,7 +533,7 @@ void enc_prm_fx( IF( st->tcxonly ) { - push_next_indice_fx( hBstr, core == TCX_10_CORE, 1 ); + push_next_indice( hBstr, core == TCX_10_CORE, 1 ); { index = 3; move16(); @@ -553,7 +553,7 @@ void enc_prm_fx( index = 2; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); } } ELSE @@ -581,13 +581,13 @@ void enc_prm_fx( { idx = add( idx, 1 ); /* Q0 */ } - push_next_indice_fx( hBstr, idx - start_idx, nBits ); - push_next_indice_fx( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ + push_next_indice( hBstr, idx - start_idx, nBits ); + push_next_indice( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ nbits_start = 3; /* Q0 */ } ELSE { - push_next_indice_fx( hBstr, coder_type, 3 ); + push_next_indice( hBstr, coder_type, 3 ); } } ELSE @@ -595,15 +595,15 @@ void enc_prm_fx( IF( EQ_16( st->mdct_sw, MODE1 ) ) { /* 2 bits instead of 3 as TCX is already signaled */ - push_next_indice_fx( hBstr, st->hTcxCfg->coder_type, 2 ); + push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); } ELSE { IF( EQ_16( st->mdct_sw_enable, MODE2 ) ) { - push_next_indice_fx( hBstr, 1, 1 ); /* TCX */ - push_next_indice_fx( hBstr, 0, 1 ); /* not HQ_CORE */ - push_next_indice_fx( hBstr, st->hTcxCfg->coder_type, 2 ); + push_next_indice( hBstr, 1, 1 ); /* TCX */ + push_next_indice( hBstr, 0, 1 ); /* not HQ_CORE */ + push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); } ELSE { @@ -641,13 +641,13 @@ void enc_prm_fx( { idx = add( idx, 1 ); } - push_next_indice_fx( hBstr, idx - start_idx, nBits ); - push_next_indice_fx( hBstr, 1, 1 ); /* Indicate to the decoder that the core is TCX*/ + push_next_indice( hBstr, idx - start_idx, nBits ); + push_next_indice( hBstr, 1, 1 ); /* Indicate to the decoder that the core is TCX*/ nbits_start = 3; } ELSE { - push_next_indice_fx( hBstr, 4 + st->hTcxCfg->coder_type, 3 ); + push_next_indice( hBstr, 4 + st->hTcxCfg->coder_type, 3 ); } } } @@ -667,7 +667,7 @@ void enc_prm_fx( tmp = TCX_20_CORE; move16(); } - push_next_indice_fx( hBstr, tmp, 1 ); + push_next_indice( hBstr, tmp, 1 ); } /* write TCX overlap mode (1 bit: full, 2 bits: half or no overlap) */ @@ -696,7 +696,7 @@ void enc_prm_fx( overlap_code = 0; move16(); } - push_next_indice_fx( hBstr, overlap_code, nbits_tcx ); + push_next_indice( hBstr, overlap_code, nbits_tcx ); } IF( st->hPlcExt->enableGplc ) @@ -719,7 +719,7 @@ void enc_prm_fx( IF( EQ_16( core, ACELP_CORE ) ) { - push_next_indice_fx( hBstr, st->glr_idx[0], G_LPC_RECOVERY_BITS ); + push_next_indice( hBstr, st->glr_idx[0], G_LPC_RECOVERY_BITS ); } } @@ -789,7 +789,7 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, st->bpf_gain_param, n ); + push_next_indice( hBstr, st->bpf_gain_param, n ); } /* Mean energy (2 or 3 bits) */ @@ -797,7 +797,7 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /* Subframe parameters */ @@ -810,14 +810,14 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /* Adaptive codebook filtering (1 bit) */ IF( EQ_16( st->acelp_cfg.ltf_mode, 2 ) ) { - push_next_indice_fx( hBstr, prm[j++], 1 ); + push_next_indice( hBstr, prm[j++], 1 ); } /*Innovative codebook*/ @@ -839,12 +839,12 @@ void enc_prm_fx( FOR( ix = 0; ix < wordcnt; ix++ ) { - push_next_indice_fx( hBstr, prm[j++], 16 ); + push_next_indice( hBstr, prm[j++], 16 ); } IF( bitcnt ) { - push_next_indice_fx( hBstr, prm[j++], bitcnt ); + push_next_indice( hBstr, prm[j++], bitcnt ); } j = add( j_old, 8 ); /* Q0 */ @@ -852,7 +852,7 @@ void enc_prm_fx( /* Gains (5b, 6b or 7b / subfr) */ n = ACELP_GAINS_BITS[st->acelp_cfg.gains_mode[sfr]]; - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /*end of for(sfr)*/ } /*end of mode[0]==0*/ @@ -866,14 +866,14 @@ void enc_prm_fx( move16(); IF( st->enablePlcWaveadjust ) { - push_next_indice_fx( hBstr, st->Tonal_SideInfo, 1 ); + push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); } /* TCX Gain = 7 bits */ - push_next_indice_fx( hBstr, prm[j++], 7 ); + push_next_indice( hBstr, prm[j++], 7 ); /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice_fx( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); + push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); /* LTP data */ test(); @@ -881,13 +881,13 @@ void enc_prm_fx( { IF( prm[j] ) { - push_next_indice_fx( hBstr, 1, 1 ); - push_next_indice_fx( hBstr, prm[j + 1], 9 ); - push_next_indice_fx( hBstr, prm[j + 2], 2 ); + push_next_indice( hBstr, 1, 1 ); + push_next_indice( hBstr, prm[j + 1], 9 ); + push_next_indice( hBstr, prm[j + 2], 2 ); } ELSE { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } j = add( j, 3 ); @@ -932,7 +932,7 @@ void enc_prm_fx( test(); IF( st->hTcxCfg->ctx_hm && NE_16( last_core, ACELP_CORE ) ) { - push_next_indice_fx( hBstr, prm[j], 1 ); + push_next_indice( hBstr, prm[j], 1 ); IF( prm[j] ) { @@ -1015,14 +1015,14 @@ void enc_prm_fx( test(); IF( st->enablePlcWaveadjust && k ) { - push_next_indice_fx( hBstr, st->Tonal_SideInfo, 1 ); + push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); } /* TCX Gain = 7 bits */ - push_next_indice_fx( hBstr, prm[j++], 7 ); + push_next_indice( hBstr, prm[j++], 7 ); /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice_fx( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); + push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); /* LTP data */ test(); @@ -1031,13 +1031,13 @@ void enc_prm_fx( { IF( prm[j] ) { - push_next_indice_fx( hBstr, 1, 1 ); - push_next_indice_fx( hBstr, prm[j + 1], 9 ); - push_next_indice_fx( hBstr, prm[j + 2], 2 ); + push_next_indice( hBstr, 1, 1 ); + push_next_indice( hBstr, prm[j + 1], 9 ); + push_next_indice( hBstr, prm[j + 2], 2 ); } ELSE { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } j = add( j, 3 ); @@ -1079,7 +1079,7 @@ void enc_prm_fx( test(); IF( st->hTcxCfg->ctx_hm && !( last_core == ACELP_CORE && k == 0 ) ) { - push_next_indice_fx( hBstr, prm[j], 1 ); + push_next_indice( hBstr, prm[j], 1 ); IF( prm[j] ) { diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index c86b7e061..396e97c6f 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -419,7 +419,7 @@ ivas_error evs_enc_fx( FOR( i = 0; i < padBits; i++ ) { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } @@ -678,19 +678,19 @@ static void writeFrameHeader_loc( Encoder_State *st ) IF( EQ_16( st->cng_type, FD_CNG ) ) { /* write SID/CNG type flag */ - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); /* write bandwidth mode */ - push_next_indice_fx( hBstr, st->bwidth, 2 ); + push_next_indice( hBstr, st->bwidth, 2 ); /* write L_frame */ IF( EQ_16( st->L_frame, L_FRAME ) ) { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } ELSE { - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); } } } @@ -698,7 +698,7 @@ static void writeFrameHeader_loc( Encoder_State *st ) { IF( st->rf_mode == 0 ) { - push_next_indice_fx( hBstr, sub( st->bwidth, FrameSizeConfig[st->frame_size_index].bandwidth_min ), FrameSizeConfig[st->frame_size_index].bandwidth_bits ); + push_next_indice( hBstr, sub( st->bwidth, FrameSizeConfig[st->frame_size_index].bandwidth_min ), FrameSizeConfig[st->frame_size_index].bandwidth_bits ); } } @@ -706,7 +706,7 @@ static void writeFrameHeader_loc( Encoder_State *st ) test(); IF( FrameSizeConfig[st->frame_size_index].reserved_bits && st->rf_mode == 0 ) { - push_next_indice_fx( hBstr, 0, FrameSizeConfig[st->frame_size_index].reserved_bits ); + push_next_indice( hBstr, 0, FrameSizeConfig[st->frame_size_index].reserved_bits ); } } diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 2eb13646c..d182e4a44 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1211,9 +1211,9 @@ void FdCng_encodeSID_fx( HANDLE_FD_CNG_ENC stenc, /* i/o: pointer to FD_CNG stru { FOR( i = 0; i < stages_37bits; i++ ) { - push_next_indice_fx( hBstr, indices[i], bits_37bits[i] ); + push_next_indice( hBstr, indices[i], bits_37bits[i] ); } - push_next_indice_fx( hBstr, index, 7 ); + push_next_indice( hBstr, index, 7 ); } ELSE { diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index 60a3f8f50..81e50d099 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -215,7 +215,7 @@ void enc_prm_side_Info_fx( IF( GT_16( hPlc_Ext->nBits, 1 ) ) { - push_next_indice_fx( st->hBstr, 1, 1 ); + push_next_indice( st->hBstr, 1, 1 ); diff_pitch = sub( hPlc_Ext->T0, hPlc_Ext->T0_4th ); test(); @@ -225,11 +225,11 @@ void enc_prm_side_Info_fx( move16(); } - push_next_indice_fx( st->hBstr, add( diff_pitch, search_range ), bits_per_subfr ); + push_next_indice( st->hBstr, add( diff_pitch, search_range ), bits_per_subfr ); } ELSE { - push_next_indice_fx( st->hBstr, 0, 1 ); + push_next_indice( st->hBstr, 0, 1 ); } return; diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index cc4840876..f5c13df57 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1513,13 +1513,13 @@ Word16 IGFEncWriteConcatenatedBitstream_fx( tmp = shr( hPrivateData->igfBitstreamBits, 3 ); FOR( i = 0; i < tmp; i++ ) { - push_next_indice_fx( hBstr, pBitstream[i], 8 ); + push_next_indice( hBstr, pBitstream[i], 8 ); } bitsLeft = s_and( hPrivateData->igfBitstreamBits, 0x7 ); IF( bitsLeft > 0 ) { - push_next_indice_fx( hBstr, shr( pBitstream[i], sub( 8, bitsLeft ) ), bitsLeft ); + push_next_indice( hBstr, shr( pBitstream[i], sub( 8, bitsLeft ) ), bitsLeft ); } return hInstance->infoTotalBitsWritten; diff --git a/lib_enc/igf_scf_enc_fx.c b/lib_enc/igf_scf_enc_fx.c index 8659d53a1..ed52349dc 100644 --- a/lib_enc/igf_scf_enc_fx.c +++ b/lib_enc/igf_scf_enc_fx.c @@ -358,7 +358,7 @@ Word16 IGFSCFEncoderEncode_fx( { FOR( i = 0; i < hPublicData->ptrBitIndex; ++i ) { - push_next_indice_fx( hBstr, ptr[i], 1 ); + push_next_indice( hBstr, ptr[i], 1 ); } } diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index aa2255c68..8f6a21d03 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -834,7 +834,7 @@ Word16 enc_lsf_tcxlpc_fx( move16(); FOR( i = 0; i < TCXLPC_NUMSTAGES; ++i ) { - push_next_indice_fx( hBstr, **indices, lsf_numbits[i] ); + push_next_indice( hBstr, **indices, lsf_numbits[i] ); ++*indices; } @@ -843,7 +843,7 @@ Word16 enc_lsf_tcxlpc_fx( NumBits = add( NumBits, TCXLPC_IND_NUMBITS ); FOR( i = 0; i < TCXLPC_IND_NUMSTAGES; ++i ) { - push_next_indice_fx( hBstr, **indices, lsf_ind_numbits[i] ); + push_next_indice( hBstr, **indices, lsf_ind_numbits[i] ); ++*indices; } } @@ -909,7 +909,7 @@ Word16 lsf_msvq_ma_encprm_fx( FOR( i = 0; i < no_indices; i++ ) { - push_next_indice_fx( hBstr, *param_lpc, bits_param_lpc[i] ); + push_next_indice( hBstr, *param_lpc, bits_param_lpc[i] ); param_lpc++; nbits_lpc = add( nbits_lpc, bits_param_lpc[i] ); } @@ -919,7 +919,7 @@ Word16 lsf_msvq_ma_encprm_fx( IF( ( core == ACELP_CORE ) && acelp_midLpc ) { - push_next_indice_fx( hBstr, *param_lpc, bits_midlpc ); + push_next_indice( hBstr, *param_lpc, bits_midlpc ); nbits_lpc = add( nbits_lpc, bits_midlpc ); } } @@ -981,7 +981,7 @@ Word16 lsf_bctcvq_encprm_fx( FOR( i = 0; i < no_indices; i++ ) { - push_next_indice_fx( hBstr, *param_lpc, bits_param_lpc[i] ); + push_next_indice( hBstr, *param_lpc, bits_param_lpc[i] ); param_lpc++; nbits_lpc = add( nbits_lpc, bits_param_lpc[i] ); } diff --git a/lib_enc/qlpc_avq_fx.c b/lib_enc/qlpc_avq_fx.c index 13e0a3cf7..288612e43 100644 --- a/lib_enc/qlpc_avq_fx.c +++ b/lib_enc/qlpc_avq_fx.c @@ -143,12 +143,12 @@ static Word16 unary_code( FOR( ; ind > 0; ind-- ) { - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); nb_bits = add( nb_bits, 1 ); // Q0 } /* Stop bit */ - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); return ( nb_bits ); } @@ -195,7 +195,7 @@ static Word16 unpack4bits( IF( nbits == 0 ) { - push_next_indice_fx( hBstr, 0, 0 ); + push_next_indice( hBstr, 0, 0 ); i = 1; move16(); } @@ -206,10 +206,10 @@ static Word16 unpack4bits( FOR( ; nbits > 4; nbits -= 4 ) { - push_next_indice_fx( hBstr, prm[i], 4 ); + push_next_indice( hBstr, prm[i], 4 ); i = add( i, 1 ); } - push_next_indice_fx( hBstr, prm[i], nbits ); + push_next_indice( hBstr, prm[i], nbits ); i = add( i, 1 ); } @@ -330,7 +330,7 @@ Word16 encode_lpc_avq_fx( { nb = 1; move16(); - push_next_indice_fx( hBstr, q_type, nb ); + push_next_indice( hBstr, q_type, nb ); } nb_bits = add( nb_bits, nb ); // Q0 @@ -342,7 +342,7 @@ Word16 encode_lpc_avq_fx( IF( ( ( q_type == 0 ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) || ( ( q_type == 0 ) && ( GE_16( st1, 0 ) ) && EQ_16( element_mode, IVAS_CPE_MDCT ) ) ) { /* Absolute quantizer with 1st stage stochastic codebook */ - push_next_indice_fx( hBstr, st1, bits_for_abs_quant ); + push_next_indice( hBstr, st1, bits_for_abs_quant ); nb_bits = add( nb_bits, bits_for_abs_quant ); // Q0 } @@ -350,7 +350,7 @@ Word16 encode_lpc_avq_fx( test(); IF( EQ_16( element_mode, IVAS_CPE_MDCT ) && EQ_16( stereo_mode, 3 ) && st1 < 0 ) { - push_next_indice_fx( hBstr, add( st1, 2 ), 1 ); + push_next_indice( hBstr, add( st1, 2 ), 1 ); nb_bits = add( nb_bits, 1 ); // Q0 } @@ -368,7 +368,7 @@ Word16 encode_lpc_avq_fx( move16(); i = 3; } - push_next_indice_fx( hBstr, i, 2 ); + push_next_indice( hBstr, i, 2 ); i = sub( qn2, 2 ); @@ -377,7 +377,7 @@ Word16 encode_lpc_avq_fx( move16(); i = 3; } - push_next_indice_fx( hBstr, i, 2 ); + push_next_indice( hBstr, i, 2 ); /* Unary code for abs and rel LPC0/LPC2 */ /* Q5 = 0, Q6=10, Q0=110, Q7=1110, ... */ diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 1a14e7acb..316a5b549 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -7579,10 +7579,10 @@ void tbe_write_bitstream_fx( IF( ( st_fx->rf_mode || EQ_32( st_fx->total_brate, ACELP_9k60 ) ) && ( EQ_16( st_fx->bwidth, WB ) ) ) { /* WB LSF */ - push_next_indice_fx( hBstr, hBWE_TD->lsf_WB, NUM_BITS_LBR_WB_LSF ); + push_next_indice( hBstr, hBWE_TD->lsf_WB, NUM_BITS_LBR_WB_LSF ); /* WB frame */ - push_next_indice_fx( hBstr, hBWE_TD->gFrame_WB, NUM_BITS_SHB_FrameGain_LBR_WB ); + push_next_indice( hBstr, hBWE_TD->gFrame_WB, NUM_BITS_SHB_FrameGain_LBR_WB ); } ELSE IF( ( GE_32( st_fx->total_brate, ACELP_9k60 ) ) && ( LE_32( st_fx->total_brate, ACELP_32k ) ) && ( ( EQ_16( st_fx->bwidth, SWB ) ) || ( EQ_16( st_fx->bwidth, FB ) ) ) ) @@ -7592,53 +7592,53 @@ void tbe_write_bitstream_fx( test(); IF( ( EQ_16( st_fx->rf_mode, 1 ) ) || EQ_32( st_fx->total_brate, ACELP_9k60 ) ) { - push_next_indice_fx( hBstr, hBWE_TD->lsf_idx[0], 8 ); + push_next_indice( hBstr, hBWE_TD->lsf_idx[0], 8 ); } ELSE { FOR( i = 0; i < NUM_Q_LSF; i++ ) { - push_next_indice_fx( hBstr, hBWE_TD->lsf_idx[i], lsf_q_num_bits[i] ); + push_next_indice( hBstr, hBWE_TD->lsf_idx[i], lsf_q_num_bits[i] ); } /* LSF mirror points */ - push_next_indice_fx( hBstr, hBWE_TD->m_idx, MIRROR_POINT_BITS ); + push_next_indice( hBstr, hBWE_TD->m_idx, MIRROR_POINT_BITS ); /* LSF grid points */ - push_next_indice_fx( hBstr, hBWE_TD->grid_idx, NUM_LSF_GRID_BITS ); + push_next_indice( hBstr, hBWE_TD->grid_idx, NUM_LSF_GRID_BITS ); } /* Gain shape */ - push_next_indice_fx( hBstr, hBWE_TD->idxSubGains, NUM_BITS_SHB_SUBGAINS ); + push_next_indice( hBstr, hBWE_TD->idxSubGains, NUM_BITS_SHB_SUBGAINS ); /* frame gain */ - push_next_indice_fx( hBstr, hBWE_TD->idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); + push_next_indice( hBstr, hBWE_TD->idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); IF( GE_32( st_fx->total_brate, ACELP_24k40 ) ) { /* sub frame energy*/ - push_next_indice_fx( hBstr, hBWE_TD->idx_shb_fr_gain, NUM_BITS_SHB_ENER_SF ); + push_next_indice( hBstr, hBWE_TD->idx_shb_fr_gain, NUM_BITS_SHB_ENER_SF ); /* gain shapes residual */ FOR( i = 0; i < NB_SUBFR16k; i++ ) { - push_next_indice_fx( hBstr, hBWE_TD->idx_res_gs[i], NUM_BITS_SHB_RES_GS ); + push_next_indice( hBstr, hBWE_TD->idx_res_gs[i], NUM_BITS_SHB_RES_GS ); } /* voicing factor */ - push_next_indice_fx( hBstr, hBWE_TD->idx_mixFac, NUM_BITS_SHB_VF ); + push_next_indice( hBstr, hBWE_TD->idx_mixFac, NUM_BITS_SHB_VF ); } IF( EQ_16( st_fx->tec_tfa, 1 ) ) { - push_next_indice_fx( hBstr, st_fx->tec_flag, BITS_TEC ); - push_next_indice_fx( hBstr, st_fx->tfa_flag, BITS_TFA ); + push_next_indice( hBstr, st_fx->tec_flag, BITS_TEC ); + push_next_indice( hBstr, st_fx->tfa_flag, BITS_TFA ); } } IF( EQ_16( st_fx->bwidth, FB ) ) { - push_next_indice_fx( hBstr, hBWE_TD->idxGain, 4 ); + push_next_indice( hBstr, hBWE_TD->idxGain, 4 ); } } -- GitLab From 9591d921755e6f02cc087afadbf0b16082dbec60 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:03:51 -0400 Subject: [PATCH 280/358] replace other EVS bitstream related stuff --- lib_com/bitstream_fx.c | 9 ++++++--- lib_enc/ACcontextMapping_enc_fx.c | 6 +++--- lib_enc/enc_prm_fx.c | 2 +- lib_enc/igf_enc.c | 4 ++-- lib_enc/igf_enc_fx.c | 4 ++-- lib_enc/lib_enc.c | 2 ++ lib_enc/tcx_utils_enc_fx.c | 26 +++++++++++++++++++++----- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 8cb968bf1..d3aab2616 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -314,11 +314,10 @@ void push_next_indice_fx( return; } -#endif /*-------------------------------------------------------------------* - * push_next_bits_fx() + * push_next_bits() * Push a bit buffer into the buffer at the next position *-------------------------------------------------------------------*/ @@ -368,6 +367,7 @@ void push_next_bits_fx( hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits ); move16(); } +#endif /*-------------------------------------------------------------------* * get_next_indice_fx( ) @@ -565,6 +565,7 @@ void reset_indices_dec_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ +#if 0 void write_indices_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ @@ -663,12 +664,13 @@ void write_indices_fx( return; } +#endif /*-------------------------------------------------------------------* * write_indices_buf_fx() * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ - +#if 0 void write_indices_buf_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ @@ -772,6 +774,7 @@ void write_indices_buf_fx( return; } +#endif /*-------------------------------------------------------------------* * indices_to_serial() * diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 4e02b1f11..43bd30fd4 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -346,10 +346,10 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( push_next_indice( hBstr, value, nbbits_ntuples ); /* Push arithmetic coded bits */ - push_next_bits_fx( hBstr, &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); + push_next_bits( hBstr, (UWord16 *) &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); /* Push sign bits */ - push_next_bits_fx( hBstr, signs, nbbits_signs ); + push_next_bits( hBstr, (UWord16 *) signs, nbbits_signs ); bp = add( bp, nbbits_signs ); /* Q0 */ /*write residual Quantization bits*/ @@ -372,7 +372,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( assert( bp + k <= nbbits ); /* Push the rest of the buffer */ - push_next_bits_fx( hBstr, &ptr[bp], sub( nbbits, bp ) ); + push_next_bits( hBstr, (UWord16 *) &ptr[bp], sub( nbbits, bp ) ); return /*(bp+nbbits_lsbs)*/; /*return only for debug plot*/ } diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 6c052e596..1d619e6c5 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -965,7 +965,7 @@ void enc_prm_fx( IF( hTcxEnc->tcx_lpc_shaped_ari != 0 ) { - push_next_bits_fx( hBstr, &prm[++j], nbits_tcx ); + push_next_bits( hBstr, ( UWord16 * ) &prm[++j], nbits_tcx ); j = add( j, nbits_tcx ); /* Q0 */ } ELSE diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index 2680bd9f6..d0c9fa329 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2429,7 +2429,7 @@ void IGFEncSetMode_ivas_fx( * * IGF bitstream concatenation for TCX10 modes *-------------------------------------------------------------------*/ - +#if 0 /* Float code */ void IGFEncConcatenateBitstream( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ const Word16 bsBits, /* i : number of IGF bits written to list of indices */ @@ -2487,7 +2487,7 @@ move16(); return; } - +#endif /*-------------------------------------------------------------------* * IGFEncResetTCX10BitCounter_ivas_fx() diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index f5c13df57..a8a64422f 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } - +#if 0 /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ @@ -1475,7 +1475,7 @@ void IGFEncConcatenateBitstream_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /** move16(); return; } - +#endif /**********************************************************************/ /* IGF reset bitsream bit counter for TCX10 modes **************************************************************************/ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 877fc2045..b17ba61df 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1892,6 +1892,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } /* write indices into bitstream buffer */ +#if 0 IF( hEncoderConfig->element_mode_init == EVS_MONO ) { test(); @@ -1905,6 +1906,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } } ELSE +#endif { write_indices_ivas_fx( st_ivas, outputBitStream, numOutBits ); } diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 7d268b92a..fd6293124 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3650,7 +3650,7 @@ Word16 tcx_res_Q_spec_ivas_fx( return bits; } - +#if 1 //TV void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ Encoder_State *st, /**< in: Encoder state */ @@ -3667,8 +3667,9 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; - Word16 bsStart; + Word16 bsStart, pBsStart; BSTR_ENC_HANDLE hBstr = st->hBstr; + IGF_ENC_INSTANCE_HANDLE hIGFEnc = st->hIGFEnc; isIndepFlag = 1; @@ -3721,6 +3722,8 @@ void ProcessIGF_fx( Word16 Q_A; Word16 predictionGain = 0; Word16 *flatteningTrigger = &( st->hIGFEnc->flatteningTrigger ); + + move32(); move16(); move16(); @@ -3750,6 +3753,7 @@ void ProcessIGF_fx( { IGFEncWriteBitstream_fx( hInstance, NULL, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); } +#if 0 ELSE { IGFEncWriteBitstream_fx( hInstance, st->hBstr, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); @@ -3760,8 +3764,20 @@ void ProcessIGF_fx( { IGFEncConcatenateBitstream_fx( hInstance, bsBits, &hBstr->next_ind_fx, &hBstr->nb_bits_tot, hBstr->ind_list ); } -} +#else + ELSE + { + pBsStart = hBstr->nb_ind_tot; + move16(); + + IGFEncWriteBitstream_ivas_fx( hIGFEnc, hBstr, &hIGFEnc->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); + bsBits = sub( hBstr->nb_ind_tot, pBsStart ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc, bsBits, hBstr ); + } +#endif +} + #endif void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) { Word16 i, length, att; @@ -3877,7 +3893,7 @@ void ProcessIGF_ivas_fx( IGFEncWriteBitstream_ivas_fx( hIGFEnc, hBstr, &hIGFEnc->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); bsBits = sub( hBstr->nb_ind_tot, pBsStart ); - IGFEncConcatenateBitstream( hIGFEnc, bsBits, hBstr ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc, bsBits, hBstr ); } return; @@ -3981,7 +3997,7 @@ void ProcessStereoIGF_fx( IGFEncWriteBitstream_ivas_fx( hIGFEnc[ch], hBstr, &hIGFEnc[ch]->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); bsBits = sub( hBstr->nb_ind_tot, pBsStart ); - IGFEncConcatenateBitstream( hIGFEnc[ch], bsBits, hBstr ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc[ch], bsBits, hBstr ); } } return; -- GitLab From bb876b28b8dbda2b645171bb99f8c5877501f058 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:06:06 -0400 Subject: [PATCH 281/358] fix clang --- lib_com/bitstream_fx.c | 2 +- lib_enc/enc_prm_fx.c | 4 ++-- lib_enc/tcx_utils_enc_fx.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index d3aab2616..f0e564a8a 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -664,7 +664,7 @@ void write_indices_fx( return; } -#endif +#endif /*-------------------------------------------------------------------* * write_indices_buf_fx() * diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 1d619e6c5..6d6a2d575 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -583,7 +583,7 @@ void enc_prm_fx( } push_next_indice( hBstr, idx - start_idx, nBits ); push_next_indice( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ - nbits_start = 3; /* Q0 */ + nbits_start = 3; /* Q0 */ } ELSE { @@ -965,7 +965,7 @@ void enc_prm_fx( IF( hTcxEnc->tcx_lpc_shaped_ari != 0 ) { - push_next_bits( hBstr, ( UWord16 * ) &prm[++j], nbits_tcx ); + push_next_bits( hBstr, (UWord16 *) &prm[++j], nbits_tcx ); j = add( j, nbits_tcx ); /* Q0 */ } ELSE diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index fd6293124..06de6a2fa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3650,7 +3650,7 @@ Word16 tcx_res_Q_spec_ivas_fx( return bits; } -#if 1 //TV +#if 1 // TV void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ Encoder_State *st, /**< in: Encoder state */ @@ -3777,7 +3777,7 @@ void ProcessIGF_fx( } #endif } - #endif +#endif void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) { Word16 i, length, att; -- GitLab From 2aa5710dacbe699f30781227bfbf45088225bf6d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:13:41 -0400 Subject: [PATCH 282/358] fix clang --- lib_enc/tcx_utils_enc_fx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 06de6a2fa..ec1db2cf3 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3667,7 +3667,11 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; +#if 0 Word16 bsStart, pBsStart; +#else + Word16 pBsStart; +#endif BSTR_ENC_HANDLE hBstr = st->hBstr; IGF_ENC_INSTANCE_HANDLE hIGFEnc = st->hIGFEnc; @@ -3744,8 +3748,9 @@ void ProcessIGF_fx( } } +#if 0 bsStart = hBstr->next_ind_fx; - +#endif move16(); hInstance->infoTotalBitsPerFrameWritten = 0; move16(); -- GitLab From 8f109c520aa15d566107d3273893c11c30b52a1d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 09:06:17 -0400 Subject: [PATCH 283/358] work on encoder config duplication --- lib_enc/ivas_init_enc_fx.c | 46 ++++++++++++++++++-------------------- lib_enc/lib_enc.c | 10 ++++++--- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 57858b03e..19996e2e4 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -463,7 +463,7 @@ void ivas_initialize_handles_enc_fx( * * Initialize IVAS encoder state structure *-------------------------------------------------------------------*/ - +#if 0 ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1073,6 +1073,7 @@ ivas_error ivas_init_encoder( } return error; } +#endif ivas_error ivas_init_encoder_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1100,10 +1101,10 @@ ivas_error ivas_init_encoder_fx( hEncoderConfig->last_ivas_total_brate = ivas_total_brate; /* Q0 */ move32(); - IF( NE_16( ivas_format, MONO_FORMAT ) ) + if ( NE_16( ivas_format, MONO_FORMAT ) ) { /* In IVAS, ensure that minimum coded bandwidth is WB */ - hEncoderConfig->max_bwidth = extract_l( L_max( hEncoderConfig->max_bwidth, WB ) ); /* Q0 */ + hEncoderConfig->max_bwidth = s_max( hEncoderConfig->max_bwidth, WB ); /* Q0 */ move16(); } st_ivas->ism_mode = ISM_MODE_NONE; @@ -1142,7 +1143,10 @@ ivas_error ivas_init_encoder_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point input audio buffer!\n" ) ); } + set32_fx( st_ivas->p_data_fx[n], 0, extract_l( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); } + st_ivas->q_data_fx = Q11; + move16(); FOR( ; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->p_data_fx[n] = NULL; @@ -1196,7 +1200,7 @@ ivas_error ivas_init_encoder_fx( /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ - test(); + IF( EQ_32( ivas_format, MONO_FORMAT ) ) { st_ivas->nSCE = 1; /* in mono, there is always only one SCE */ @@ -1209,19 +1213,9 @@ ivas_error ivas_init_encoder_fx( move16(); test(); - IF( st_ivas->hEncoderConfig->element_mode_init == EVS_MONO ) + IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { - IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) - { - return error; - } - } - ELSE - { - IF( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } /* prepare stereo downmix for EVS */ @@ -1342,7 +1336,7 @@ ivas_error ivas_init_encoder_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hEncoderConfig->Opt_DTX_ON ) + if ( hEncoderConfig->Opt_DTX_ON ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; move16(); @@ -1350,7 +1344,7 @@ ivas_error ivas_init_encoder_fx( } } - IF( st_ivas->nCPE > 1 ) + IF( GT_16( st_ivas->nCPE, 1 ) ) { IF( ( error = create_mct_enc_fx( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1358,7 +1352,7 @@ ivas_error ivas_init_encoder_fx( } } } - ELSE IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) ) + ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) ) { Word32 ism_total_brate; Word16 k; @@ -1428,12 +1422,12 @@ ivas_error ivas_init_encoder_fx( ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { st_ivas->ism_mode = ISM_MODE_NONE; - move32(); + move16(); IF( GE_32( ivas_total_brate, IVAS_256k ) ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; - move32(); + move16(); } IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) @@ -1523,7 +1517,7 @@ ivas_error ivas_init_encoder_fx( return error; } - IF( NE_32( st_ivas->mc_mode, MC_MODE_MCT ) ) + IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) { st_ivas->nSCE = 0; move16(); @@ -1596,7 +1590,9 @@ ivas_error ivas_init_encoder_fx( FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + Word32 res_dec, res_frac; + iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nCPE, st_ivas->nSCE ), &res_dec, &res_frac, 0 ); + IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, res_dec ) ) != IVAS_ERR_OK ) { return error; } @@ -1658,7 +1654,9 @@ ivas_error ivas_init_encoder_fx( *-----------------------------------------------------------------*/ /* set number of input channels used for analysis/coding */ - n = getNumChanAnalysis_fx( st_ivas ); + n = getNumChanAnalysis_fx( st_ivas ); /* Q0 */ + move16(); + IF( n > 0 ) { IF( ( st_ivas->mem_hp20_in_fx = (Word32 **) malloc( n * sizeof( Word32 * ) ) ) == NULL ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b17ba61df..52734b4bd 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -70,7 +70,7 @@ struct IVAS_ENC * Local functions *---------------------------------------------------------------------*/ -static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +//static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error setBandwidth_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); @@ -609,6 +609,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( return error; } +#if 0 ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ const Word32 inputFs, /* i : input sampling frequency */ @@ -649,11 +650,12 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( hIvasEnc->maxBandwidthUser = max_bwidth_user; - error = configureEncoder_fx( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); + error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); return error; } +#endif /*---------------------------------------------------------------------* * IVAS_ENC_ConfigureForSBAObjects() * @@ -1188,7 +1190,7 @@ static ivas_error configureEncoder( * Finalize initialization *-----------------------------------------------------------------*/ - IF( ( error = ivas_init_encoder( st_ivas ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_init_encoder_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1211,6 +1213,7 @@ static ivas_error configureEncoder( return error; } +#if 0 static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, @@ -1543,6 +1546,7 @@ static ivas_error configureEncoder_fx( return error; } +#endif /*---------------------------------------------------------------------* * IVAS_ENC_GetDelay() * -- GitLab From 1597e6dd757408df3772eacb2b4266524045a8d1 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 13:46:47 -0400 Subject: [PATCH 284/358] Addition of compiler switch, code compiles and run, but not BE --- lib_com/bitstream_fx.c | 7 +++--- lib_com/options.h | 2 ++ lib_enc/igf_enc.c | 2 +- lib_enc/igf_enc_fx.c | 2 +- lib_enc/init_enc_fx.c | 48 ++++++++++++++++++++++++++++---------- lib_enc/ivas_init_enc_fx.c | 7 +++--- lib_enc/ivas_sce_enc_fx.c | 27 +++++++++++++++++---- lib_enc/lib_enc.c | 6 ++--- lib_enc/tcx_utils_enc_fx.c | 6 ++--- 9 files changed, 76 insertions(+), 31 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index f0e564a8a..f29dc6aee 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -244,7 +244,7 @@ Word16 rate2EVSmode( * * Push a new indice into the buffer *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_PUSH_BIT void push_indice_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ Word16 id, /* i : ID of the indice */ @@ -565,8 +565,7 @@ void reset_indices_dec_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ -#if 0 - +#ifndef HARM_PUSH_BIT void write_indices_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ @@ -670,7 +669,7 @@ void write_indices_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_PUSH_BIT void write_indices_buf_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 2133b86ac..183edaa71 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -75,4 +75,6 @@ /* 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_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ #define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +#define HARM_PUSH_BIT +#define HARM_ENC_INIT #endif diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index d0c9fa329..c8e8974c2 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2429,7 +2429,7 @@ void IGFEncSetMode_ivas_fx( * * IGF bitstream concatenation for TCX10 modes *-------------------------------------------------------------------*/ -#if 0 /* Float code */ +#ifndef HARM_PUSH_BIT /* Float code */ void IGFEncConcatenateBitstream( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ const Word16 bsBits, /* i : number of IGF bits written to list of indices */ diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index a8a64422f..96f8d0202 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } -#if 0 /* old bitstream */ +#ifndef HARM_PUSH_BIT /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index ea944dd75..4913e410d 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -20,6 +20,7 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ +#if 1 ivas_error init_encoder_fx( Encoder_State *st_fx /* i/o: Encoder static variables structure */ ) @@ -946,6 +947,7 @@ ivas_error init_encoder_fx( move32(); return error; } +#endif /*-----------------------------------------------------------------------* * LPDmem_enc_init_fx() * @@ -1498,14 +1500,7 @@ ivas_error init_encoder_ivas_fx( IF( st->element_mode == EVS_MONO ) { /* This is done to as in EVS T_CldfbVadState structure is present in Encoder State */ - /* - if ( ( st->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) ); - } - */ st->hVAD_CLDFB = &st->vad_st; - vad_init_fx( st->hVAD_CLDFB ); } ELSE @@ -1670,9 +1665,23 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( EQ_16( st->element_mode, EVS_MONO ) ) { - return error; + /* open analysis for input SR */ + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); + + if ( ( error = openCldfb( &st->cldfbAnaEnc, CLDFB_ANALYSIS, CLDFB_getNumChannels( st->input_Fs ), st->input_frame_fx ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + { + return error; + } } } ELSE @@ -1784,11 +1793,20 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( st->element_mode == EVS_MONO ) { - return error; + if ( ( error = openCldfb( &st->cldfbSynTd, CLDFB_SYNTHESIS, CLDFB_getNumChannels( 16000 ), L_FRAME16k ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + { + return error; + } } - InitSWBencBuffer_ivas_fx( st ); ResetSHBbuffer_Enc_fx( st ); } @@ -2144,7 +2162,13 @@ ivas_error init_encoder_ivas_fx( } ELSE { +#ifndef HARM_ENC_INIT InitTransientDetection_ivas_fx( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); +#else + InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ), + NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), + &st->transientDetection ); +#endif } /*-----------------------------------------------------------------* diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 19996e2e4..7c72d4780 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -269,7 +269,7 @@ Word16 getNumChanAnalysis_fx( return n; } - +#ifndef HARM_ENC_INIT /*-------------------------------------------------------------------* * copy_encoder_config_ivas_fx() * @@ -321,6 +321,7 @@ void copy_encoder_config_ivas_fx( return; } +#endif /*-------------------------------------------------------------------* * copy_encoder_config_fx() * @@ -463,7 +464,7 @@ void ivas_initialize_handles_enc_fx( * * Initialize IVAS encoder state structure *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_ENC_INIT ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1213,7 +1214,7 @@ ivas_error ivas_init_encoder_fx( move16(); test(); - IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index f1631ba4f..3f80cce2b 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -466,12 +466,31 @@ ivas_error create_sce_enc_fx( st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; move32(); move32(); - + st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; + st->input_Fs = st_ivas->hEncoderConfig->input_Fs; + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); +#if 0 + IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + { + return error; + } +#else IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) { return error; } - hSCE->hCoreCoder[0] = st; + //IF( NE_32( ( error = init_encoder_fx( st) ), IVAS_ERR_OK ) ) + //{ + // return error; + //} + + //st->hBstr->ind_list = ind_list; + // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; + //reset_indices_enc_fx( st->hBstr, MAX_NUM_INDICES ); +#endif + hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; @@ -483,7 +502,7 @@ ivas_error create_sce_enc_fx( * * Create, allocate and initialize EVS encoder SCE handle *-------------------------------------------------------------------------*/ - +#if 0 ivas_error create_evs_sce_enc_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const Word16 sce_id, /* i : SCE # identifier */ @@ -614,7 +633,7 @@ ivas_error create_evs_sce_enc_fx( return error; } - +#endif /*------------------------------------------------------------------------- * destroy_sce_enc_fx() * diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 52734b4bd..fdf410df5 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -609,7 +609,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( return error; } -#if 0 +#ifndef HARM_ENC_INIT ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ const Word32 inputFs, /* i : input sampling frequency */ @@ -1213,7 +1213,7 @@ static ivas_error configureEncoder( return error; } -#if 0 +#ifndef HARM_ENC_INIT static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, @@ -1896,7 +1896,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } /* write indices into bitstream buffer */ -#if 0 +#ifndef HARM_PUSH_BIT IF( hEncoderConfig->element_mode_init == EVS_MONO ) { test(); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index ec1db2cf3..5bea901bb 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3667,7 +3667,7 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; -#if 0 +#ifndef HARM_PUSH_BIT Word16 bsStart, pBsStart; #else Word16 pBsStart; @@ -3748,7 +3748,7 @@ void ProcessIGF_fx( } } -#if 0 +#ifndef HARM_PUSH_BIT bsStart = hBstr->next_ind_fx; #endif move16(); @@ -3758,7 +3758,7 @@ void ProcessIGF_fx( { IGFEncWriteBitstream_fx( hInstance, NULL, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); } -#if 0 +#ifndef HARM_PUSH_BIT ELSE { IGFEncWriteBitstream_fx( hInstance, st->hBstr, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); -- GitLab From c100d602b808183aea6cca0f0ccdf47db47b89e2 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 14:08:20 -0400 Subject: [PATCH 285/358] fix BE issue, still crashed mid-file --- lib_com/options.h | 1 + lib_enc/ivas_init_enc_fx.c | 10 ++++++++-- lib_enc/ivas_sce_enc_fx.c | 41 +++++++++++++++++++++----------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 183edaa71..4653bb460 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,4 +77,5 @@ #define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define HARM_PUSH_BIT #define HARM_ENC_INIT +//#define HARM_SCE_INIT #endif diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 7c72d4780..04b99f039 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1212,13 +1212,19 @@ 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 3f80cce2b..2e1aed092 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -469,27 +469,11 @@ ivas_error create_sce_enc_fx( st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; st->input_Fs = st_ivas->hEncoderConfig->input_Fs; st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); -#if 0 - IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - { - return error; - } -#else + IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) { return error; } - //IF( NE_32( ( error = init_encoder_fx( st) ), IVAS_ERR_OK ) ) - //{ - // return error; - //} - - //st->hBstr->ind_list = ind_list; - // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; - //reset_indices_enc_fx( st->hBstr, MAX_NUM_INDICES ); -#endif hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; @@ -502,7 +486,7 @@ ivas_error create_sce_enc_fx( * * Create, allocate and initialize EVS encoder SCE handle *-------------------------------------------------------------------------*/ -#if 0 +#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 */ @@ -624,9 +608,30 @@ ivas_error create_evs_sce_enc_fx( { return error; } +#ifdef HARM_PUSH_BIT + /*-----------------------------------------------------------------* + * Bitstream + *-----------------------------------------------------------------*/ + IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); + } + + /* set pointer to the buffer of indices */ + st_fx->hBstr->ind_list = st_ivas->ind_list; + st_fx->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; + st_fx->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices; + st_fx->hBstr->nb_ind_tot = 0; + move16(); + st_fx->hBstr->nb_bits_tot = 0; + move16(); + st_fx->hBstr->st_ivas = st_ivas; +#else st_fx->hBstr->ind_list = ind_list; // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); +#endif + hSCE->hCoreCoder[0] = st_fx; st_ivas->hSCE[sce_id] = hSCE; -- GitLab From 448c79f670d8581070ed5ecadd5615a1b373c0b8 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:43:27 -0400 Subject: [PATCH 286/358] fix during switching --- lib_com/bitstream_fx.c | 3 ++- lib_enc/acelp_core_switch_enc_fx.c | 18 +++++++++++++++++- lib_enc/stat_enc.h | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index f29dc6aee..07a6a632f 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -530,11 +530,12 @@ void reset_indices_enc_fx( move16(); hBstr->nb_bits_tot = 0; move16(); +#ifndef HARM_PUSH_BIT hBstr->next_ind_fx = 0; move16(); hBstr->last_ind_fx = -1; move16(); - +#endif FOR( i = 0; i < max_num_indices; i++ ) { hBstr->ind_list[i].nb_bits = -1; diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 9b0ed8b58..8226748f7 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -62,7 +62,10 @@ void acelp_core_switch_enc_fx( Word16 Aq[2 * ( M + 1 )]; LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - +#ifdef HARM_PUSH_BIT + UWord16 value; + Word16 nb_bits; +#endif hLPDmem = st_fx->hLPDmem; /* initializations */ @@ -153,6 +156,18 @@ void acelp_core_switch_enc_fx( encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); +#ifdef HARM_PUSH_BIT + i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); +#ifdef DEBUGGING + assert( i >= 0 && "Internal error in ACELP core switching - unable to find ACELP subframe indices!" ); +#endif + while ( hBstr->ind_list[i].id == TAG_ACELP_SUBFR_LOOP_START ) + { + push_indice( hBstr, IND_CORE_SWITCHING_CELP_SUBFRAME, hBstr->ind_list[i].value, hBstr->ind_list[i].nb_bits ); + i++; + } + delete_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START ); +#else /*----------------------------------------------------------------* * bit-stream: modify the layer of sub frame CELP *----------------------------------------------------------------*/ @@ -165,6 +180,7 @@ void acelp_core_switch_enc_fx( hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].nb_bits = -1; /* Q0 */ move16(); } +#endif /*----------------------------------------------------------------* * BWE encoding *----------------------------------------------------------------*/ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 64ab13ea2..5305a8bdc 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -92,9 +92,10 @@ typedef struct bitstream_enc_data_structure void *st_ivas; /* IVAS encoder structure */ // Word16 nb_bits_tot_fx; /* total number of bits already written */ // Indice *ind_list_fx; /* list of indices */ +#ifndef HARM_PUSH_BIT Word16 next_ind_fx; /* pointer to the next empty slot in the list of indices */ Word16 last_ind_fx; /* last written indice */ - +#endif } BSTR_ENC_DATA, *BSTR_ENC_HANDLE; /*----------------------------------------------------------------------------------* -- GitLab From a69f82222c1b56b8b3cf1f3fc53b445c3f467c59 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:50:15 -0400 Subject: [PATCH 287/358] fix when erasing indices --- lib_enc/cng_enc_fx.c | 4 ++++ lib_enc/eval_pit_contr_fx.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 221454970..d6cb59b17 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2460,8 +2460,12 @@ static void shb_CNG_encod_fx( push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); push_indice( hBstr, IND_SID_BW, 1, 1 ); +#ifdef HARM_PUSH_BIT + delete_indice( hBstr, IND_CNG_ENV1 ); +#else hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; +#endif move16(); move16(); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index df629f295..5e1c8dfe3 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -378,6 +378,16 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit move16(); set16_fx( pitch_buf, shl( L_SUBFR, 6 ), NB_SUBFR16k ); + +#ifdef HARM_PUSH_BIT + /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ + for ( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) + { + delete_indice( hBstr, i ); + } + + delete_indice( hBstr, IND_ES_PRED ); +#else /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ FOR( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) { @@ -396,6 +406,7 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit hBstr->ind_list[IND_ES_PRED].nb_bits = -1; move16(); } +#endif } IF( LT_32( st_fx->core_brate, CFREQ_BITRATE ) ) { -- GitLab From a2b10d391aaf9aedf613c199ffaa2293ac8ffda4 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:54:11 -0400 Subject: [PATCH 288/358] fix clang --- lib_enc/cng_enc_fx.c | 2 +- lib_enc/igf_enc_fx.c | 2 +- lib_enc/init_enc_fx.c | 2 +- lib_enc/ivas_sce_enc_fx.c | 2 +- lib_enc/lib_enc.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index d6cb59b17..b031ca528 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2460,7 +2460,7 @@ static void shb_CNG_encod_fx( push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); push_indice( hBstr, IND_SID_BW, 1, 1 ); -#ifdef HARM_PUSH_BIT +#ifdef HARM_PUSH_BIT delete_indice( hBstr, IND_CNG_ENV1 ); #else hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 96f8d0202..f508b313f 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } -#ifndef HARM_PUSH_BIT /* old bitstream */ +#ifndef HARM_PUSH_BIT /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 4913e410d..60e6019aa 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1675,7 +1675,7 @@ ivas_error init_encoder_ivas_fx( return error; } } - ELSE + ELSE { IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 2e1aed092..41127a98e 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -474,7 +474,7 @@ ivas_error create_sce_enc_fx( { return error; } - hSCE->hCoreCoder[0] = st; + hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index fdf410df5..dd01386d8 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -70,7 +70,7 @@ struct IVAS_ENC * Local functions *---------------------------------------------------------------------*/ -//static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +// static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error setBandwidth_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); -- GitLab From 3f70046df9d1c9ae2fc6c373d60b5165a865593a Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 11:34:05 -0400 Subject: [PATCH 289/358] fix reset indice for dtx case --- lib_enc/dtx_fx.c | 4 ++++ lib_enc/enc_ppp_fx.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 9a66572ab..6d8a29795 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -838,7 +838,11 @@ void dtx_fx( /* reset the bitstream (IVAS format signalling was already written) */ IF( NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) && st_fx->hBstr != NULL ) { +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); +#endif } } diff --git a/lib_enc/enc_ppp_fx.c b/lib_enc/enc_ppp_fx.c index c2aeaa7ca..9d1ffad60 100644 --- a/lib_enc/enc_ppp_fx.c +++ b/lib_enc/enc_ppp_fx.c @@ -189,8 +189,11 @@ ivas_error encod_ppp_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); - +#endif /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); } @@ -373,8 +376,11 @@ ivas_error encod_ppp_ivas_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); - +#endif /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); } -- GitLab From 16b3fe618f72cd1b7df54b0c3384092df6d62c85 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 12:52:49 -0400 Subject: [PATCH 290/358] Fix bitrate switching --- lib_enc/lib_enc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index dd01386d8..063f39dea 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1817,6 +1817,16 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( /* set pointers to the new buffers of indices in each element */ FOR( n = 0; n < st_ivas->nSCE; n++ ) { +#ifdef HARM_PUSH_BIT + st_ivas->hSCE[n]->hCoreCoder[0]->hBstr->ind_list = st_ivas->ind_list; + st_ivas->hSCE[n]->hCoreCoder[0]->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; + + if ( st_ivas->hSCE[n]->hMetaData != NULL ) + { + st_ivas->hSCE[n]->hMetaData->ind_list = st_ivas->ind_list_metadata; + st_ivas->hSCE[n]->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; + } +#else test(); IF( !( hIvasEnc->hCoreCoder == NULL && EQ_32( hEncoderConfig->ivas_format, MONO_FORMAT ) ) ) { @@ -1832,6 +1842,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( st_ivas->hSCE[n]->hMetaData->ind_list = st_ivas->ind_list_metadata; st_ivas->hSCE[n]->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; } +#endif } FOR( n = 0; n < st_ivas->nCPE; n++ ) -- GitLab From 37e3c531bcec2722e8832f6719877a575f1e5020 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 13:48:10 +0530 Subject: [PATCH 291/358] Scaling fix in find target and usan error fix --- lib_com/ivas_spar_com_fx.c | 2 +- lib_enc/find_tar_fx.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 5a0d342e9..317ea0249 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -7190,7 +7190,7 @@ void ivas_dirac_dec_get_response_fx_29( if ( GT_16( index_elevation, 90 ) ) { - e_fac = L_add( 0x80000000, 0 ); + e_fac = MIN_32; } diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index 4e15bc828..16ec45c78 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -203,6 +203,7 @@ void find_targets_ivas_fx( temp[i] = sub_sat( speech[i + i_subfr - M], mem_syn[i] ); /* Q_new - 1 */ move16(); } + Scale_sig( temp, M, 1 ); // scaling to make belong function output alligned //Qnew syn_filt_fx( 0, p_Aq, M, &res[i_subfr], temp + M, L_subfr, temp, 0 ); -- GitLab From 0d9fa201f91dc6977e4cec82201eeb6a5a86c854 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 15:05:24 +0530 Subject: [PATCH 292/358] Fix for 3GPP issue 1396: Stereo Encoder: BWE artefact at 48 kbps LTV Link #1396 --- lib_enc/ext_sig_ana_fx.c | 2 + lib_enc/ivas_mdct_core_enc_fx.c | 70 ++++++++++++++------------ lib_enc/ivas_stereo_mdct_core_enc_fx.c | 15 +++--- lib_enc/stat_enc.h | 1 + 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 087d892e3..53c8d080b 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -1385,6 +1385,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); } } + st->hTcxEnc->spectrum_length = L_subframe; + move16(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index f7da231a3..29ae0518c 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1251,6 +1251,8 @@ void ivas_mdct_core_whitening_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; + st->hTcxEnc->spectrum_length = st->hTcxEnc->L_frameTCX; + move16(); IF( GE_16( add( imult1616( hCPE->cpe_id, CPE_CHANNELS ), ch ), nChannels ) ) { CONTINUE; @@ -1266,6 +1268,8 @@ void ivas_mdct_core_whitening_enc_fx( core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] ); + st->hTcxEnc->spectrum_length = s_max( st->hTcxEnc->spectrum_length, st->hTcxEnc->L_frameTCX ); + move16(); /* BWD in MDCT domain */ IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { @@ -1373,16 +1377,16 @@ void ivas_mdct_core_whitening_enc_fx( q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com const Word16 switchKernel = /* these 4 transform types can be applied: 0 = MDCT-IV, 1 = MDST-II, 2 = MDCT-II, 3 = MDST-IV */ kernel_switch_detect_fx( hTcxEnc0->spectrum_fx[n], hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[0][n], mdst_spectrum_fx[1][n], q_com, nSampCore / nSubframes, @@ -1470,11 +1474,11 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[0][n], hTcxEnc0->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com speech = NULL; if ( NE_16( n, 1 ) ) @@ -1491,11 +1495,11 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[1][n], hTcxEnc1->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com speech = NULL; if ( NE_16( n, 1 ) ) @@ -1532,7 +1536,7 @@ void ivas_mdct_core_whitening_enc_fx( move16(); /* length = max(nSampCore / (2 * NB_DIV), L_subframeTCX / (2 * NB_DIV), NB_DIV = 2 */ length = shr( s_max( nSampCore, L_subframeTCX ), 2 ); - len_sbfr = shr( hTcxEnc0->L_frameTCX, shift ); + len_sbfr = shr( hTcxEnc0->spectrum_length, shift ); assert( hTcxEnc0->L_frameTCX == hTcxEnc1->L_frameTCX ); exp_max = s_max( hTcxEnc0->spectrum_e[n], hTcxEnc1->spectrum_e[n] ); exp_max = s_max( exp_max, mdst_spectrum_e[0][n] ); @@ -1624,22 +1628,22 @@ void ivas_mdct_core_whitening_enc_fx( { Word16 length; length = shr( s_max( nSampCore, L_subframeTCX ), shift ); // max(/* nSampCore/nSubframes, L_subframeTCX/nSubframes) */ - Word16 offset2 = sub( shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, length ); + Word16 offset2 = sub( shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, length ); exp_max = s_max( hTcxEnc0->spectrum_e[n], hTcxEnc1->spectrum_e[n] ); exp_max = s_max( exp_max, mdst_spectrum_e[0][n] ); exp_max = s_max( exp_max, mdst_spectrum_e[1][n] ); - exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); - exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); - exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ) ); q_com = sub( s_min( Q31, add( sub( Q31, exp_max ), exp_com ) ), 6 ); exp_com = sub( Q31, q_com ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) ); // mdst_spectrum_e - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) ); // mdst_spectrum_e + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) ); // mdst_spectrum_e + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) ); // mdst_spectrum_e Word16 q_com_orig = q_com; move16(); @@ -1724,12 +1728,12 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[ch][n], hTcxEncCh->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEncCh->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com + Scale_sig32( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEncCh->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com speech = hTcxEncCh->speech_TCX; if ( n != 0 ) @@ -1769,7 +1773,7 @@ void ivas_mdct_core_whitening_enc_fx( FOR( n = 0; n < nSubframes; n++ ) { q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -1791,7 +1795,7 @@ void ivas_mdct_core_whitening_enc_fx( } FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( Q31, q_com ); move16(); } @@ -1825,8 +1829,8 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); q_min = s_max( q_min, mdst_spectrum_e[ch][n] ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -1849,8 +1853,8 @@ void ivas_mdct_core_whitening_enc_fx( } FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( Q31, q_com ); move16(); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); @@ -2137,7 +2141,7 @@ void ivas_mdct_core_whitening_enc_fx( { q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -2161,7 +2165,7 @@ void ivas_mdct_core_whitening_enc_fx( FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( 31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( 31, hTcxEnc->spectrum_e[n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( 31, q_com ); move16(); } diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 3becb30d9..b32e8a561 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -363,11 +363,11 @@ void stereo_mdct_core_enc_fx( move16(); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - length = sts[ch]->hTcxEnc->L_frameTCX; + length = sts[ch]->hTcxEnc->spectrum_length; move16(); - if ( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { - length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + length = shr( length, 1 ); } hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[0], length ) ); @@ -384,15 +384,12 @@ void stereo_mdct_core_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - Word16 n_sb = NB_DIV; + length = sts[ch]->hTcxEnc->spectrum_length; move16(); - if ( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { - n_sb = 1; - move16(); + length = shr( length, 1 ); } - length = idiv1616( sts[ch]->hTcxEnc->L_frameTCX, n_sb ); /* Q0 */ - FOR( k = 0; k <= ( ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV ) - 1; k++ ) { Scale_sig32( sts[ch]->hTcxEnc->spectrum_fx[k], length, sub( q_spec, sub( Q31, sts[ch]->hTcxEnc->spectrum_e[k] ) ) ); /* q_spec */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 5305a8bdc..3977c4054 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1211,6 +1211,7 @@ typedef struct tcx_enc_structure Word32 spectrum_long_fx[N_MAX]; /* MDCT output for a long block. Points to spectrum */ Word16 spectrum_long_e; /* MDCT output for a long block. Points to spectrum */ Word16 q_spectrum_long_fx; + Word16 spectrum_length; } TCX_ENC_DATA, *TCX_ENC_HANDLE; typedef struct TransientDetection -- GitLab From a36f22ff48b932db898fa0f775876c998330e831 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 15:08:19 +0530 Subject: [PATCH 293/358] Fix for 3GPP issue 1444: OMASA float decoder crashes with BASOP created bitstream Link #1444 --- lib_enc/ivas_masa_enc_fx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 080a62a9d..2f060f681 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -3979,9 +3979,7 @@ static void quantize_ratio_ism_vector_ivas_fx( FOR( i = 0; i < no_ism_loc; i++ ) { - idx[i] = mult( ratio_ism_loc[i], max_sum_idx ); // exponent : ratio_ism_e + 15 - move16(); - idx[i] = shl( idx[i], sub( add( ratio_ism_e, 15 ), 15 ) ); // Q0 + idx[i] = extract_l( L_shr( L_mult0( ratio_ism_loc[i], max_sum_idx ), sub( 15, ratio_ism_e ) ) ); // Q0 move16(); part_idx_sum = add( part_idx_sum, idx[i] ); -- GitLab From 74f18249e5b2aeafe6b8496089ab0e3534fd952d Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 31 Mar 2025 13:42:54 +0200 Subject: [PATCH 294/358] Reactivate FIX_1378_ACELP_OUT_OF_BOUNDS after merge from main --- lib_com/options.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4653bb460..2b88deb5d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -67,6 +67,8 @@ #define BASOP_NOGLOB_DECLARE_LOCAL #endif +#define FIX_1378_ACELP_OUT_OF_BOUNDS + /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ -- GitLab From ed31c72d4671eb32825893b731f876f6e4ba7286 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 31 Mar 2025 15:42:03 +0200 Subject: [PATCH 295/358] Remove change of L_shl_sat/L_shl which is not supposed to be part of the merge request. --- lib_com/swb_tbe_com_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 4c91b0c7b..2a2841966 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -930,7 +930,7 @@ static void Calc_st_filt_tbe_ivas_enc_fx( { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } - g0 = extract_h( L_shl_sat( L_g0, 14 ) ); + g0 = extract_h( L_shl( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) -- GitLab From 418c31c56a80dd8781186d904b896f49ad22d61e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 21:13:07 +0530 Subject: [PATCH 296/358] Fix for 3GPP issue 1448: Complexity measurement crashes: StereoDmxEVS Link #1448 --- lib_com/tools_fx.c | 4 ++-- lib_com/wi_fx.c | 8 ++++---- lib_enc/core_enc_updt_fx.c | 4 ++-- lib_enc/fd_cng_enc_fx.c | 2 +- lib_enc/gaus_enc_fx.c | 2 +- lib_enc/ppp_enc_fx.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 5219d076c..9e5547c7d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -3579,8 +3579,8 @@ Word16 erb_diff_search_fx( Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif } ELSE { - dh = sub( dif_erb[i + offset], cb_fx[j * cb_dim + i] ); /* Q13 */ - Ltemp1 = L_mult( dh, dh ); /* Q27 */ + dh = sub_sat( dif_erb[i + offset], cb_fx[j * cb_dim + i] ); /* Q13 */ + Ltemp1 = L_mult_sat( dh, dh ); /* Q27 */ dh = extract_h( Ltemp1 ); dl = extract_l( Ltemp1 ); diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 7df4cb3f0..85d9df472 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -2901,11 +2901,11 @@ void quant_target_fx( DTFS_STRUCTURE *X_fx, const Word16 *curr_lpc, Word16 *w, W Ltemp1 = log10_fx( Ltemp1 ); /* subtract 10log10(2)*(2Q-13), Q23 */ - Ltemp1 = L_sub( Ltemp1, Ltemp3 ); + Ltemp1 = L_sub_sat( Ltemp1, Ltemp3 ); Ltemp1 = L_max( 0, Ltemp1 ); Ltemp2 = getSpEngyFromResAmp_fx( X_fx, 2828, X_fx->upper_cut_off_freq_fx, curr_lpc, sin_tab, cos_tab ); Ltemp2 = log10_fx( Ltemp2 ); /* Ltemp1=10log10(eng_hb), Q23, need to adjust for Q factor of energy (2Q-13) */ - Ltemp2 = L_sub( Ltemp2, Ltemp3 ); /* Ltemp2 in Q23 */ + Ltemp2 = L_sub_sat( Ltemp2, Ltemp3 ); /* Ltemp2 in Q23 */ Ltemp2 = L_max( 0, Ltemp2 ); @@ -2929,10 +2929,10 @@ void quant_target_fx( DTFS_STRUCTURE *X_fx, const Word16 *curr_lpc, Word16 *w, W tmp = round_fx( Ltemp ); /* tmp in Q(22-n) */ Ltemp1 = Mult_32_16( Ltemp1, tmp ); /* Q(30-n) */ n = sub( 8, exp ); - w[0] = round_fx( L_shl( Ltemp1, n ) ); /* w[0] in Q15 */ + w[0] = round_fx_sat( L_shl_sat( Ltemp1, n ) ); /* w[0] in Q15 */ move16(); Ltemp2 = Mult_32_16( Ltemp2, tmp ); - w[1] = round_fx( L_shl( Ltemp2, n ) ); /* w[1] in Q15 */ + w[1] = round_fx_sat( L_shl_sat( Ltemp2, n ) ); /* w[1] in Q15 */ move16(); logLag = log10_fx( X_fx->lag_fx ); /* logLag=10*log10(lag), Q23 */ diff --git a/lib_enc/core_enc_updt_fx.c b/lib_enc/core_enc_updt_fx.c index 305c2a92f..ce2681e75 100644 --- a/lib_enc/core_enc_updt_fx.c +++ b/lib_enc/core_enc_updt_fx.c @@ -171,8 +171,8 @@ void core_encode_update_cng_fx( tmp = sub( st->wspeech_enc[-1], shl( hLPDmem->mem_w0, shift ) ); E_UTIL_deemph2( negate( shift ), wsyn, st->preemph_fac, st->L_frame, &tmp ); - hLPDmem->mem_w0 = sub( st->wspeech_enc[st->L_frame - 1], tmp ); - hLPDmem->mem_w0 = shr( hLPDmem->mem_w0, shift ); + hLPDmem->mem_w0 = sub_sat( st->wspeech_enc[st->L_frame - 1], tmp ); + hLPDmem->mem_w0 = shr_sat( hLPDmem->mem_w0, shift ); move16(); move16(); /* Update LPC-related memories */ diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index d182e4a44..fbf5247c3 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -2066,7 +2066,7 @@ Word16 cng_energy_fx( L_tmp = L_mult0( tmp16, tmp16 ); pt_res++; tmp16 = shl( *pt_res, scale ); - L_tmp = L_mac0( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) */ + L_tmp = L_mac0_sat( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) */ pt_res++; L_ener = L_add( L_ener, L_shr( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* 2*(Q_new+scale)+15+1-16+1, divide by L_frame done here */ } diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index 081cf7ef0..2aa9a5dff 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -90,7 +90,7 @@ Word16 gaus_encode_fx( exp_code = sub( exp_code, 18 + 6 ); /* exp: -18 (code in Q9), -6 (L_subfr = 64) */ Ltmp = Isqrt_lc( Ltmp, &exp_code ); - *gain_inov = extract_h( L_shl( Ltmp, sub( exp_code, 3 ) ) ); /* g_code_inov in Q12 */ + *gain_inov = extract_h( L_shl_sat( Ltmp, sub( exp_code, 3 ) ) ); /* g_code_inov in Q12 */ nb_bits = st_fx->acelp_cfg.gains_mode[tmp_idx]; /* Q0 */ move16(); diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c index ac3d5836a..d6dc8b6d6 100644 --- a/lib_enc/ppp_enc_fx.c +++ b/lib_enc/ppp_enc_fx.c @@ -830,7 +830,7 @@ static void LPCPowSpect_fx( Lacc = L_add( Lacc, L_shr( L_mult( dh, dh ), 1 ) ); /* Lacc=Re^2+Im^2, Q22 */ exp = norm_l( Lacc ); - tmp = round_fx( L_shl( Lacc, exp ) ); + tmp = round_fx_sat( L_shl( Lacc, exp ) ); exp = sub( sub( 30, exp ), 22 ); /* tmp may potentially become negative, when Lacc is a very large value */ -- GitLab From 5bd27bba7b3a3e6a7027c20ba92f18a07b157c79 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 21:22:15 +0530 Subject: [PATCH 297/358] Clang formatting changes --- lib_com/wi_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 85d9df472..591645017 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -2904,7 +2904,7 @@ void quant_target_fx( DTFS_STRUCTURE *X_fx, const Word16 *curr_lpc, Word16 *w, W Ltemp1 = L_sub_sat( Ltemp1, Ltemp3 ); Ltemp1 = L_max( 0, Ltemp1 ); Ltemp2 = getSpEngyFromResAmp_fx( X_fx, 2828, X_fx->upper_cut_off_freq_fx, curr_lpc, sin_tab, cos_tab ); - Ltemp2 = log10_fx( Ltemp2 ); /* Ltemp1=10log10(eng_hb), Q23, need to adjust for Q factor of energy (2Q-13) */ + Ltemp2 = log10_fx( Ltemp2 ); /* Ltemp1=10log10(eng_hb), Q23, need to adjust for Q factor of energy (2Q-13) */ Ltemp2 = L_sub_sat( Ltemp2, Ltemp3 ); /* Ltemp2 in Q23 */ Ltemp2 = L_max( 0, Ltemp2 ); -- GitLab From 6f6165506aab955a2072277cd41e566794c17ec0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 2 Apr 2025 01:15:47 +0200 Subject: [PATCH 298/358] simplify initial patch --- lib_enc/ext_sig_ana_fx.c | 2 -- lib_enc/ivas_mdct_core_enc_fx.c | 7 +++---- lib_enc/stat_enc.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 53c8d080b..087d892e3 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -1385,8 +1385,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); } } - st->hTcxEnc->spectrum_length = L_subframe; - move16(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 29ae0518c..e27ec8c11 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1251,8 +1251,9 @@ void ivas_mdct_core_whitening_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - st->hTcxEnc->spectrum_length = st->hTcxEnc->L_frameTCX; - move16(); + init_tcx_enc_info_fx( st, &L_subframe, &L_subframeTCX, &tcx_subframe_coded_lines ); + st->hTcxEnc->spectrum_length = L_subframeTCX; + IF( GE_16( add( imult1616( hCPE->cpe_id, CPE_CHANNELS ), ch ), nChannels ) ) { CONTINUE; @@ -1268,8 +1269,6 @@ void ivas_mdct_core_whitening_enc_fx( core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] ); - st->hTcxEnc->spectrum_length = s_max( st->hTcxEnc->spectrum_length, st->hTcxEnc->L_frameTCX ); - move16(); /* BWD in MDCT domain */ IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 3977c4054..c6176709b 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1211,7 +1211,7 @@ typedef struct tcx_enc_structure Word32 spectrum_long_fx[N_MAX]; /* MDCT output for a long block. Points to spectrum */ Word16 spectrum_long_e; /* MDCT output for a long block. Points to spectrum */ Word16 q_spectrum_long_fx; - Word16 spectrum_length; + Word16 spectrum_length; /* corresponds to L_frameTCX, used for scaling of MDCT/MDST buffers */ } TCX_ENC_DATA, *TCX_ENC_HANDLE; typedef struct TransientDetection -- GitLab From a6ea0a059f1d0a5989279f34aaaeb78416092985 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 28 Feb 2025 18:45:21 +0100 Subject: [PATCH 299/358] rewritten all cov_smooth loops with better precision - with optional debug output --- lib_com/ivas_cov_smooth_fx.c | 139 ++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 33 deletions(-) mode change 100644 => 100755 lib_com/ivas_cov_smooth_fx.c diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c old mode 100644 new mode 100755 index 3a93ed1f5..e0f759f5f --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -42,6 +42,13 @@ *-----------------------------------------------------------------------------------------*/ #define BAND_SMOOTH_REST_START_IDX ( 2 ) +#define ONEeN20_Q97 0x5E728433 // 1e-20 in Q97 1.584.563.251 + +//#define DEBUG_ivas_compute_smooth_cov_fx +#ifdef DEBUG_ivas_compute_smooth_cov_fx +#include +#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_update_factor_fx() @@ -87,8 +94,14 @@ static void ivas_calculate_smoothning_factor_fx( move16(); tmp = BASOP_Util_Divide3232_Scale( update_factor, L_shl( L_deposit_l( min_pool_size ), Q22 ), &exp_diff ); // Q(31 - exp_diff) - *Smoothing_factor = L_shl_sat( L_deposit_l( tmp ), add( Q16, exp_diff ) ); // Q31 + *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff ); // Q31 move32(); +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "Smoothing_factor %g update_factor %g min_pool_size %d j=%d\n", + (double) *Smoothing_factor * pow (2.0, -31), + (double) update_factor + pow (2.0, -22.0), min_pool_size, j ); +#endif + IF( NE_32( smooth_mode, COV_SMOOTH_MC ) ) { @@ -264,19 +277,17 @@ void ivas_spar_covar_smooth_enc_close_fx( return; } - /*-----------------------------------------------------------------------------------------* * Function ivas_compute_smooth_cov_fx() * * Compute smooth covariance real/imag. *-----------------------------------------------------------------------------------------*/ - static void ivas_compute_smooth_cov_fx( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, Word32 *pCov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], // i/o: Q(q_cov[i][j]) Word32 *pPrior_cov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], // i: hCovState->q_cov_real_per_band[i][j][k] - const Word32 fac, + const Word32 fac, // i: ONEeN20_Q97 (1e-20 in Q97) const Word16 start_band, const Word16 end_band, const Word16 num_ch, @@ -285,10 +296,15 @@ static void ivas_compute_smooth_cov_fx( { Word16 i, j, k; Word16 prev_idx = hCovState->prior_bank_idx; - Word32 factor = 0, L_tmp, L_tmp1; + Word32 factor = 0, L_tmp0, L_tmp1; + + const Word16 q_fac = 97; + const Word16 fac_e = sub(Q31, q_fac); + + Word16 cov_buf_e; + Word16 sm_b; Word16 non_sm_b_idx; - Word16 q_tmp[IVAS_MAX_NUM_BANDS]; sm_b = BAND_SMOOTH_REST_START_IDX; move16(); @@ -296,7 +312,9 @@ static void ivas_compute_smooth_cov_fx( move32(); assert( end_band <= pFb->filterbank_num_bands ); - +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "\n" ); +#endif test(); IF( EQ_16( prev_idx, -1 ) || EQ_16( transient_det[1], 1 ) ) { @@ -309,11 +327,28 @@ static void ivas_compute_smooth_cov_fx( } FOR( i = 0; i < num_ch; i++ ) { +#ifdef DEBUG_ivas_compute_smooth_cov_fx + Word16 cov_buf_e = sub( Q31, q_cov[i][i] ); +#endif FOR( k = start_band; k < end_band; k++ ) { - L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 - pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); // hCovState->q_cov_real_per_band[i][j][k] + /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */ +#ifdef DEBUG_ivas_compute_smooth_cov_fx + Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ +#endif + pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); + hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); + move16(); +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "A: pCov_buf[%d][%d][%d] %g (0x%08X 0x%04X) fac %g sm-factor %g buf %g\n", i, i, k, + (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), + pCov_buf[i][i][k], + hCovState->q_cov_real_per_band[i][i][k] & 0xFFFF, + (double) fac * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] *pow (2.0, -31.0), + (double) L_buf * pow(2.0, (double) -q_cov[i][i])); +#endif } } } @@ -326,38 +361,63 @@ static void ivas_compute_smooth_cov_fx( { IF( EQ_16( i, j ) ) { - factor = fac; // Q31 + factor = fac; // Q97 move32(); } ELSE { - factor = 0; + factor = 0; // Q97 move32(); } - set16_fx( q_tmp, q_cov[i][j], sub( end_band, start_band ) ); FOR( k = start_band; k < non_sm_b_idx; k++ ) { - L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] - L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] - pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &q_tmp[k] ); // Q(31 - q_tmp[k]) + /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */ + /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + + factor * hCovState->pSmoothing_factor[k] ); */ +#ifdef DEBUG_ivas_compute_smooth_cov_fx + Word32 L_buf = pCov_buf[i][j][k]; +#endif + L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] + L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k] + L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e ); + pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp0, cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), fac_e, &cov_buf_e ); move32(); - q_tmp[k] = sub( Q31, q_tmp[k] ); // Q of pConv_buf[i][j][k] is now q_tmp[k] + hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); - L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] - pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); // q_tmp[k] - move32(); + +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "B1: pCov_buf[%d][%d][%d] %g fac %g sm-factor %g prior %g buf %g (q=%d)\n", i, j, k, + (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), + (double) factor * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), + (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); +#endif + } - Copy( q_tmp, hCovState->q_cov_real_per_band[i][j], sub( end_band, start_band ) ); // Q of pCov_buf[i][j][k] is hCovState->q_cov_real_per_band[i][j][j] } } FOR( i = 0; i < num_ch; i++ ) { FOR( k = non_sm_b_idx; k < end_band; k++ ) { - L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ); // (Q31, Q31) -> Q31 - pCov_buf[i][i][k] = L_add( pCov_buf[i][i][k], L_shl( L_tmp, sub( hCovState->q_cov_real_per_band[i][i][k], Q31 ) ) ); // hCovState->q_cov_real_per_band[i][j][j] + /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */ +#ifdef DEBUG_ivas_compute_smooth_cov_fx + Word32 L_buf = pCov_buf[i][i][k]; +#endif + pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e , &cov_buf_e); move32(); + hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][i][k] + move16(); +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "B2: pCov_buf[%d][%d][%d] %g fac %g sm-factor %g buf %g (q=%d)\n", i, i, k, + (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), + (double) fac * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ), q_cov[i][i]); +#endif } } } @@ -369,28 +429,41 @@ static void ivas_compute_smooth_cov_fx( { IF( EQ_16( i, j ) ) { - factor = fac; // Q31 + factor = fac; // Q97 move32(); } ELSE { - factor = 0; + factor = 0; // Q97 move32(); } FOR( k = start_band; k < end_band; k++ ) { - L_tmp = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // (Q31, q_cov[i][j]) -> q_cov[i][j] - L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // (Q31, hCovState->q_cov_real_per_band[i][j][k]) -> hCovState->q_cov_real_per_band[i][j][k] - pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &q_tmp[k] ); // Q(31 - q_tmp[k]) + /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */ + /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + + factor * hCovState->pSmoothing_factor[k] ); */ +#ifdef DEBUG_ivas_compute_smooth_cov_fx + Word32 L_buf = pCov_buf[i][j][k]; /* debug !! */ +#endif + L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] + L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k] + L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e ); + pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp0, cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), fac_e, &cov_buf_e ); move32(); - q_tmp[k] = sub( Q31, q_tmp[k] ); // Q of pConv_buf[i][j][k] is now q_tmp[k] + hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); - L_tmp = L_shl( Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), sub( q_tmp[k], Q31 ) ); // ((Q31, Q31) -> Q31) -> q_tmp[k] - pCov_buf[i][j][k] = L_add( pCov_buf[i][j][k], L_tmp ); // q_tmp[k] - move32(); +#ifdef DEBUG_ivas_compute_smooth_cov_fx + printf( "C: pCov_buf[%d][%d][%d] %g factor %g sm-factor %g prior %g buf %g (q=%d)\n", i, j, k, + (double) pCov_buf[i][j][k] * pow(2.0, (double) -hCovState->q_cov_real_per_band[i][j][k]), + (double) factor * pow(2.0, (double) -q_fac), + (double) hCovState->pSmoothing_factor_fx[k] * pow(2.0, -Q31), + (double) pPrior_cov_buf[i][j][k] * pow(2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); +#endif + } - Copy( q_tmp, hCovState->q_cov_real_per_band[i][j], sub( end_band, start_band ) ); // Q of pCov_buf[i][j][k] is hCovState->q_cov_real_per_band[i][j][j] } } } @@ -418,7 +491,7 @@ void ivas_cov_smooth_process_fx( Word16 i, j, k; Word16 num_bands = sub( end_band, start_band ); - ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, 0, start_band, end_band, num_ch, transient_det, q_cov ); + ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, ONEeN20_Q97, start_band, end_band, num_ch, transient_det, q_cov ); FOR( i = 0; i < num_ch; i++ ) { -- GitLab From 8629f3b47ec26c6ce64ea82e440ccc421a462291 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 10 Mar 2025 18:06:58 +0100 Subject: [PATCH 300/358] fixed issue with wrong q for prior variables - debug prints inactive --- lib_com/ivas_cov_smooth_fx.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index e0f759f5f..513f84ea0 100755 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -97,9 +97,9 @@ static void ivas_calculate_smoothning_factor_fx( *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff ); // Q31 move32(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "Smoothing_factor %g update_factor %g min_pool_size %d j=%d\n", + printf( "Smoothing_factor %e update_factor %e min_pool_size %d j=%d\n", (double) *Smoothing_factor * pow (2.0, -31), - (double) update_factor + pow (2.0, -22.0), min_pool_size, j ); + (double) update_factor * pow (2.0, -22.0), min_pool_size, j ); #endif @@ -341,7 +341,7 @@ static void ivas_compute_smooth_cov_fx( hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "A: pCov_buf[%d][%d][%d] %g (0x%08X 0x%04X) fac %g sm-factor %g buf %g\n", i, i, k, + printf( "A: pCov_buf[%d][%d][%d] %e (0x%08X 0x%04X) fac %e sm-factor %e buf %e\n", i, i, k, (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), pCov_buf[i][i][k], hCovState->q_cov_real_per_band[i][i][k] & 0xFFFF, @@ -388,7 +388,7 @@ static void ivas_compute_smooth_cov_fx( move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B1: pCov_buf[%d][%d][%d] %g fac %g sm-factor %g prior %g buf %g (q=%d)\n", i, j, k, + printf( "B1: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), (double) factor * pow( 2.0, (double) -q_fac ), (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), @@ -397,6 +397,11 @@ static void ivas_compute_smooth_cov_fx( #endif } + FOR( ; k < end_band; k++ ) + { + hCovState->q_cov_real_per_band[i][j][k] = q_cov[i][j]; + move16(); + } } } FOR( i = 0; i < num_ch; i++ ) @@ -412,7 +417,7 @@ static void ivas_compute_smooth_cov_fx( hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][i][k] move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B2: pCov_buf[%d][%d][%d] %g fac %g sm-factor %g buf %g (q=%d)\n", i, i, k, + printf( "B2: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e buf %e (q=%d)\n", i, i, k, (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), (double) fac * pow( 2.0, (double) -q_fac ), (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), @@ -455,7 +460,7 @@ static void ivas_compute_smooth_cov_fx( hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "C: pCov_buf[%d][%d][%d] %g factor %g sm-factor %g prior %g buf %g (q=%d)\n", i, j, k, + printf( "C: pCov_buf[%d][%d][%d] %e factor %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, (double) pCov_buf[i][j][k] * pow(2.0, (double) -hCovState->q_cov_real_per_band[i][j][k]), (double) factor * pow(2.0, (double) -q_fac), (double) hCovState->pSmoothing_factor_fx[k] * pow(2.0, -Q31), -- GitLab From ea5245e56e431269bb54c131dfcb6430683de21e Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 10 Mar 2025 18:32:18 +0100 Subject: [PATCH 301/358] fixed clang-format-issue --- lib_com/ivas_cov_smooth_fx.c | 76 ++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 39 deletions(-) mode change 100755 => 100644 lib_com/ivas_cov_smooth_fx.c diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c old mode 100755 new mode 100644 index 513f84ea0..150dc3bfc --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -42,7 +42,7 @@ *-----------------------------------------------------------------------------------------*/ #define BAND_SMOOTH_REST_START_IDX ( 2 ) -#define ONEeN20_Q97 0x5E728433 // 1e-20 in Q97 1.584.563.251 +#define ONEeN20_Q97 0x5E728433 // 1e-20 in Q97 1.584.563.251 //#define DEBUG_ivas_compute_smooth_cov_fx #ifdef DEBUG_ivas_compute_smooth_cov_fx @@ -94,12 +94,12 @@ static void ivas_calculate_smoothning_factor_fx( move16(); tmp = BASOP_Util_Divide3232_Scale( update_factor, L_shl( L_deposit_l( min_pool_size ), Q22 ), &exp_diff ); // Q(31 - exp_diff) - *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff ); // Q31 + *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff ); // Q31 move32(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "Smoothing_factor %e update_factor %e min_pool_size %d j=%d\n", - (double) *Smoothing_factor * pow (2.0, -31), - (double) update_factor * pow (2.0, -22.0), min_pool_size, j ); + printf( "Smoothing_factor %e update_factor %e min_pool_size %d j=%d\n", + (double) *Smoothing_factor * pow( 2.0, -31 ), + (double) update_factor * pow( 2.0, -22.0 ), min_pool_size, j ); #endif @@ -299,7 +299,7 @@ static void ivas_compute_smooth_cov_fx( Word32 factor = 0, L_tmp0, L_tmp1; const Word16 q_fac = 97; - const Word16 fac_e = sub(Q31, q_fac); + const Word16 fac_e = sub( Q31, q_fac ); Word16 cov_buf_e; @@ -334,20 +334,20 @@ static void ivas_compute_smooth_cov_fx( { /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */ #ifdef DEBUG_ivas_compute_smooth_cov_fx - Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ + Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ #endif pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "A: pCov_buf[%d][%d][%d] %e (0x%08X 0x%04X) fac %e sm-factor %e buf %e\n", i, i, k, - (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), - pCov_buf[i][i][k], - hCovState->q_cov_real_per_band[i][i][k] & 0xFFFF, - (double) fac * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] *pow (2.0, -31.0), - (double) L_buf * pow(2.0, (double) -q_cov[i][i])); + printf( "A: pCov_buf[%d][%d][%d] %e (0x%08X 0x%04X) fac %e sm-factor %e buf %e\n", i, i, k, + (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), + pCov_buf[i][i][k], + hCovState->q_cov_real_per_band[i][i][k] & 0xFFFF, + (double) fac * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -31.0 ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ) ); #endif } } @@ -366,14 +366,14 @@ static void ivas_compute_smooth_cov_fx( } ELSE { - factor = 0; // Q97 + factor = 0; // Q97 move32(); } FOR( k = start_band; k < non_sm_b_idx; k++ ) { /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */ - /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + + /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + factor * hCovState->pSmoothing_factor[k] ); */ #ifdef DEBUG_ivas_compute_smooth_cov_fx @@ -388,14 +388,13 @@ static void ivas_compute_smooth_cov_fx( move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B1: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, - (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), - (double) factor * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), - (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); + printf( "B1: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, + (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), + (double) factor * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), + (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); #endif - } FOR( ; k < end_band; k++ ) { @@ -412,16 +411,16 @@ static void ivas_compute_smooth_cov_fx( #ifdef DEBUG_ivas_compute_smooth_cov_fx Word32 L_buf = pCov_buf[i][i][k]; #endif - pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e , &cov_buf_e); + pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][i][k] move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B2: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e buf %e (q=%d)\n", i, i, k, - (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), - (double) fac * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ), q_cov[i][i]); + printf( "B2: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e buf %e (q=%d)\n", i, i, k, + (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), + (double) fac * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ), q_cov[i][i] ); #endif } } @@ -439,20 +438,20 @@ static void ivas_compute_smooth_cov_fx( } ELSE { - factor = 0; // Q97 + factor = 0; // Q97 move32(); } FOR( k = start_band; k < end_band; k++ ) { /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */ - /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + + /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + factor * hCovState->pSmoothing_factor[k] ); */ #ifdef DEBUG_ivas_compute_smooth_cov_fx Word32 L_buf = pCov_buf[i][j][k]; /* debug !! */ #endif - L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] + L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k] L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e ); pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp0, cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), fac_e, &cov_buf_e ); @@ -460,14 +459,13 @@ static void ivas_compute_smooth_cov_fx( hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); #ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "C: pCov_buf[%d][%d][%d] %e factor %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, - (double) pCov_buf[i][j][k] * pow(2.0, (double) -hCovState->q_cov_real_per_band[i][j][k]), - (double) factor * pow(2.0, (double) -q_fac), - (double) hCovState->pSmoothing_factor_fx[k] * pow(2.0, -Q31), - (double) pPrior_cov_buf[i][j][k] * pow(2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); + printf( "C: pCov_buf[%d][%d][%d] %e factor %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, + (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), + (double) factor * pow( 2.0, (double) -q_fac ), + (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), + (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), + (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); #endif - } } } -- GitLab From 73859be2519bd242ff115fbcf4c385103d6c1e74 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 25 Mar 2025 22:16:40 +0100 Subject: [PATCH 302/358] corrected use of exponents of cov_buf matrices --- lib_com/ivas_cov_smooth_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index 150dc3bfc..1b9cb5c99 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -328,7 +328,7 @@ static void ivas_compute_smooth_cov_fx( FOR( i = 0; i < num_ch; i++ ) { #ifdef DEBUG_ivas_compute_smooth_cov_fx - Word16 cov_buf_e = sub( Q31, q_cov[i][i] ); + cov_buf_e = sub( Q31, q_cov[i][i] ); #endif FOR( k = start_band; k < end_band; k++ ) { @@ -336,7 +336,7 @@ static void ivas_compute_smooth_cov_fx( #ifdef DEBUG_ivas_compute_smooth_cov_fx Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ #endif - pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); + pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub(Q31, q_cov[i][i]), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); move16(); -- GitLab From 5be8b9cff93c419462f8d16cabf1824a8cd095e7 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 25 Mar 2025 23:58:59 +0100 Subject: [PATCH 303/358] fix clang-format issue --- lib_com/ivas_cov_smooth_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index 1b9cb5c99..d7cabd0db 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -336,7 +336,7 @@ static void ivas_compute_smooth_cov_fx( #ifdef DEBUG_ivas_compute_smooth_cov_fx Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ #endif - pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub(Q31, q_cov[i][i]), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); + pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); move16(); -- GitLab From 47ecefacad3c2aa92dfca1499986d11df69b0e55 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 31 Mar 2025 20:52:36 +0200 Subject: [PATCH 304/358] remove debug code --- lib_com/ivas_cov_smooth_fx.c | 60 ------------------------------------ 1 file changed, 60 deletions(-) diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index d7cabd0db..a50f5d2d2 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -44,11 +44,6 @@ #define BAND_SMOOTH_REST_START_IDX ( 2 ) #define ONEeN20_Q97 0x5E728433 // 1e-20 in Q97 1.584.563.251 -//#define DEBUG_ivas_compute_smooth_cov_fx -#ifdef DEBUG_ivas_compute_smooth_cov_fx -#include -#endif - /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_update_factor_fx() @@ -96,11 +91,6 @@ static void ivas_calculate_smoothning_factor_fx( tmp = BASOP_Util_Divide3232_Scale( update_factor, L_shl( L_deposit_l( min_pool_size ), Q22 ), &exp_diff ); // Q(31 - exp_diff) *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff ); // Q31 move32(); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "Smoothing_factor %e update_factor %e min_pool_size %d j=%d\n", - (double) *Smoothing_factor * pow( 2.0, -31 ), - (double) update_factor * pow( 2.0, -22.0 ), min_pool_size, j ); -#endif IF( NE_32( smooth_mode, COV_SMOOTH_MC ) ) @@ -312,9 +302,6 @@ static void ivas_compute_smooth_cov_fx( move32(); assert( end_band <= pFb->filterbank_num_bands ); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "\n" ); -#endif test(); IF( EQ_16( prev_idx, -1 ) || EQ_16( transient_det[1], 1 ) ) { @@ -327,28 +314,13 @@ static void ivas_compute_smooth_cov_fx( } FOR( i = 0; i < num_ch; i++ ) { -#ifdef DEBUG_ivas_compute_smooth_cov_fx - cov_buf_e = sub( Q31, q_cov[i][i] ); -#endif FOR( k = start_band; k < end_band; k++ ) { /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */ -#ifdef DEBUG_ivas_compute_smooth_cov_fx - Word32 L_buf = pCov_buf[i][i][k]; /* debug !! */ -#endif pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); move16(); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "A: pCov_buf[%d][%d][%d] %e (0x%08X 0x%04X) fac %e sm-factor %e buf %e\n", i, i, k, - (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), - pCov_buf[i][i][k], - hCovState->q_cov_real_per_band[i][i][k] & 0xFFFF, - (double) fac * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -31.0 ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ) ); -#endif } } } @@ -376,9 +348,6 @@ static void ivas_compute_smooth_cov_fx( /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + factor * hCovState->pSmoothing_factor[k] ); */ -#ifdef DEBUG_ivas_compute_smooth_cov_fx - Word32 L_buf = pCov_buf[i][j][k]; -#endif L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k] L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e ); @@ -387,14 +356,6 @@ static void ivas_compute_smooth_cov_fx( hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B1: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, - (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), - (double) factor * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), - (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); -#endif } FOR( ; k < end_band; k++ ) { @@ -408,20 +369,10 @@ static void ivas_compute_smooth_cov_fx( FOR( k = non_sm_b_idx; k < end_band; k++ ) { /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */ -#ifdef DEBUG_ivas_compute_smooth_cov_fx - Word32 L_buf = pCov_buf[i][i][k]; -#endif pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e ); move32(); hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][i][k] move16(); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "B2: pCov_buf[%d][%d][%d] %e fac %e sm-factor %e buf %e (q=%d)\n", i, i, k, - (double) pCov_buf[i][i][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][i][k] ), - (double) fac * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][i] ), q_cov[i][i] ); -#endif } } } @@ -448,9 +399,6 @@ static void ivas_compute_smooth_cov_fx( /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] + pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) + factor * hCovState->pSmoothing_factor[k] ); */ -#ifdef DEBUG_ivas_compute_smooth_cov_fx - Word32 L_buf = pCov_buf[i][j][k]; /* debug !! */ -#endif L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] ); // q_tmp0: q_cov[i][j] // (Q31, q_cov[i][j]) -> q_cov[i][j] L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k] L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e ); @@ -458,14 +406,6 @@ static void ivas_compute_smooth_cov_fx( move32(); hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); -#ifdef DEBUG_ivas_compute_smooth_cov_fx - printf( "C: pCov_buf[%d][%d][%d] %e factor %e sm-factor %e prior %e buf %e (q=%d)\n", i, j, k, - (double) pCov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_cov_real_per_band[i][j][k] ), - (double) factor * pow( 2.0, (double) -q_fac ), - (double) hCovState->pSmoothing_factor_fx[k] * pow( 2.0, -Q31 ), - (double) pPrior_cov_buf[i][j][k] * pow( 2.0, (double) -hCovState->q_prior_cov_real_per_band[i][j][k] ), - (double) L_buf * pow( 2.0, (double) -q_cov[i][j] ), q_cov[i][j] ); -#endif } } } -- GitLab From b9604e9df6c79950b6267cac69f14f066b79b740 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 31 Mar 2025 21:04:12 +0200 Subject: [PATCH 305/358] formatting --- lib_com/ivas_cov_smooth_fx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/ivas_cov_smooth_fx.c b/lib_com/ivas_cov_smooth_fx.c index a50f5d2d2..9a8de3c1f 100644 --- a/lib_com/ivas_cov_smooth_fx.c +++ b/lib_com/ivas_cov_smooth_fx.c @@ -355,7 +355,6 @@ static void ivas_compute_smooth_cov_fx( move32(); hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k] move16(); - } FOR( ; k < end_band; k++ ) { -- GitLab From cb180abb1baf83ada5a1a82e23e582573432c2f9 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 2 Apr 2025 12:35:33 +0530 Subject: [PATCH 306/358] Fix for 3GPP issue 1452: Decoder crash for FOA at 96kbps JBM decoding to FOA in TonalMDCTConceal_InsertNoise_ivas_fx() Link #1452 --- lib_dec/tonalMDCTconcealment_fx.c | 154 +++++++++++++++--------------- 1 file changed, 75 insertions(+), 79 deletions(-) diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index e74df3a96..bc7e1d536 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -1383,12 +1383,15 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( Word16 rnd; Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain; - Word32 L_tmp, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; + Word32 L_tmp, L_tmp1, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise; Word16 inv_exp, inv_samples, exp; Word32 last_block_nrg_correct; Word16 last_block_nrg_correct_e; Word32 max_concealment_value; Word16 max_spectral_value; + Word64 sum1, sum2; + Word16 num16, den16, exp1, exp2; + Word16 shift1, shift2; crossfadeGain = crossfadeGain_const; move16(); @@ -1851,28 +1854,36 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } } ELSE{ - IF( !tonalConcealmentActive ){ - ld = sub( 14, norm_s( hTonalMDCTConc->lastBlockData.nSamples ) ); - fac = shr( -32768, ld ); - + IF( tonalConcealmentActive == 0 ){ + sum1 = 0; + sum2 = 0; + move64(); + move64(); FOR( i = 0; i < crossOverFreq; i++ ) { - Word16 x = hTonalMDCTConc->lastBlockData.spectralData[i]; - Word32 y; - rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ - y = L_mult( tilt, rnd ); /* 15Q16 */ + Word16 x; + /*x = hTonalMDCTConc->lastBlockData.spectralData[i]; + nrgNoiseInLastFrame += x * x;*/ + sum1 = W_mac0_16_16( sum1, hTonalMDCTConc->lastBlockData.spectralData[i], hTonalMDCTConc->lastBlockData.spectralData[i] ); // Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp) - nrgNoiseInLastFrame = L_add( nrgNoiseInLastFrame, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - x_exp - ld) + Q(15 - x_exp) - 15 = Q(31 - x_exp * 2 - ld) - x = round_fx( y ); /* 15Q16 -> 15Q0 */ - nrgWhiteNoise = L_add( nrgWhiteNoise, Mpy_32_16_1( L_msu( 0, x, fac ), x ) ); // Q(31 - (15 - 0) - ld) + Q(0) - 15 = Q(1 - ld) + /* rnd = own_random(&rnd); */ + rnd = extract_l( L_mac0( 13849, rnd, 31821 ) ); /* Q0 */ - mdctSpectrum[i] = y; /* 15Q16 */ + /* mdctSpectrum[i] = tilt * rnd; */ + mdctSpectrum[i] = L_mult( tilt, rnd ); // Q16 move32(); + /* tilt *= tiltFactor; */ tilt = mult_r( tilt, tiltFactor ); /* Q15 */ + + /* nrgWhiteNoise += mdctSpectrum[i] * mdctSpectrum[i]; */ + x = round_fx( mdctSpectrum[i] ); // Q0 + sum2 = W_mac0_16_16( sum2, x, x ); // Q0 } + *mdctSpectrum_exp = 15; + move16(); - IF( nrgNoiseInLastFrame == 0 ) + IF( sum1 /* nrgNoiseInLastFrame */ == 0 ) { set32_fx( mdctSpectrum, 0, crossOverFreq ); *mdctSpectrum_exp = SPEC_EXP_DEC; @@ -1880,85 +1891,70 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( } ELSE { - exp_last = add( ld, shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ) ); - exp_noise = add( ld, 30 ); - - IF( nrgWhiteNoise > 0 ) + IF( g == 0 ) { - ld = norm_l( nrgNoiseInLastFrame ); - nrgNoiseInLastFrame = L_shl( nrgNoiseInLastFrame, ld ); // Q31- exp_last + ld - exp_last = sub( exp_last, ld ); - ld = norm_l( nrgWhiteNoise ); - nrgWhiteNoise = L_shl( nrgWhiteNoise, ld ); // Q31 - exp_noise + ld - exp_noise = sub( exp_noise, ld ); - - exp = sub( exp_last, exp_noise ); - - IF( GT_32( nrgNoiseInLastFrame, nrgWhiteNoise ) ) - { - nrgNoiseInLastFrame = L_shr( nrgNoiseInLastFrame, 1 ); // Q31-exp -1 - exp = add( exp, 1 ); - } - tmp = div_l( nrgNoiseInLastFrame, round_fx( nrgWhiteNoise ) ); // Q15 - tmp = Sqrt16( tmp, &exp ); - g = mult_r( g, tmp ); // exponent of g = exp - - L_tmp = L_deposit_h( 0 ); - ld = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, 15 ); - exp = sub( ld, exp ); - - IF( exp > 0 ) - { - g = shr( g, exp ); // Q15 - exp - *mdctSpectrum_exp = hTonalMDCTConc->lastBlockData.spectralData_exp; - move16(); - } - ELSE - { - crossfadeGain = shl( crossfadeGain, exp ); // Q15-e_crossfadeGain+ exp - e_crossfadeGain = sub( e_crossfadeGain, exp ); - *mdctSpectrum_exp = add( e_crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData_exp ); - move16(); - } - /*make a headroom for mdct_shaping*/ - exp = sub( *mdctSpectrum_exp, SPEC_EXP_DEC ); - /* assert(exp < 0);*/ - IF( exp < 0 ) - { - *mdctSpectrum_exp = SPEC_EXP_DEC; - move16(); - } - ELSE + *mdctSpectrum_exp = add( add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ), 31 - SPEC_EXP_DEC ); + move16(); + FOR( i = 0; i < crossOverFreq; i++ ) { - exp = 0; - move16(); + /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ + L_tmp = L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain + if ( mdctSpectrum[i] <= 0 ) + { + /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ + L_tmp = L_negate( L_tmp ); // exp: hTonalMDCTConc->lastBlockData.spectralData_exp+e_crossfadeGain + } + /* headroom for mdct_shaping */ + mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // *mdctSpectrum_exp + move32(); } } - FOR( i = 0; i < crossOverFreq; i++ ) + ELSE { - Word16 const x = hTonalMDCTConc->lastBlockData.spectralData[i]; // Q15 - spectralData_exp - move16(); - Word32 const y = mdctSpectrum[i]; // Q31-mdctSpectrum_exp - move32(); - - IF( g > 0 ) + IF( sum2 /* nrgWhiteNoise */ > 0 ) { - L_tmp = Mpy_32_16_1( y, g ); // Q31-mdctSpectrum_exp- spectralData_exp + exp1 = sub( W_norm( sum1 ), 1 ); + num16 = extract_h( W_extract_h( W_shl( sum1, exp1 ) ) ); // nrgNoiseInLastFrame -> Q: 2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48 + exp2 = W_norm( sum2 ); + den16 = extract_h( W_extract_h( W_shl( sum2, exp2 ) ) ); // nrgWhiteNoise -> Q: exp2-48 + + /* sqrt( nrgNoiseInLastFrame / nrgWhiteNoise ) */ + tmp = div_s( num16, den16 ); // Q: 15+(2*(15-hTonalMDCTConc->lastBlockData.spectralData_exp)+exp1-48)-(exp2-48) + exp = sub( sub( shl( hTonalMDCTConc->lastBlockData.spectralData_exp, 1 ), 30 ), sub( exp1, exp2 ) ); // exp of tmp + tmp = Sqrt16( tmp, &exp ); + g = mult_r( g, tmp ); // exponent of g = exp } - L_tmp2 = L_msu( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp - IF( GT_32( y, 0 ) ) + exp1 = add( *mdctSpectrum_exp, exp ); + exp2 = add( hTonalMDCTConc->lastBlockData.spectralData_exp, e_crossfadeGain ); + exp = add( s_max( exp1, exp2 ), 1 ); + shift1 = sub( exp1, exp ); + shift2 = sub( exp2, exp ); + + FOR( i = 0; i < crossOverFreq; i++ ) { - L_tmp2 = L_mac( L_tmp, crossfadeGain, x ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + L_tmp1 = L_shl( Mpy_32_16_1( mdctSpectrum[i], g ), shift1 ); // g * mdctSpectrum[i] + L_tmp2 = L_shl( L_mult( crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData[i] ), shift2 ); // exp + + /* mdctSpectrum[i] = g * mdctSpectrum[i] - crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ + L_tmp = L_sub( L_tmp1, L_tmp2 ); // exp + if ( mdctSpectrum[i] > 0 ) + { + /* mdctSpectrum[i] = g * mdctSpectrum[i] + crossfadeGain * hTonalMDCTConc->lastBlockData.spectralData[i]; */ + L_tmp = L_add( L_tmp1, L_tmp2 ); // exp + } + mdctSpectrum[i] = L_shr( L_tmp, 31 - SPEC_EXP_DEC ); // exp+31-SPEC_EXP_DEC + move32(); } - mdctSpectrum[i] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp - move32(); + /* headroom for mdct_shaping */ + *mdctSpectrum_exp = add( exp, 31 - SPEC_EXP_DEC ); + move16(); } } - exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, sub( *mdctSpectrum_exp, 16 ) ); + exp = sub( hTonalMDCTConc->lastBlockData.spectralData_exp, *mdctSpectrum_exp ); FOR( i = crossOverFreq; i < hTonalMDCTConc->lastBlockData.nSamples; i++ ) { - mdctSpectrum[i] = L_shl( L_deposit_l( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // Q15 - spectralData_exp + exp + mdctSpectrum[i] = L_shl( L_deposit_h( hTonalMDCTConc->lastBlockData.spectralData[i] ), exp ); // mdctSpectrum_exp move32(); } } -- GitLab From 9770a293ee45b6d074f2c194c0c500424cf03908 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 2 Apr 2025 12:37:21 +0530 Subject: [PATCH 307/358] Fix for 3GPP issue 1453: [regression] Encoder abort (divide by zero) for MC 5.1+2 encoding in ivas_param_mc_quantize_ilds_fx() Link #1453 --- lib_enc/ivas_mc_param_enc_fx.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 92cd33e2f..54fe249cd 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -1422,8 +1422,21 @@ static void ivas_param_mc_quantize_ilds_fx( dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, Cx_fx[k][k], Cx_e[k][k], &dmx_ener_e ); } /*ener_fac = 10.0f * log10f( ( tot_ener + EPSILON ) / ( dmx_ener + EPSILON ) )*/ - tot_ener_fx = BASOP_Util_Add_Mant32Exp( tot_ener_fx, tot_ener_e, EPSILON_FX, 0, &tot_ener_e ); - dmx_ener_fx = BASOP_Util_Add_Mant32Exp( dmx_ener_fx, dmx_ener_e, EPSILON_FX, 0, &dmx_ener_e ); + IF( tot_ener_fx == 0 ) + { + tot_ener_fx = 9223; // 1e-15(EPSILON) in Q63 + tot_ener_e = -32; + move32(); + move16(); + } + IF( dmx_ener_fx == 0 ) + { + dmx_ener_fx = 9223; // 1e-15(EPSILON) in Q63 + dmx_ener_e = -32; + move32(); + move16(); + } + L_tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( tot_ener_fx, dmx_ener_fx, &tmp_e ) ); tmp_e = add( sub( tot_ener_e, dmx_ener_e ), tmp_e ); ener_fac_fx = BASOP_Util_Log10( L_tmp, tmp_e ); // Q25 -- GitLab From ce3ba2950404e5a188c61232a411a48350ed86ed Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 2 Apr 2025 12:40:42 +0530 Subject: [PATCH 308/358] Fix for 3GPP issue 1445: Deviations with MCT between BASOP and float for LTV 5.1 coded with 128kbps - 1 Link #1445 --- lib_enc/amr_wb_enc_fx.c | 2 +- lib_enc/bw_detect_fx.c | 12 +++++++++--- lib_enc/ivas_core_pre_proc_front_fx.c | 2 +- lib_enc/ivas_mdct_core_enc_fx.c | 9 +++++---- lib_enc/pre_proc_fx.c | 2 +- lib_enc/prot_fx_enc.h | 14 +++++++------- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index 6f46e5c12..1580a7818 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -372,7 +372,7 @@ void amr_wb_enc_fx( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect_fx( st, st->input_fx, NULL, NULL, NULL, MONO_FORMAT, 0 ); + bw_detect_fx( st, st->input_fx, NULL, NULL, NULL, MONO_FORMAT, 0, 0 ); /* in AMR_WB IO, limit the maximum band-width to WB */ if ( GT_16( st->bwidth, WB ) ) diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 2e9b2c5db..8a150d514 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -41,12 +41,12 @@ void bw_detect_fx( Encoder_State *st, /* i/o: Encoder State */ const Word16 signal_in[], /* i : input signal */ - Word16 *spectrum, /* i : MDCT spectrum */ + Word16 *spectrum, /* i : MDCT spectrum Q_spec */ const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 mct_on /* i : flag MCT mode */ -) + const Word16 mct_on, /* i : flag MCT mode */ + const Word16 Q_spec ) { Word16 Q_dct; Word16 i, j, k, bw_max, bin_width, n_bins; @@ -312,6 +312,11 @@ void bw_detect_fx( bin_width = i_mult( bin_width, l_frame / BWD_TOTAL_WIDTH ); Copy( spectrum, spect, l_frame ); + if ( st->element_mode != EVS_MONO ) + { + Q_dct = Q_spec; + move16(); + } } /*---------------------------------------------------------------------* * compute energy per spectral bins @@ -903,6 +908,7 @@ void bw_detect_fx( return; } + /*-------------------------------------------------------------------* * set_bw_fx() * diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 34d90a165..bb065ae20 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -870,7 +870,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 input_fx_tmp[480]; Copy_Scale_sig( st->input_fx, input_fx_tmp, shr( input_frame, 1 ), negate( st->q_inp ) ); /*scaling from Q_inp_const to q0*/ - bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0 ); + bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0, 0 ); } IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index e27ec8c11..7c3daebda 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1283,16 +1283,17 @@ void ivas_mdct_core_whitening_enc_fx( FOR( n = 0; n < nSubframes; n++ ) { Word16 spect_fx[L_FRAME48k]; - Word16 q_spectrum, l_frame; + Word16 q_spectrum, lshift, l_frame; /*l_frame = (int16_t)(st->input_Fs / FRAMES_PER_SEC); 1 / FRAMES_PER_SEC = 0.2f */ l_frame = extract_l( Mpy_32_32( st->input_Fs, 42949673 /* 0.2f in Q31 */ ) ); if ( EQ_16( st->core, TCX_10_CORE ) ) { l_frame = shr( l_frame, 1 ); } - q_spectrum = L_norm_arr( st->hTcxEnc->spectrum_fx[n], l_frame ); - Copy_Scale_sig32_16( st->hTcxEnc->spectrum_fx[n], spect_fx, l_frame, q_spectrum ); - bw_detect_fx( st, NULL, spect_fx, NULL, NULL, MC_FORMAT /*just cannot be ISM_FORMAT*/, mct_on ); + lshift = L_norm_arr( st->hTcxEnc->spectrum_fx[n], l_frame ); + Copy_Scale_sig32_16( st->hTcxEnc->spectrum_fx[n], spect_fx, l_frame, lshift ); + q_spectrum = sub( add( sub( Q31, st->hTcxEnc->spectrum_e[n] ), lshift ), 16 ); + bw_detect_fx( st, NULL, spect_fx, NULL, NULL, MC_FORMAT /*just cannot be ISM_FORMAT*/, mct_on, q_spectrum ); test(); if ( EQ_16( nSubframes, NB_DIV ) && n == 0 ) diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index efecb33ed..cbb2cf421 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -298,7 +298,7 @@ void pre_proc_fx( move16(); } - bw_detect_fx( st, signal_in, NULL, enerBuffer, sf_energySum, MONO_FORMAT, 0 ); + bw_detect_fx( st, signal_in, NULL, enerBuffer, sf_energySum, MONO_FORMAT, 0, 0 ); /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 3f7f17fe7..e54d3025e 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -138,13 +138,13 @@ void AVQ_encmux_ivas_fx( void bw_detect_fx( Encoder_State *st, /* i/o: Encoder State */ - const Word16 signal_in[], /* i : i signal */ - Word16 *spectrum, /* i : MDCT spectrum */ - const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ - const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 mct_on /* i : flag MCT mode */ -); + const Word16 signal_in[], /* i : input signal */ + Word16 *spectrum, /* i : MDCT spectrum Q_spec */ + const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ + const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 mct_on, /* i : flag MCT mode */ + const Word16 Q_spec ); void core_switching_post_enc_fx( /*done */ Encoder_State *st_fx, /* i/o: encoder state structure */ -- GitLab From 06cf345ccfca15132baf2627711176985a9ae4d9 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 2 Apr 2025 15:19:07 +0530 Subject: [PATCH 309/358] ASAN error fix for encoder --- lib_enc/ivas_sce_enc_fx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 41127a98e..a578a3cfa 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -612,10 +612,6 @@ ivas_error create_evs_sce_enc_fx( /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ - IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); - } /* set pointer to the buffer of indices */ st_fx->hBstr->ind_list = st_ivas->ind_list; -- GitLab From 550e40e73f33098653222bfa5365edb218b01024 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 2 Apr 2025 15:21:55 +0530 Subject: [PATCH 310/358] Fix for 3GPP issue 1387: Stereo Encoder 32 kbps: Rattling artifcats in 16 kHz LTVs Link #1387 --- lib_enc/ivas_core_pre_proc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index ca53a227a..781d290ac 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -827,8 +827,8 @@ ivas_error ivas_compute_core_buffers_fx( /* no resampling needed, only delay adjustment to account for the FIR resampling delay */ delay = NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); - Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - sub( lMemRecalc, add( delay, L_FILT16k ) ), delay ); /* Q(-1) */ - Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - add( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ + Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - add( lMemRecalc, sub( delay, L_FILT16k ) ), delay ); /* Q(-1) */ + Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - sub( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ Copy( signal_in_fx + sub( sub( input_frame, lMemRecalc ), shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* st->q_inp */ } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) -- GitLab From 8ae4cf5c285cd81d4e6ae1f22cb927d710c33ccf Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 15:05:24 +0530 Subject: [PATCH 311/358] Fix for 3GPP issue 1396: Stereo Encoder: BWE artefact at 48 kbps LTV Link #1396 --- lib_enc/ext_sig_ana_fx.c | 2 + lib_enc/ivas_mdct_core_enc_fx.c | 70 ++++++++++++++------------ lib_enc/ivas_stereo_mdct_core_enc_fx.c | 15 +++--- lib_enc/stat_enc.h | 1 + 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 087d892e3..53c8d080b 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -1385,6 +1385,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); } } + st->hTcxEnc->spectrum_length = L_subframe; + move16(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index f7da231a3..29ae0518c 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1251,6 +1251,8 @@ void ivas_mdct_core_whitening_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; + st->hTcxEnc->spectrum_length = st->hTcxEnc->L_frameTCX; + move16(); IF( GE_16( add( imult1616( hCPE->cpe_id, CPE_CHANNELS ), ch ), nChannels ) ) { CONTINUE; @@ -1266,6 +1268,8 @@ void ivas_mdct_core_whitening_enc_fx( core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] ); + st->hTcxEnc->spectrum_length = s_max( st->hTcxEnc->spectrum_length, st->hTcxEnc->L_frameTCX ); + move16(); /* BWD in MDCT domain */ IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { @@ -1373,16 +1377,16 @@ void ivas_mdct_core_whitening_enc_fx( q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com const Word16 switchKernel = /* these 4 transform types can be applied: 0 = MDCT-IV, 1 = MDST-II, 2 = MDCT-II, 3 = MDST-IV */ kernel_switch_detect_fx( hTcxEnc0->spectrum_fx[n], hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[0][n], mdst_spectrum_fx[1][n], q_com, nSampCore / nSubframes, @@ -1470,11 +1474,11 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[0][n], hTcxEnc0->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc0->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /*hTcxEnc0->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[0][n] ) ) ); // q_com speech = NULL; if ( NE_16( n, 1 ) ) @@ -1491,11 +1495,11 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[1][n], hTcxEnc1->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ), L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc1->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /*hTcxEnc1->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[1][n] ) ) ); // q_com speech = NULL; if ( NE_16( n, 1 ) ) @@ -1532,7 +1536,7 @@ void ivas_mdct_core_whitening_enc_fx( move16(); /* length = max(nSampCore / (2 * NB_DIV), L_subframeTCX / (2 * NB_DIV), NB_DIV = 2 */ length = shr( s_max( nSampCore, L_subframeTCX ), 2 ); - len_sbfr = shr( hTcxEnc0->L_frameTCX, shift ); + len_sbfr = shr( hTcxEnc0->spectrum_length, shift ); assert( hTcxEnc0->L_frameTCX == hTcxEnc1->L_frameTCX ); exp_max = s_max( hTcxEnc0->spectrum_e[n], hTcxEnc1->spectrum_e[n] ); exp_max = s_max( exp_max, mdst_spectrum_e[0][n] ); @@ -1624,22 +1628,22 @@ void ivas_mdct_core_whitening_enc_fx( { Word16 length; length = shr( s_max( nSampCore, L_subframeTCX ), shift ); // max(/* nSampCore/nSubframes, L_subframeTCX/nSubframes) */ - Word16 offset2 = sub( shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, length ); + Word16 offset2 = sub( shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, length ); exp_max = s_max( hTcxEnc0->spectrum_e[n], hTcxEnc1->spectrum_e[n] ); exp_max = s_max( exp_max, mdst_spectrum_e[0][n] ); exp_max = s_max( exp_max, mdst_spectrum_e[1][n] ); - exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); - exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); - exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */ ) ); + exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */ ) ); q_com = sub( s_min( Q31, add( sub( Q31, exp_max ), exp_com ) ), 6 ); exp_com = sub( Q31, q_com ); - Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e - Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e - Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) ); // mdst_spectrum_e - Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) ); // mdst_spectrum_e + Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e + Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e + Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->spectrum_length, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) ); // mdst_spectrum_e + Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->spectrum_length, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) ); // mdst_spectrum_e Word16 q_com_orig = q_com; move16(); @@ -1724,12 +1728,12 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( mdst_spectrum_e[ch][n], hTcxEncCh->spectrum_e[n] ); q_min = sub( Q31, q_min ); - q_com = s_min( L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ), L_norm_arr( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/ ) ); q_com = s_min( Q31, add( q_min, q_com ) ); - Scale_sig32( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEncCh->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->L_frameTCX, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com + Scale_sig32( hTcxEncCh->spectrum_fx[n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEncCh->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEncCh->spectrum_length, shift ) /*hTcxEncCh->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com speech = hTcxEncCh->speech_TCX; if ( n != 0 ) @@ -1769,7 +1773,7 @@ void ivas_mdct_core_whitening_enc_fx( FOR( n = 0; n < nSubframes; n++ ) { q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -1791,7 +1795,7 @@ void ivas_mdct_core_whitening_enc_fx( } FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( Q31, q_com ); move16(); } @@ -1825,8 +1829,8 @@ void ivas_mdct_core_whitening_enc_fx( q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); q_min = s_max( q_min, mdst_spectrum_e[ch][n] ); - q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( mdst_spectrum_fx[ch][n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -1849,8 +1853,8 @@ void ivas_mdct_core_whitening_enc_fx( } FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com - Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( mdst_spectrum_fx[ch][n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( Q31, mdst_spectrum_e[ch][n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( Q31, q_com ); move16(); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); @@ -2137,7 +2141,7 @@ void ivas_mdct_core_whitening_enc_fx( { q_min = s_max( q_min, hTcxEnc->spectrum_e[n] ); - q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); + q_com = s_min( q_com, L_norm_arr( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/ ) ); } } q_min = sub( Q31, q_min ); @@ -2161,7 +2165,7 @@ void ivas_mdct_core_whitening_enc_fx( FOR( n = 0; n < nSubframes; n++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->L_frameTCX, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( 31, hTcxEnc->spectrum_e[n] ) ) ); // q_com + Scale_sig32( hTcxEnc->spectrum_fx[n], shr( hTcxEnc->spectrum_length, shift ) /*hTcxEnc->L_frameTCX / nSubframes*/, sub( q_com, sub( 31, hTcxEnc->spectrum_e[n] ) ) ); // q_com hTcxEnc->spectrum_e[n] = sub( 31, q_com ); move16(); } diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 3becb30d9..b32e8a561 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -363,11 +363,11 @@ void stereo_mdct_core_enc_fx( move16(); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - length = sts[ch]->hTcxEnc->L_frameTCX; + length = sts[ch]->hTcxEnc->spectrum_length; move16(); - if ( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { - length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + length = shr( length, 1 ); } hdrm_min = s_min( hdrm_min, L_norm_arr( sts[ch]->hTcxEnc->spectrum_fx[0], length ) ); @@ -384,15 +384,12 @@ void stereo_mdct_core_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - Word16 n_sb = NB_DIV; + length = sts[ch]->hTcxEnc->spectrum_length; move16(); - if ( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { - n_sb = 1; - move16(); + length = shr( length, 1 ); } - length = idiv1616( sts[ch]->hTcxEnc->L_frameTCX, n_sb ); /* Q0 */ - FOR( k = 0; k <= ( ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV ) - 1; k++ ) { Scale_sig32( sts[ch]->hTcxEnc->spectrum_fx[k], length, sub( q_spec, sub( Q31, sts[ch]->hTcxEnc->spectrum_e[k] ) ) ); /* q_spec */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 5305a8bdc..3977c4054 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1211,6 +1211,7 @@ typedef struct tcx_enc_structure Word32 spectrum_long_fx[N_MAX]; /* MDCT output for a long block. Points to spectrum */ Word16 spectrum_long_e; /* MDCT output for a long block. Points to spectrum */ Word16 q_spectrum_long_fx; + Word16 spectrum_length; } TCX_ENC_DATA, *TCX_ENC_HANDLE; typedef struct TransientDetection -- GitLab From a516ef9925aa0f334727cf8a04617858cb5243b3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 2 Apr 2025 01:15:47 +0200 Subject: [PATCH 312/358] simplify initial patch --- lib_enc/ext_sig_ana_fx.c | 2 -- lib_enc/ivas_mdct_core_enc_fx.c | 7 +++---- lib_enc/stat_enc.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 53c8d080b..087d892e3 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -1385,8 +1385,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( ProcessIGF_ivas_fx( st, N_MAX + L_MDCT_OVLP_MAX, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_fx[frameno], &q_spectrum, powerSpec, powerSpec_e, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); } } - st->hTcxEnc->spectrum_length = L_subframe; - move16(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 29ae0518c..e27ec8c11 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1251,8 +1251,9 @@ void ivas_mdct_core_whitening_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - st->hTcxEnc->spectrum_length = st->hTcxEnc->L_frameTCX; - move16(); + init_tcx_enc_info_fx( st, &L_subframe, &L_subframeTCX, &tcx_subframe_coded_lines ); + st->hTcxEnc->spectrum_length = L_subframeTCX; + IF( GE_16( add( imult1616( hCPE->cpe_id, CPE_CHANNELS ), ch ), nChannels ) ) { CONTINUE; @@ -1268,8 +1269,6 @@ void ivas_mdct_core_whitening_enc_fx( core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] ); - st->hTcxEnc->spectrum_length = s_max( st->hTcxEnc->spectrum_length, st->hTcxEnc->L_frameTCX ); - move16(); /* BWD in MDCT domain */ IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 3977c4054..c6176709b 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1211,7 +1211,7 @@ typedef struct tcx_enc_structure Word32 spectrum_long_fx[N_MAX]; /* MDCT output for a long block. Points to spectrum */ Word16 spectrum_long_e; /* MDCT output for a long block. Points to spectrum */ Word16 q_spectrum_long_fx; - Word16 spectrum_length; + Word16 spectrum_length; /* corresponds to L_frameTCX, used for scaling of MDCT/MDST buffers */ } TCX_ENC_DATA, *TCX_ENC_HANDLE; typedef struct TransientDetection -- GitLab From 739f19588bfee76c0e2d318b83da92ed3f4e325b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 12:43:47 +0530 Subject: [PATCH 313/358] Fix for 3GPP issue 1407: BASOP encoder: Distortion Stereo DTX 24.4 kbps, high MLD Link #1407 --- lib_enc/ivas_cpe_enc_fx.c | 53 ++++++++++++++--------------- lib_enc/ivas_stereo_dft_enc_fx.c | 17 +++------ lib_enc/ivas_stereo_dft_td_itd_fx.c | 36 ++++++++++++++------ 3 files changed, 55 insertions(+), 51 deletions(-) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 4e7706baf..be0afc1a4 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -127,6 +127,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new + Word16 q_com; error = IVAS_ERR_OK; move32(); @@ -649,35 +650,31 @@ ivas_error ivas_cpe_enc_fx( hCPE->hStereoDft->Spd_R_smooth_fx_e = sub( hCPE->hStereoDft->Spd_R_smooth_fx_e, temp ); move16(); - shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); - Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ - sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[1]->input_fx, input_frame ); - Copy_Scale_sig_32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, sub( add( sts[1]->q_inp, shift ), sts[1]->q_inp32 ) ); /* sts[1]->q_inp + shift */ - sts[1]->q_inp = add( sts[1]->q_inp, shift ); - move16(); - Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[1]->q_inp, sts[1]->q_old_inp ), sts[1]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ - Scale_sig( sts[1]->old_input_signal_fx, input_frame, sub( s_min( sts[1]->q_old_inp, sts[1]->q_inp ), sts[1]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ - sts[1]->q_inp = s_min( sts[1]->q_inp, sts[1]->q_old_inp ); - move16(); - sts[1]->q_old_inp = sts[1]->q_inp; - move16(); - shift = getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ); - Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[0]->q_old_inp + shift */ - sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); - move16(); - shift = getScaleFactor16( sts[0]->input_fx, input_frame ); - Copy_Scale_sig_32_16( sts[0]->input32_fx, sts[0]->input_fx, input_frame, sub( add( sts[0]->q_inp, shift ), sts[0]->q_inp32 ) ); /* sts[0]->q_inp + shift */ - sts[0]->q_inp = add( sts[0]->q_inp, shift ); - move16(); - Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), sts[0]->q_inp ) ); /* min( sts[1]->q_inp, sts[1]->q_old_inp) */ - Scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( s_min( sts[0]->q_old_inp, sts[0]->q_inp ), sts[0]->q_old_inp ) ); /* min( sts[1]->q_old_inp, sts[1]->q_inp) */ - sts[0]->q_inp = s_min( sts[0]->q_inp, sts[0]->q_old_inp ); - move16(); - sts[0]->q_old_inp = sts[0]->q_inp; - move16(); + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + q_com = sub( add( L_norm_arr( sts[n]->input32_fx, input_frame ), sts[n]->q_inp32 ), 16 ); + q_com = s_min( q_com, add( norm_arr( sts[n]->old_input_signal_fx, input_frame ), sts[n]->q_old_inp ) ); + q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl ), hCPE->q_input_mem[n] ) ); + + if ( EQ_16( q_com, Q15 ) ) + { + q_com = 0; + move16(); + } + + Copy_Scale_sig_32_16( sts[n]->input32_fx, sts[n]->input_fx, input_frame, sub( q_com, sts[n]->q_inp32 ) ); + sts[n]->q_inp = q_com; + move16(); + + scale_sig( sts[n]->old_input_signal_fx, input_frame, sub( q_com, sts[n]->q_old_inp ) ); + sts[n]->q_old_inp = q_com; + move16(); + + scale_sig( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); + hCPE->q_input_mem[n] = q_com; + move16(); + } stereo_dft_hybrid_ITD_flag_fx( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index cebbc2619..01318af28 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -1064,23 +1064,14 @@ void stereo_dft_enc_analyze_fx( Word16 q_shift, guarded_bits; guarded_bits = find_guarded_bits_fx( NFFT ); - q_shift = sub( getScaleFactor32( pDFT_L, NFFT ), guarded_bits ); - q_shift = s_min( q_shift, sub( getScaleFactor32( pDFT_R, NFFT ), guarded_bits ) ); - FOR( Word16 j = 0; j < NFFT; j++ ) - { - pDFT_L[j] = L_shl( pDFT_L[j], q_shift ); - move32(); - } + q_shift = sub( L_norm_arr( pDFT_L, NFFT ), guarded_bits ); + scale_sig32( pDFT_L, NFFT, q_shift ); DFT_e[0] = sub( DFT_e[0], q_shift ); move16(); - FOR( Word16 j = 0; j < NFFT; j++ ) - { - pDFT_R[j] = L_shl( pDFT_R[j], q_shift ); - move32(); - } - + q_shift = sub( L_norm_arr( pDFT_R, NFFT ), guarded_bits ); + scale_sig32( pDFT_R, NFFT, q_shift ); DFT_e[1] = sub( DFT_e[1], q_shift ); move16(); diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index df4fe3edd..569a5690a 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -380,15 +380,6 @@ void stereo_td_itd_fx( move16(); set16_fx( shift_input, 0, input_frame ); - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - - Scale_sig( &input_mem[n][0], dft_ovl, sts[n]->q_inp - q_input_mem[n] ); // Q(sts[n]->q_inp) - // Scale_sig(&sts[n]->old_input_signal_fx, 1965, sts[n]->q_inp - sts[n]->q_old_inp); - // sts[n]->q_old_inp = sts[n]->q_inp; - q_input_mem[n] = sts[n]->q_inp; - move16(); - } IF( EQ_16( sts[0]->element_mode, IVAS_CPE_MDCT ) ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) @@ -540,7 +531,7 @@ void stereo_td_itd_mdct_stereo_fx( const Word16 input_frame /* i : frame length */ ) { - Word16 i; + Word16 i, n, q_com; Word32 bin_nrgL_fx[STEREO_DFT_N_32k_ENC]; Word16 bin_nrgL_e[STEREO_DFT_N_32k_ENC]; Word32 bin_nrgR_fx[STEREO_DFT_N_32k_ENC]; @@ -584,6 +575,31 @@ void stereo_td_itd_mdct_stereo_fx( /*call ITD function*/ stereo_dft_enc_compute_itd_fx( hCPE, DFT_fx[0], DFT_tmp_e[0], DFT_fx[1], DFT_tmp_e[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL_fx, bin_nrgL_e, bin_nrgR_fx, bin_nrgR_e ); + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + q_com = add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ); + q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame ), hCPE->hCoreCoder[n]->q_old_inp ) ); + q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl ), hCPE->q_input_mem[n] ) ); + + if ( EQ_16( q_com, Q15 ) ) + { + q_com = 0; + move16(); + } + + scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_inp ) ); + hCPE->hCoreCoder[n]->q_inp = q_com; + move16(); + + scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_old_inp ) ); + hCPE->hCoreCoder[n]->q_old_inp = q_com; + move16(); + + scale_sig( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); + hCPE->q_input_mem[n] = q_com; + move16(); + } + /* Time Domain ITD compensation using extrapolation */ stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem ); } -- GitLab From 6e176c0e7eb7c2d86c5341a3d10bd27fd3ad4eb5 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 3 Apr 2025 16:38:47 +0200 Subject: [PATCH 314/358] Remover inactive FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK switch and code --- lib_dec/ivas_dirac_dec_fx.c | 51 ------------------------------------- 1 file changed, 51 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index ec1dbd290..c2ef3b92e 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2789,48 +2789,6 @@ void ivas_dirac_dec_render_sf_fx( q_input ); } q_input = add( Q11, q_input ); -#endif -#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK - Word16 cldfb_last_band = 0; - move16(); - { - Word32 sr; - Word16 el; - FOR( el = 0; el < st_ivas->nSCE; el++ ) - { - test(); - test(); - IF( st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) - { - cldfb_last_band = s_max( cldfb_last_band, st_ivas->hSCE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); - sr = st_ivas->hSCE[el]->hCoreCoder[0]->output_Fs; - } - } - FOR( el = 0; el < st_ivas->nCPE; el++ ) - { - test(); - test(); - IF( st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->isIGFActive ) - { - cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[0]->hIGFDec->infoIGFStopFreq ); - sr = st_ivas->hCPE[el]->hCoreCoder[0]->output_Fs; - } - test(); - test(); - IF( st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec != NULL && st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->isIGFActive ) - { - cldfb_last_band = s_max( cldfb_last_band, st_ivas->hCPE[el]->hCoreCoder[1]->hIGFDec->infoIGFStopFreq ); - } - } - IF( EQ_16( cldfb_last_band, 0 ) ) - { - cldfb_last_band = hSpatParamRendCom->num_freq_bands; - } - ELSE - { - cldfb_last_band = mult_r( div_s( shr( cldfb_last_band, 2 ), extract_l( L_shr( sr, 3 ) ) ), hSpatParamRendCom->num_freq_bands ); - } - } #endif FOR( ch = 0; ch < nchan_transport; ch++ ) { @@ -2850,15 +2808,6 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); -#endif -#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB_MASK - FOR( i = cldfb_last_band; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - Cldfb_RealBuffer_fx[ch][0][i] = 0; - Cldfb_ImagBuffer_fx[ch][0][i] = 0; - move32(); - move32(); - } #endif } q_cldfb = q_temp_cldfb; -- GitLab From a5fab6fc610c7b8d489498cce3cf8d3e50d2ae41 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Apr 2025 09:03:05 +0530 Subject: [PATCH 315/358] Precision improvements in mdct core enc --- lib_com/ivas_spar_com_fx.c | 181 ++++++++++--------------- lib_enc/ext_sig_ana_fx.c | 105 ++++++++------ lib_enc/ivas_mdct_core_enc_fx.c | 53 ++++---- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 14 +- lib_enc/prot_fx_enc.h | 3 +- lib_enc/tcx_utils_enc_fx.c | 6 +- 6 files changed, 176 insertions(+), 186 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 317ea0249..0da6b90c2 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -51,24 +51,16 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define IVAS_FLT_EPS ( 1e-10F ) -#define IVAS_FIX_EPS ( 1 ) -#define IVAS_DBL_EPS ( (double) 1e-20 ) +#define IVAS_FIX_EPS ( 1 ) +#define IVAS_FIX_EPS_Q40 ( 110 ) -#define IVAS_REMIX_MULT_FAC ( 0.5f ) -#define IVAS_ACTIVEW_DM_F ( 1.0f ) #define IVAS_ACTIVEW_DM_F_Q30 ( ONE_IN_Q30 ) /*1 Q30*/ -#define IVAS_ACTIVEW_DM_F_DTX ( 0.25f ) -#define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ -#define IVAS_ACTIVEW_DM_F_VLBR ( 0.25f ) -#define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ -#define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH ( 3.0f ) +#define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ +#define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH_Q29 ( 1610612736 ) /*3 Q29*/ -#define IVAS_P_NORM_SCALING ( 1.0f ) #define IVAS_P_NORM_SCALING_FX ( ONE_IN_Q31 ) // 1 Q31 -#define IVAS_P_NORM_SCALING_DTX ( 0.75f ) #define IVAS_P_NORM_SCALING_DTX_FX ( 1610612736 ) // 0.75 Q31 #define IVAS_MAT_DIM_3 ( 3 ) @@ -1626,8 +1618,18 @@ static void ivas_get_Wscaling_factor_enc_fx( ivas_calc_post_pred_per_band_enc_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, b, postpred_cov_re, &q_postpred_cov_re ); } - Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], L_max( postpred_cov_re[0][0], IVAS_FIX_EPS ), &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) - q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); + tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_postpred_cov_re, 40 ) ); + + IF( LE_32( postpred_cov_re[0][0], tmp ) ) + { + Gw_sq = Mpy_32_32( cov_real[0][0][b], 1250000000 ); /*1/1e-10 = 1250000000 Q(-4)*/ + q_Gw_sq = add( q_cov_real[0][0][b], -4 - 31 ); + } + ELSE + { + Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], postpred_cov_re[0][0], &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) + q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); + } shift = MAX16B; move16(); @@ -1992,12 +1994,15 @@ static void ivas_calc_post_pred_per_band_enc_fx( Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], /*q_postpred_cov_re*/ Word16 *q_postpred_cov_re ) { - Word16 i, j, k, guard_bits, tmp, q_temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], q_tmp_re, q_W_tmp; + Word16 i, j, k; Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - Word32 max_val; - Word64 tmp_re, W_tmp; - Word16 q_postpred_cov_re_per_value[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 min_val; + Word32 tmp_re; + Word16 tmp_q; + Word16 tmp_e; FOR( i = 0; i < num_ch; i++ ) { @@ -2014,135 +2019,71 @@ static void ivas_calc_post_pred_per_band_enc_fx( set32_fx( postpred_cov_re[i], 0, num_ch ); } - max_val = 1; - move32(); + min_val = MAX16B; + move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { - tmp_re = 0; - move64(); - q_tmp_re = 31; + temp_mat[i][j] = 0; + move32(); + temp_mat_e[i][j] = 0; move16(); FOR( k = 0; k < num_ch; k++ ) { - W_tmp = W_shr( W_mult0_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ), q_mixer_mat ); /*q_cov_real[i][k][band_idx]*/ - IF( LT_16( q_cov_real[i][k][band_idx], q_tmp_re ) ) - { - tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_cov_real[i][k][band_idx] ) ), W_tmp ); /*q_cov_real[i][k][band_idx]*/ - q_tmp_re = q_cov_real[i][k][band_idx]; - move16(); - } - ELSE + tmp_re = 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 ) { - tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_cov_real[i][k][band_idx], q_tmp_re ) ) ); /*q_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(); } } - IF( tmp_re == 0 ) - { - q_temp_mat[i][j] = 31; - move16(); - temp_mat[i][j] = 0; - move32(); - } - ELSE - { - q_temp_mat[i][j] = q_tmp_re; - move16(); - q_tmp_re = W_norm( tmp_re ); - temp_mat[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /*q_temp_mat[i][j]+ q_tmp_re -32*/ - move32(); - q_temp_mat[i][j] = sub( add( q_temp_mat[i][j], q_tmp_re ), 32 ); - move16(); - } - max_val = L_max( max_val, L_abs( temp_mat[i][j] ) ); } } - guard_bits = find_guarded_bits_fx( num_ch ); - - tmp = norm_l( max_val ); - IF( LT_16( tmp, guard_bits ) ) - { - guard_bits = sub( guard_bits, tmp ); - } - ELSE - { - guard_bits = 0; - move16(); - } - - *q_postpred_cov_re = 31; - move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { - tmp_re = 0; - move64(); - q_tmp_re = 31; + q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re; move16(); FOR( k = 0; k < num_ch; k++ ) { - W_tmp = W_shr( W_mult0_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ), guard_bits ); // q_temp_mat[k][j]+ q_mixer_mat-guard_bits - q_W_tmp = sub( add( q_temp_mat[k][j], q_mixer_mat ), guard_bits ); - IF( LT_16( q_W_tmp, q_tmp_re ) ) + tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ); + tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] ); + IF( tmp_re ) { - tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_W_tmp ) ), W_tmp ); // q_W_tmp - q_tmp_re = q_W_tmp; + tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] ); + postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e ); + move32(); + q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e ); move16(); } - ELSE - { - tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_W_tmp, q_tmp_re ) ) ); // q_tmp_re - } } - - if ( LT_64( W_abs( tmp_re ), L_shl( IVAS_FIX_EPS, guard_bits ) ) ) + IF( postpred_cov_re[i][j] ) { - tmp_re = 0; - move64(); - } - - q_postpred_cov_re_per_value[i][j] = q_tmp_re; - move16(); - IF( tmp_re == 0 ) - { - postpred_cov_re[i][j] = W_extract_l( tmp_re ); /* q_tmp_re*/ - move32(); - } - ELSE - { - q_tmp_re = W_norm( tmp_re ); - postpred_cov_re[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /* q_tmp_re+ q_postpred_cov_re_per_value[i][j] -32*/ - move32(); - q_postpred_cov_re_per_value[i][j] = sub( add( q_tmp_re, q_postpred_cov_re_per_value[i][j] ), 32 ); - move16(); + min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] ); } - *q_postpred_cov_re = s_min( *q_postpred_cov_re, q_postpred_cov_re_per_value[i][j] ); - move16(); } } + /*Changing Q of postpred_cov_re to min_val*/ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { - IF( postpred_cov_re[i][j] >= 0 ) - { - postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ); //*q_postpred_cov_re - move32(); - } - ELSE + IF( postpred_cov_re[i][j] ) { - postpred_cov_re[i][j] = L_negate( L_shr( L_negate( postpred_cov_re[i][j] ), sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ) ); //*q_postpred_cov_re + postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) ); move32(); } } } + FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < i; j++ ) @@ -2152,6 +2093,14 @@ static void ivas_calc_post_pred_per_band_enc_fx( } } + if ( EQ_16( min_val, MAX16B ) ) + { + min_val = Q31; + move16(); + } + *q_postpred_cov_re = min_val; + move16(); + return; } @@ -2687,7 +2636,8 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( trace = W_add( trace, W_deposit32_l( L_abs( cov_uu_re[i - num_dmx][i - num_dmx] ) ) ); // q_cov_uu_re } - factor = L_max( IVAS_FIX_EPS, postpred_cov_re[0][0] ); // q_postpred_cov_re + factor = postpred_cov_re[0][0]; // q_postpred_cov_re + move32(); q_factor = q_postpred_cov_re; move16(); IF( trace != 0 ) @@ -2708,10 +2658,20 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( factor = L_max( factor, tmp ); // q_factor } + tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_factor, 40 ) ); + Word16 factor_exp = 0; move16(); - factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) - factor_exp = add( factor_exp, q_factor ); + IF( LE_32( factor, tmp ) ) + { + factor = 1250000000; + factor_exp = Q31 - ( -4 ); + } + ELSE + { + factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) + factor_exp = add( factor_exp, q_factor ); + } /* normalise Hermitian (except for rounding) cov_uu */ FOR( i = num_dmx; i < num_ch; i++ ) @@ -3311,6 +3271,9 @@ void ivas_calc_c_p_coeffs_enc_fx( Word16 i, j, q_postpred_cov_re; Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + q_postpred_cov_re = 0; + move16(); + FOR( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { set_zero_fx( postpred_cov_re[i], IVAS_SPAR_MAX_CH ); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 087d892e3..6414a81b6 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -675,6 +675,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 alw_voicing[2], alw_voicing_wc = -1; Word16 disable_ltp = 0; Word16 tmp, *tmpP16; + Word16 q_mdstWin = st->q_inp, q_tcx20Win = st->q_inp; Word32 *tmpP32; Word16 Q_exp; Word32 L_tmpbuf[N_MAX + L_MDCT_OVLP_MAX]; @@ -684,12 +685,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( move16(); move16(); move16(); + move16(); + move16(); (void) vad_hover_flag; Word16 Q_win_temp[2]; Word16 *speech_ltp_fx = NULL; Word16 *wspeech_fx = NULL; Word16 *speech_fx = NULL; - Word16 q_out_wtda = 0; + Word16 q_out_wtda = st->q_inp; move16(); Word16 win_len[2]; move16(); @@ -961,7 +964,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( move32(); windowed_samples[frameno * L_FRAME_MAX + 1] = L_deposit_l( overlap_mode[frameno + 1] ); // Q0 move32(); - Copy_Scale_sig_16_32_DEPREC( tcx20Win, windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), 0 ); + Copy_Scale_sig_16_32_DEPREC( tcx20Win, windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), negate( q_tcx20Win ) ); *q_win = s_min( *q_win, sub( L_norm_arr( windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ) ), 1 ) ); move16(); Q_win_temp[frameno] = *q_win; @@ -983,7 +986,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outter left folding */ FOR( i = 0; i < folding_offset; i++ ) { - tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // Q0 + tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win move16(); } @@ -996,18 +999,18 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } } @@ -1016,7 +1019,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = shr( right_overlap, 1 ); FOR( i = 0; i < tmp; i++ ) { - tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // Q0 + tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win move16(); } @@ -1027,6 +1030,12 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmpP16 = tcx20Win; tmpP32 = hTcxEnc->spectrum_fx[frameno]; assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); + Word16 len[2], exp[2]; + hTcxEnc->spectrum_e[frameno] = 16; + exp[0] = exp[1] = hTcxEnc->spectrum_e[frameno]; + move16(); + move16(); + move16(); FOR( i = 0; i < 2; i++ ) { test(); @@ -1037,17 +1046,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( mac_r( 2 << 16, -( 3 << 8 ), shl( i, 7 ) ), /* equivalent to: sub(i, 1) == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP */ &left_overlap, &right_overlap, tmpP16, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 ); - hTcxEnc->spectrum_e[frameno] = 16; - move16(); TCX_MDCT( tcx5Win, tmpP32, - &hTcxEnc->spectrum_e[frameno], + &exp[i], left_overlap, sub( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); tmpP16 += tcx5SizeFB; tmpP32 += tcx5SizeFB; + len[i] = L_subframe; + move16(); /* high-band gain control in case of BWS */ IF( st->bwidth_sw_cnt > 0 ) @@ -1064,6 +1073,16 @@ void core_signal_analysis_high_bitrate_ivas_fx( L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); } } + hTcxEnc->spectrum_e[frameno] = s_max( exp[0], exp[1] ); + move16(); + + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( hTcxEnc->spectrum_fx[frameno] + i * L_subframe, len[i], sub( exp[i], hTcxEnc->spectrum_e[frameno] ) ); + } + + hTcxEnc->spectrum_e[frameno] = sub( hTcxEnc->spectrum_e[frameno], q_tcx20Win ); + move16(); } ELSE /* transform_type[frameno] != TCX_5 */ { @@ -1105,23 +1124,25 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } } TCX_MDCT( tcx20Win, hTcxEnc->spectrum_fx[frameno], &hTcxEnc->spectrum_e[frameno], left_overlap, sub( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); + hTcxEnc->spectrum_e[frameno] = sub( hTcxEnc->spectrum_e[frameno], q_tcx20Win ); + move16(); } /* high-band gain control in case of BWS */ @@ -1147,23 +1168,27 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( EQ_16( hTcxEnc->tcxMode, TCX_20 ) && ( ( LT_32( st->total_brate, HQ_96k ) ) || st->igf ) ) { pMdstWin = tcx20Win; + Word16 q_pmdstWin = q_tcx20Win; + move16(); test(); if ( ( ( EQ_16( hTcxEnc->tcxMode, TCX_20 ) ) && ( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) ) ) { pMdstWin = mdstWin; + q_pmdstWin = q_mdstWin; + move16(); } /* Compute noise-measure flags for spectrum filling and quantization */ AnalyzePowerSpectrum_ivas_fx( st, div_l( L_mult( L_subframe, st->L_frame ), hTcxEnc->L_frameTCX ), L_subframe, left_overlap, right_overlap, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_e[frameno], - pMdstWin, powerSpec, powerSpec_e ); + pMdstWin, q_pmdstWin, powerSpec, powerSpec_e ); } } } IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { - Word16 q_mdstWin, scale; + Word16 scale; L_subframe = idiv1616( L_frameTCX, nSubframes ); /* Q0 */ test(); @@ -1173,8 +1198,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( scale = sub( norm_arr( mdstWin, L_frameTCX ), 1 ); scale = s_min( 1, scale ); // restricting the Q to zero or less scale_sig( mdstWin, L_frameTCX, scale ); - q_mdstWin = add( -1, scale ); - move16(); + q_mdstWin = add( add( st->q_inp, -1 ), scale ); } ELSE { @@ -1185,8 +1209,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( scale = sub( norm_arr( mdstWin, sig_len ), 1 ); scale = s_min( 0, scale ); // restricting the Q to zero or less scale_sig( mdstWin, sig_len, scale ); - q_mdstWin = scale; - move16(); + q_mdstWin = add( scale, st->q_inp ); } IF( EQ_16( transform_type[frameno], TCX_5 ) ) @@ -1205,17 +1228,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } @@ -1292,17 +1315,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 7c3daebda..d0a91a098 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -370,15 +370,16 @@ static void kernel_switch_trafo_fx( static void kernel_switch_update_transforms_fx( - Word32 *sigR, /* i/o: MDCT samples of the given channel (*q_sig) */ - Word32 *sigI, /* i/o: MDST samples of the given channel (*q_sig) */ - Word16 *q_sig, /* i/o: Common Q of MDCT and MDST samples of the given channel */ - const Word16 tcxTransType, /* i : TCX transform type, cf also above */ - TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration handle, pointer */ - const Word16 bwidthSwCnt, /* i : bandwidth switching counter in st */ - const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ - Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ - const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ + Word32 *sigR, /* i/o: MDCT samples of the given channel (*q_sig) */ + Word32 *sigI, /* i/o: MDST samples of the given channel (*q_sig) */ + Word16 *q_sig, /* i/o: Common Q of MDCT and MDST samples of the given channel */ + const Word16 tcxTransType, /* i : TCX transform type, cf also above */ + TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration handle, pointer */ + const Word16 bwidthSwCnt, /* i : bandwidth switching counter in st */ + const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ + Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ + const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ + const Word16 q_speech, Word32 *windowedTimeSignal, /* i/o: windowed input and scratch buffer (*q_windowedTimeSignal) */ Word16 *q_windowedTimeSignal, /* i/o: Q of windowed input and scratch buffer */ const Word16 L_subframe /* i : transform length (number of bins) */ @@ -429,9 +430,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( -Q1, q_speech ) ); // q_speech -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( q_speech, -Q1 ) ); // Q-1 -> q_speech Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); @@ -469,17 +470,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -488,17 +489,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -1486,7 +1487,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc0->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc0->spectrum_fx[n], mdst_spectrum_fx[0][n], &q_com, hTcxEnc0->transform_type[n], sts[0]->hTcxCfg, sts[0]->bwidth_sw_cnt, hTcxEnc0->kernel_type[n], - hTcxEnc0->new_speech_TCX, speech, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEnc0->new_speech_TCX, speech, sts[0]->q_inp, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[0][n] = sub( Q31, q_com ); hTcxEnc0->spectrum_e[n] = sub( Q31, q_com ); move16(); @@ -1507,7 +1508,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc1->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[1][n], &q_com, hTcxEnc1->transform_type[n], sts[1]->hTcxCfg, sts[1]->bwidth_sw_cnt, hTcxEnc1->kernel_type[n], - hTcxEnc1->new_speech_TCX, speech, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEnc1->new_speech_TCX, speech, sts[1]->q_inp, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[1][n] = sub( Q31, q_com ); hTcxEnc1->spectrum_e[n] = sub( Q31, q_com ); move16(); @@ -1741,7 +1742,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = NULL; } kernel_switch_update_transforms_fx( hTcxEncCh->spectrum_fx[n], mdst_spectrum_fx[ch][n], &q_com, hTcxEncCh->transform_type[n], sts[ch]->hTcxCfg, sts[ch]->bwidth_sw_cnt, hTcxEncCh->kernel_type[n], - hTcxEncCh->new_speech_TCX, speech, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEncCh->new_speech_TCX, speech, sts[ch]->q_inp, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); move16(); hTcxEncCh->spectrum_e[n] = sub( Q31, q_com ); diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index b32e8a561..2e365be47 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -250,7 +250,10 @@ void stereo_mdct_core_enc_fx( hCPE->hStereoMdct->stbParamsTCX20.nBandsStereoCore = hCPE->hStereoMdct->stbParamsTCX20.sfbCnt; move16(); } - + Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), + s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); + q_com = s_min( 0, q_com ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; @@ -272,11 +275,11 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); - Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( sts[ch]->q_inp ) ); /* Q0 */ - Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), negate( sts[ch]->q_old_inp ) ); /* Q0 */ - sts[ch]->q_old_inp = 0; + Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* Q0 */ + Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* Q0 */ + sts[ch]->q_old_inp = q_com; move16(); - sts[ch]->q_inp = 0; + sts[ch]->q_inp = q_com; move16(); } @@ -765,7 +768,6 @@ void stereo_mdct_core_enc_fx( * Split available bits between channels *---------------------------------------------------------------*/ - Word16 q_com; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index e54d3025e..64402bf3c 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1278,7 +1278,8 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* i : MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* i : windowed signal corresponding to mdctSpectrum */ - Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ + const Word16 q_signal, + Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ Word16 powerSpec_e[] ); void AdaptLowFreqEmph_fx( Word32 x[], diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 5bea901bb..ad1720665 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -330,7 +330,8 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* input: MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* input: windowed signal corresponding to mdctSpectrum */ - Word32 powerSpec[], /* output: Power spectrum. Can point to signal */ + const Word16 q_signal, + Word32 powerSpec[], /* output: Power spectrum. Can point to signal */ Word16 powerSpec_e[] ) { Word16 i, iStart, iEnd, lowpassLine; @@ -342,8 +343,7 @@ void AnalyzePowerSpectrum_ivas_fx( lowpassLine = L_frameTCX; move16(); - Word16 temp_powerSpec_e = 16; - move16(); + Word16 temp_powerSpec_e = sub( 16, q_signal ); TCX_MDST( signal, powerSpec, &temp_powerSpec_e, left_overlap, sub( L_frameTCX, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); shift = L_norm_arr( powerSpec, N_MAX + L_MDCT_OVLP_MAX ); -- GitLab From 9b493845537e40879b42d81dabddb076d3bbd0e0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 6 Apr 2025 21:00:00 +0200 Subject: [PATCH 316/358] add BASOP_Util_Divide3232_Scale_newton() --- lib_com/basop_util.c | 408 +++++++++++++++++++++++++++++++++++++++++++ lib_com/basop_util.h | 7 + lib_com/options.h | 2 + 3 files changed, 417 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index b7ee35ab3..ec15e9769 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1062,6 +1062,414 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) return z; } +#ifdef DIV32_OPT_NEWTON +Word32 div_w_newton( Word32 num, Word32 den ); +/* +Table of 256 precalculated estimates to be used by the "div_w_newton" +function using the Newton/Raphson method. +Note: The first table value (for denominator near 0x40000000) is not fully +accurate and should not be used. +*/ +Word32 div_w_newton_lookup[256] = { + /* Precalculated rounded results for 0x40000000 / b with b in [0x40000000 ... 0x7FFFFFFF] */ + 0x7FFFFFFF, // 1.000000000000000 i=0 0.5 / 0.5+0/512 (b=0x40000000) + 0x7F807F80, // 0.996108949416342 i=1 0.5 / 0.5+1/512 (b=0x40400000) + 0x7F01FC07, // 0.992248062015504 i=2 0.5 / 0.5+2/512 (b=0x40800000) + 0x7E8472A8, // 0.988416988416988 i=3 0.5 / 0.5+3/512 (b=0x40C00000) + 0x7E07E07E, // 0.984615384615385 i=4 0.5 / 0.5+4/512 (b=0x41000000) + 0x7D8C42B2, // 0.980842911877395 i=5 0.5 / 0.5+5/512 (b=0x41400000) + 0x7D119679, // 0.977099236641221 i=6 0.5 / 0.5+6/512 (b=0x41800000) + 0x7C97D910, // 0.973384030418251 i=7 0.5 / 0.5+7/512 (b=0x41C00000) + 0x7C1F07C1, // 0.969696969696970 i=8 0.5 / 0.5+8/512 (b=0x42000000) + 0x7BA71FE1, // 0.966037735849057 i=9 0.5 / 0.5+9/512 (b=0x42400000) + 0x7B301ECC, // 0.962406015037594 i=10 0.5 / 0.5+10/512 (b=0x42800000) + 0x7ABA01EA, // 0.958801498127341 i=11 0.5 / 0.5+11/512 (b=0x42C00000) + 0x7A44C6AF, // 0.955223880597015 i=12 0.5 / 0.5+12/512 (b=0x43000000) + 0x79D06A96, // 0.951672862453532 i=13 0.5 / 0.5+13/512 (b=0x43400000) + 0x795CEB24, // 0.948148148148148 i=14 0.5 / 0.5+14/512 (b=0x43800000) + 0x78EA45E7, // 0.944649446494465 i=15 0.5 / 0.5+15/512 (b=0x43C00000) + 0x78787878, // 0.941176470588235 i=16 0.5 / 0.5+16/512 (b=0x44000000) + 0x78078078, // 0.937728937728938 i=17 0.5 / 0.5+17/512 (b=0x44400000) + 0x77975B8F, // 0.934306569343066 i=18 0.5 / 0.5+18/512 (b=0x44800000) + 0x77280772, // 0.930909090909091 i=19 0.5 / 0.5+19/512 (b=0x44C00000) + 0x76B981DA, // 0.927536231884058 i=20 0.5 / 0.5+20/512 (b=0x45000000) + 0x764BC88C, // 0.924187725631769 i=21 0.5 / 0.5+21/512 (b=0x45400000) + 0x75DED952, // 0.920863309352518 i=22 0.5 / 0.5+22/512 (b=0x45800000) + 0x7572B201, // 0.917562724014337 i=23 0.5 / 0.5+23/512 (b=0x45C00000) + 0x75075075, // 0.914285714285714 i=24 0.5 / 0.5+24/512 (b=0x46000000) + 0x749CB28F, // 0.911032028469751 i=25 0.5 / 0.5+25/512 (b=0x46400000) + 0x7432D63D, // 0.907801418439716 i=26 0.5 / 0.5+26/512 (b=0x46800000) + 0x73C9B971, // 0.904593639575972 i=27 0.5 / 0.5+27/512 (b=0x46C00000) + 0x73615A24, // 0.901408450704225 i=28 0.5 / 0.5+28/512 (b=0x47000000) + 0x72F9B658, // 0.898245614035088 i=29 0.5 / 0.5+29/512 (b=0x47400000) + 0x7292CC15, // 0.895104895104895 i=30 0.5 / 0.5+30/512 (b=0x47800000) + 0x722C996B, // 0.891986062717770 i=31 0.5 / 0.5+31/512 (b=0x47C00000) + 0x71C71C71, // 0.888888888888889 i=32 0.5 / 0.5+32/512 (b=0x48000000) + 0x71625344, // 0.885813148788927 i=33 0.5 / 0.5+33/512 (b=0x48400000) + 0x70FE3C07, // 0.882758620689655 i=34 0.5 / 0.5+34/512 (b=0x48800000) + 0x709AD4E4, // 0.879725085910653 i=35 0.5 / 0.5+35/512 (b=0x48C00000) + 0x70381C0E, // 0.876712328767123 i=36 0.5 / 0.5+36/512 (b=0x49000000) + 0x6FD60FBA, // 0.873720136518771 i=37 0.5 / 0.5+37/512 (b=0x49400000) + 0x6F74AE26, // 0.870748299319728 i=38 0.5 / 0.5+38/512 (b=0x49800000) + 0x6F13F596, // 0.867796610169492 i=39 0.5 / 0.5+39/512 (b=0x49C00000) + 0x6EB3E453, // 0.864864864864865 i=40 0.5 / 0.5+40/512 (b=0x4A000000) + 0x6E5478AC, // 0.861952861952862 i=41 0.5 / 0.5+41/512 (b=0x4A400000) + 0x6DF5B0F7, // 0.859060402684564 i=42 0.5 / 0.5+42/512 (b=0x4A800000) + 0x6D978B8E, // 0.856187290969900 i=43 0.5 / 0.5+43/512 (b=0x4AC00000) + 0x6D3A06D3, // 0.853333333333333 i=44 0.5 / 0.5+44/512 (b=0x4B000000) + 0x6CDD212B, // 0.850498338870432 i=45 0.5 / 0.5+45/512 (b=0x4B400000) + 0x6C80D901, // 0.847682119205298 i=46 0.5 / 0.5+46/512 (b=0x4B800000) + 0x6C252CC7, // 0.844884488448845 i=47 0.5 / 0.5+47/512 (b=0x4BC00000) + 0x6BCA1AF2, // 0.842105263157895 i=48 0.5 / 0.5+48/512 (b=0x4C000000) + 0x6B6FA1FE, // 0.839344262295082 i=49 0.5 / 0.5+49/512 (b=0x4C400000) + 0x6B15C06B, // 0.836601307189543 i=50 0.5 / 0.5+50/512 (b=0x4C800000) + 0x6ABC74BE, // 0.833876221498371 i=51 0.5 / 0.5+51/512 (b=0x4CC00000) + 0x6A63BD81, // 0.831168831168831 i=52 0.5 / 0.5+52/512 (b=0x4D000000) + 0x6A0B9944, // 0.828478964401295 i=53 0.5 / 0.5+53/512 (b=0x4D400000) + 0x69B4069B, // 0.825806451612903 i=54 0.5 / 0.5+54/512 (b=0x4D800000) + 0x695D041D, // 0.823151125401929 i=55 0.5 / 0.5+55/512 (b=0x4DC00000) + 0x69069069, // 0.820512820512820 i=56 0.5 / 0.5+56/512 (b=0x4E000000) + 0x68B0AA1F, // 0.817891373801917 i=57 0.5 / 0.5+57/512 (b=0x4E400000) + 0x685B4FE5, // 0.815286624203822 i=58 0.5 / 0.5+58/512 (b=0x4E800000) + 0x68068068, // 0.812698412698413 i=59 0.5 / 0.5+59/512 (b=0x4EC00000) + 0x67B23A54, // 0.810126582278481 i=60 0.5 / 0.5+60/512 (b=0x4F000000) + 0x675E7C5D, // 0.807570977917981 i=61 0.5 / 0.5+61/512 (b=0x4F400000) + 0x670B453B, // 0.805031446540881 i=62 0.5 / 0.5+62/512 (b=0x4F800000) + 0x66B893A9, // 0.802507836990596 i=63 0.5 / 0.5+63/512 (b=0x4FC00000) + 0x66666666, // 0.800000000000000 i=64 0.5 / 0.5+64/512 (b=0x50000000) + 0x6614BC36, // 0.797507788161994 i=65 0.5 / 0.5+65/512 (b=0x50400000) + 0x65C393E0, // 0.795031055900621 i=66 0.5 / 0.5+66/512 (b=0x50800000) + 0x6572EC2F, // 0.792569659442725 i=67 0.5 / 0.5+67/512 (b=0x50C00000) + 0x6522C3F3, // 0.790123456790123 i=68 0.5 / 0.5+68/512 (b=0x51000000) + 0x64D319FE, // 0.787692307692308 i=69 0.5 / 0.5+69/512 (b=0x51400000) + 0x6483ED27, // 0.785276073619632 i=70 0.5 / 0.5+70/512 (b=0x51800000) + 0x64353C48, // 0.782874617737003 i=71 0.5 / 0.5+71/512 (b=0x51C00000) + 0x63E7063E, // 0.780487804878049 i=72 0.5 / 0.5+72/512 (b=0x52000000) + 0x639949EB, // 0.778115501519757 i=73 0.5 / 0.5+73/512 (b=0x52400000) + 0x634C0634, // 0.775757575757576 i=74 0.5 / 0.5+74/512 (b=0x52800000) + 0x62FF3A01, // 0.773413897280967 i=75 0.5 / 0.5+75/512 (b=0x52C00000) + 0x62B2E43D, // 0.771084337349398 i=76 0.5 / 0.5+76/512 (b=0x53000000) + 0x626703D8, // 0.768768768768769 i=77 0.5 / 0.5+77/512 (b=0x53400000) + 0x621B97C2, // 0.766467065868264 i=78 0.5 / 0.5+78/512 (b=0x53800000) + 0x61D09EF3, // 0.764179104477612 i=79 0.5 / 0.5+79/512 (b=0x53C00000) + 0x61861861, // 0.761904761904762 i=80 0.5 / 0.5+80/512 (b=0x54000000) + 0x613C0309, // 0.759643916913947 i=81 0.5 / 0.5+81/512 (b=0x54400000) + 0x60F25DEA, // 0.757396449704142 i=82 0.5 / 0.5+82/512 (b=0x54800000) + 0x60A92806, // 0.755162241887906 i=83 0.5 / 0.5+83/512 (b=0x54C00000) + 0x60606060, // 0.752941176470588 i=84 0.5 / 0.5+84/512 (b=0x55000000) + 0x60180601, // 0.750733137829912 i=85 0.5 / 0.5+85/512 (b=0x55400000) + 0x5FD017F4, // 0.748538011695906 i=86 0.5 / 0.5+86/512 (b=0x55800000) + 0x5F889545, // 0.746355685131195 i=87 0.5 / 0.5+87/512 (b=0x55C00000) + 0x5F417D05, // 0.744186046511628 i=88 0.5 / 0.5+88/512 (b=0x56000000) + 0x5EFACE48, // 0.742028985507246 i=89 0.5 / 0.5+89/512 (b=0x56400000) + 0x5EB48823, // 0.739884393063584 i=90 0.5 / 0.5+90/512 (b=0x56800000) + 0x5E6EA9AE, // 0.737752161383285 i=91 0.5 / 0.5+91/512 (b=0x56C00000) + 0x5E293205, // 0.735632183908046 i=92 0.5 / 0.5+92/512 (b=0x57000000) + 0x5DE42046, // 0.733524355300860 i=93 0.5 / 0.5+93/512 (b=0x57400000) + 0x5D9F7390, // 0.731428571428571 i=94 0.5 / 0.5+94/512 (b=0x57800000) + 0x5D5B2B08, // 0.729344729344729 i=95 0.5 / 0.5+95/512 (b=0x57C00000) + 0x5D1745D1, // 0.727272727272727 i=96 0.5 / 0.5+96/512 (b=0x58000000) + 0x5CD3C315, // 0.725212464589235 i=97 0.5 / 0.5+97/512 (b=0x58400000) + 0x5C90A1FD, // 0.723163841807910 i=98 0.5 / 0.5+98/512 (b=0x58800000) + 0x5C4DE1B6, // 0.721126760563380 i=99 0.5 / 0.5+99/512 (b=0x58C00000) + 0x5C0B8170, // 0.719101123595506 i=100 0.5 / 0.5+100/512 (b=0x59000000) + 0x5BC9805B, // 0.717086834733894 i=101 0.5 / 0.5+101/512 (b=0x59400000) + 0x5B87DDAD, // 0.715083798882682 i=102 0.5 / 0.5+102/512 (b=0x59800000) + 0x5B46989A, // 0.713091922005571 i=103 0.5 / 0.5+103/512 (b=0x59C00000) + 0x5B05B05B, // 0.711111111111111 i=104 0.5 / 0.5+104/512 (b=0x5A000000) + 0x5AC5242A, // 0.709141274238227 i=105 0.5 / 0.5+105/512 (b=0x5A400000) + 0x5A84F345, // 0.707182320441989 i=106 0.5 / 0.5+106/512 (b=0x5A800000) + 0x5A451CEA, // 0.705234159779614 i=107 0.5 / 0.5+107/512 (b=0x5AC00000) + 0x5A05A05A, // 0.703296703296703 i=108 0.5 / 0.5+108/512 (b=0x5B000000) + 0x59C67CD8, // 0.701369863013699 i=109 0.5 / 0.5+109/512 (b=0x5B400000) + 0x5987B1A9, // 0.699453551912568 i=110 0.5 / 0.5+110/512 (b=0x5B800000) + 0x59493E14, // 0.697547683923706 i=111 0.5 / 0.5+111/512 (b=0x5BC00000) + 0x590B2164, // 0.695652173913043 i=112 0.5 / 0.5+112/512 (b=0x5C000000) + 0x58CD5AE2, // 0.693766937669377 i=113 0.5 / 0.5+113/512 (b=0x5C400000) + 0x588FE9DC, // 0.691891891891892 i=114 0.5 / 0.5+114/512 (b=0x5C800000) + 0x5852CDA0, // 0.690026954177898 i=115 0.5 / 0.5+115/512 (b=0x5CC00000) + 0x58160581, // 0.688172043010753 i=116 0.5 / 0.5+116/512 (b=0x5D000000) + 0x57D990D0, // 0.686327077747989 i=117 0.5 / 0.5+117/512 (b=0x5D400000) + 0x579D6EE3, // 0.684491978609626 i=118 0.5 / 0.5+118/512 (b=0x5D800000) + 0x57619F0F, // 0.682666666666667 i=119 0.5 / 0.5+119/512 (b=0x5DC00000) + 0x572620AE, // 0.680851063829787 i=120 0.5 / 0.5+120/512 (b=0x5E000000) + 0x56EAF319, // 0.679045092838196 i=121 0.5 / 0.5+121/512 (b=0x5E400000) + 0x56B015AC, // 0.677248677248677 i=122 0.5 / 0.5+122/512 (b=0x5E800000) + 0x567587C4, // 0.675461741424802 i=123 0.5 / 0.5+123/512 (b=0x5EC00000) + 0x563B48C2, // 0.673684210526316 i=124 0.5 / 0.5+124/512 (b=0x5F000000) + 0x56015805, // 0.671916010498688 i=125 0.5 / 0.5+125/512 (b=0x5F400000) + 0x55C7B4F1, // 0.670157068062827 i=126 0.5 / 0.5+126/512 (b=0x5F800000) + 0x558E5EE9, // 0.668407310704961 i=127 0.5 / 0.5+127/512 (b=0x5FC00000) + 0x55555555, // 0.666666666666667 i=128 0.5 / 0.5+128/512 (b=0x60000000) + 0x551C979A, // 0.664935064935065 i=129 0.5 / 0.5+129/512 (b=0x60400000) + 0x54E42523, // 0.663212435233161 i=130 0.5 / 0.5+130/512 (b=0x60800000) + 0x54ABFD5A, // 0.661498708010336 i=131 0.5 / 0.5+131/512 (b=0x60C00000) + 0x54741FAB, // 0.659793814432990 i=132 0.5 / 0.5+132/512 (b=0x61000000) + 0x543C8B84, // 0.658097686375321 i=133 0.5 / 0.5+133/512 (b=0x61400000) + 0x54054054, // 0.656410256410256 i=134 0.5 / 0.5+134/512 (b=0x61800000) + 0x53CE3D8B, // 0.654731457800512 i=135 0.5 / 0.5+135/512 (b=0x61C00000) + 0x5397829C, // 0.653061224489796 i=136 0.5 / 0.5+136/512 (b=0x62000000) + 0x53610EFB, // 0.651399491094148 i=137 0.5 / 0.5+137/512 (b=0x62400000) + 0x532AE21C, // 0.649746192893401 i=138 0.5 / 0.5+138/512 (b=0x62800000) + 0x52F4FB76, // 0.648101265822785 i=139 0.5 / 0.5+139/512 (b=0x62C00000) + 0x52BF5A81, // 0.646464646464647 i=140 0.5 / 0.5+140/512 (b=0x63000000) + 0x5289FEB5, // 0.644836272040302 i=141 0.5 / 0.5+141/512 (b=0x63400000) + 0x5254E78E, // 0.643216080402010 i=142 0.5 / 0.5+142/512 (b=0x63800000) + 0x52201488, // 0.641604010025063 i=143 0.5 / 0.5+143/512 (b=0x63C00000) + 0x51EB851E, // 0.640000000000000 i=144 0.5 / 0.5+144/512 (b=0x64000000) + 0x51B738D1, // 0.638403990024938 i=145 0.5 / 0.5+145/512 (b=0x64400000) + 0x51832F1F, // 0.636815920398010 i=146 0.5 / 0.5+146/512 (b=0x64800000) + 0x514F678B, // 0.635235732009926 i=147 0.5 / 0.5+147/512 (b=0x64C00000) + 0x511BE195, // 0.633663366336634 i=148 0.5 / 0.5+148/512 (b=0x65000000) + 0x50E89CC2, // 0.632098765432099 i=149 0.5 / 0.5+149/512 (b=0x65400000) + 0x50B59897, // 0.630541871921182 i=150 0.5 / 0.5+150/512 (b=0x65800000) + 0x5082D499, // 0.628992628992629 i=151 0.5 / 0.5+151/512 (b=0x65C00000) + 0x50505050, // 0.627450980392157 i=152 0.5 / 0.5+152/512 (b=0x66000000) + 0x501E0B44, // 0.625916870415648 i=153 0.5 / 0.5+153/512 (b=0x66400000) + 0x4FEC04FE, // 0.624390243902439 i=154 0.5 / 0.5+154/512 (b=0x66800000) + 0x4FBA3D0A, // 0.622871046228710 i=155 0.5 / 0.5+155/512 (b=0x66C00000) + 0x4F88B2F3, // 0.621359223300971 i=156 0.5 / 0.5+156/512 (b=0x67000000) + 0x4F576646, // 0.619854721549637 i=157 0.5 / 0.5+157/512 (b=0x67400000) + 0x4F265691, // 0.618357487922705 i=158 0.5 / 0.5+158/512 (b=0x67800000) + 0x4EF58364, // 0.616867469879518 i=159 0.5 / 0.5+159/512 (b=0x67C00000) + 0x4EC4EC4E, // 0.615384615384615 i=160 0.5 / 0.5+160/512 (b=0x68000000) + 0x4E9490E1, // 0.613908872901679 i=161 0.5 / 0.5+161/512 (b=0x68400000) + 0x4E6470B0, // 0.612440191387560 i=162 0.5 / 0.5+162/512 (b=0x68800000) + 0x4E348B4D, // 0.610978520286396 i=163 0.5 / 0.5+163/512 (b=0x68C00000) + 0x4E04E04E, // 0.609523809523810 i=164 0.5 / 0.5+164/512 (b=0x69000000) + 0x4DD56F47, // 0.608076009501188 i=165 0.5 / 0.5+165/512 (b=0x69400000) + 0x4DA637CF, // 0.606635071090047 i=166 0.5 / 0.5+166/512 (b=0x69800000) + 0x4D77397E, // 0.605200945626478 i=167 0.5 / 0.5+167/512 (b=0x69C00000) + 0x4D4873EC, // 0.603773584905660 i=168 0.5 / 0.5+168/512 (b=0x6A000000) + 0x4D19E6B3, // 0.602352941176471 i=169 0.5 / 0.5+169/512 (b=0x6A400000) + 0x4CEB916D, // 0.600938967136150 i=170 0.5 / 0.5+170/512 (b=0x6A800000) + 0x4CBD73B5, // 0.599531615925059 i=171 0.5 / 0.5+171/512 (b=0x6AC00000) + 0x4C8F8D28, // 0.598130841121495 i=172 0.5 / 0.5+172/512 (b=0x6B000000) + 0x4C61DD63, // 0.596736596736597 i=173 0.5 / 0.5+173/512 (b=0x6B400000) + 0x4C346404, // 0.595348837209302 i=174 0.5 / 0.5+174/512 (b=0x6B800000) + 0x4C0720AB, // 0.593967517401392 i=175 0.5 / 0.5+175/512 (b=0x6BC00000) + 0x4BDA12F6, // 0.592592592592593 i=176 0.5 / 0.5+176/512 (b=0x6C000000) + 0x4BAD3A87, // 0.591224018475751 i=177 0.5 / 0.5+177/512 (b=0x6C400000) + 0x4B809701, // 0.589861751152074 i=178 0.5 / 0.5+178/512 (b=0x6C800000) + 0x4B542804, // 0.588505747126437 i=179 0.5 / 0.5+179/512 (b=0x6CC00000) + 0x4B27ED36, // 0.587155963302752 i=180 0.5 / 0.5+180/512 (b=0x6D000000) + 0x4AFBE639, // 0.585812356979405 i=181 0.5 / 0.5+181/512 (b=0x6D400000) + 0x4AD012B4, // 0.584474885844749 i=182 0.5 / 0.5+182/512 (b=0x6D800000) + 0x4AA4724B, // 0.583143507972665 i=183 0.5 / 0.5+183/512 (b=0x6DC00000) + 0x4A7904A7, // 0.581818181818182 i=184 0.5 / 0.5+184/512 (b=0x6E000000) + 0x4A4DC96E, // 0.580498866213152 i=185 0.5 / 0.5+185/512 (b=0x6E400000) + 0x4A22C04A, // 0.579185520361991 i=186 0.5 / 0.5+186/512 (b=0x6E800000) + 0x49F7E8E2, // 0.577878103837472 i=187 0.5 / 0.5+187/512 (b=0x6EC00000) + 0x49CD42E2, // 0.576576576576577 i=188 0.5 / 0.5+188/512 (b=0x6F000000) + 0x49A2CDF3, // 0.575280898876405 i=189 0.5 / 0.5+189/512 (b=0x6F400000) + 0x497889C2, // 0.573991031390135 i=190 0.5 / 0.5+190/512 (b=0x6F800000) + 0x494E75FA, // 0.572706935123042 i=191 0.5 / 0.5+191/512 (b=0x6FC00000) + 0x49249249, // 0.571428571428571 i=192 0.5 / 0.5+192/512 (b=0x70000000) + 0x48FADE5C, // 0.570155902004454 i=193 0.5 / 0.5+193/512 (b=0x70400000) + 0x48D159E2, // 0.568888888888889 i=194 0.5 / 0.5+194/512 (b=0x70800000) + 0x48A8048A, // 0.567627494456763 i=195 0.5 / 0.5+195/512 (b=0x70C00000) + 0x487EDE04, // 0.566371681415929 i=196 0.5 / 0.5+196/512 (b=0x71000000) + 0x4855E601, // 0.565121412803532 i=197 0.5 / 0.5+197/512 (b=0x71400000) + 0x482D1C31, // 0.563876651982379 i=198 0.5 / 0.5+198/512 (b=0x71800000) + 0x48048048, // 0.562637362637363 i=199 0.5 / 0.5+199/512 (b=0x71C00000) + 0x47DC11F7, // 0.561403508771930 i=200 0.5 / 0.5+200/512 (b=0x72000000) + 0x47B3D0F1, // 0.560175054704595 i=201 0.5 / 0.5+201/512 (b=0x72400000) + 0x478BBCEC, // 0.558951965065502 i=202 0.5 / 0.5+202/512 (b=0x72800000) + 0x4763D59C, // 0.557734204793028 i=203 0.5 / 0.5+203/512 (b=0x72C00000) + 0x473C1AB6, // 0.556521739130435 i=204 0.5 / 0.5+204/512 (b=0x73000000) + 0x47148BF0, // 0.555314533622560 i=205 0.5 / 0.5+205/512 (b=0x73400000) + 0x46ED2901, // 0.554112554112554 i=206 0.5 / 0.5+206/512 (b=0x73800000) + 0x46C5F19F, // 0.552915766738661 i=207 0.5 / 0.5+207/512 (b=0x73C00000) + 0x469EE584, // 0.551724137931034 i=208 0.5 / 0.5+208/512 (b=0x74000000) + 0x46780467, // 0.550537634408602 i=209 0.5 / 0.5+209/512 (b=0x74400000) + 0x46514E02, // 0.549356223175966 i=210 0.5 / 0.5+210/512 (b=0x74800000) + 0x462AC20E, // 0.548179871520343 i=211 0.5 / 0.5+211/512 (b=0x74C00000) + 0x46046046, // 0.547008547008547 i=212 0.5 / 0.5+212/512 (b=0x75000000) + 0x45DE2864, // 0.545842217484009 i=213 0.5 / 0.5+213/512 (b=0x75400000) + 0x45B81A25, // 0.544680851063830 i=214 0.5 / 0.5+214/512 (b=0x75800000) + 0x45923543, // 0.543524416135881 i=215 0.5 / 0.5+215/512 (b=0x75C00000) + 0x456C797D, // 0.542372881355932 i=216 0.5 / 0.5+216/512 (b=0x76000000) + 0x4546E68F, // 0.541226215644820 i=217 0.5 / 0.5+217/512 (b=0x76400000) + 0x45217C38, // 0.540084388185654 i=218 0.5 / 0.5+218/512 (b=0x76800000) + 0x44FC3A34, // 0.538947368421053 i=219 0.5 / 0.5+219/512 (b=0x76C00000) + 0x44D72044, // 0.537815126050420 i=220 0.5 / 0.5+220/512 (b=0x77000000) + 0x44B22E27, // 0.536687631027254 i=221 0.5 / 0.5+221/512 (b=0x77400000) + 0x448D639D, // 0.535564853556485 i=222 0.5 / 0.5+222/512 (b=0x77800000) + 0x4468C066, // 0.534446764091858 i=223 0.5 / 0.5+223/512 (b=0x77C00000) + 0x44444444, // 0.533333333333333 i=224 0.5 / 0.5+224/512 (b=0x78000000) + 0x441FEEF8, // 0.532224532224532 i=225 0.5 / 0.5+225/512 (b=0x78400000) + 0x43FBC043, // 0.531120331950207 i=226 0.5 / 0.5+226/512 (b=0x78800000) + 0x43D7B7EA, // 0.530020703933747 i=227 0.5 / 0.5+227/512 (b=0x78C00000) + 0x43B3D5AF, // 0.528925619834711 i=228 0.5 / 0.5+228/512 (b=0x79000000) + 0x43901956, // 0.527835051546392 i=229 0.5 / 0.5+229/512 (b=0x79400000) + 0x436C82A2, // 0.526748971193416 i=230 0.5 / 0.5+230/512 (b=0x79800000) + 0x43491158, // 0.525667351129363 i=231 0.5 / 0.5+231/512 (b=0x79C00000) + 0x4325C53E, // 0.524590163934426 i=232 0.5 / 0.5+232/512 (b=0x7A000000) + 0x43029E1A, // 0.523517382413088 i=233 0.5 / 0.5+233/512 (b=0x7A400000) + 0x42DF9BB0, // 0.522448979591837 i=234 0.5 / 0.5+234/512 (b=0x7A800000) + 0x42BCBDC8, // 0.521384928716904 i=235 0.5 / 0.5+235/512 (b=0x7AC00000) + 0x429A0429, // 0.520325203252033 i=236 0.5 / 0.5+236/512 (b=0x7B000000) + 0x42776E9A, // 0.519269776876268 i=237 0.5 / 0.5+237/512 (b=0x7B400000) + 0x4254FCE4, // 0.518218623481781 i=238 0.5 / 0.5+238/512 (b=0x7B800000) + 0x4232AECD, // 0.517171717171717 i=239 0.5 / 0.5+239/512 (b=0x7BC00000) + 0x42108421, // 0.516129032258065 i=240 0.5 / 0.5+240/512 (b=0x7C000000) + 0x41EE7CA6, // 0.515090543259557 i=241 0.5 / 0.5+241/512 (b=0x7C400000) + 0x41CC9829, // 0.514056224899598 i=242 0.5 / 0.5+242/512 (b=0x7C800000) + 0x41AAD671, // 0.513026052104208 i=243 0.5 / 0.5+243/512 (b=0x7CC00000) + 0x4189374B, // 0.512000000000000 i=244 0.5 / 0.5+244/512 (b=0x7D000000) + 0x4167BA81, // 0.510978043912176 i=245 0.5 / 0.5+245/512 (b=0x7D400000) + 0x41465FDF, // 0.509960159362550 i=246 0.5 / 0.5+246/512 (b=0x7D800000) + 0x41252730, // 0.508946322067594 i=247 0.5 / 0.5+247/512 (b=0x7DC00000) + 0x41041041, // 0.507936507936508 i=248 0.5 / 0.5+248/512 (b=0x7E000000) + 0x40E31ADE, // 0.506930693069307 i=249 0.5 / 0.5+249/512 (b=0x7E400000) + 0x40C246D4, // 0.505928853754941 i=250 0.5 / 0.5+250/512 (b=0x7E800000) + 0x40A193F1, // 0.504930966469428 i=251 0.5 / 0.5+251/512 (b=0x7EC00000) + 0x40810204, // 0.503937007874016 i=252 0.5 / 0.5+252/512 (b=0x7F000000) + 0x406090D9, // 0.502946954813359 i=253 0.5 / 0.5+253/512 (b=0x7F400000) + 0x40404040, // 0.501960784313725 i=254 0.5 / 0.5+254/512 (b=0x7F800000) + 0x40201008 // 0.500978473581213 i=255 0.5 / 0.5+255/512 (b=0x7FC00000) +}; + + +/* + * Fractional multiplication of signed a and b, both in Q31. The result is doubled. + * Note: in this test, saturation is not needed. + * BASOP weights: 3 + */ + +static Word32 L_dmult( Word32 L_var1, Word32 L_var2 ) +{ + Word64 L64_var1 = W_mult0_32_32( L_var1, L_var2 ); + L64_var1 = W_shr( L64_var1, 30 ); + return W_extract_l( L64_var1 ); +} + +/* + * 32 by 32 bit division, following the Newton / Raphson method. + * Usage of this low-level procedure by the caller: + * 1. Numerator can use the full range of signed 32-bit datatypes: 0x80000000...0x7FFFFFFF + * Note: Since is not normalized here, but it is multplied to the reciprocal of the + * denominator, the caller should use a normalized and handle any exponent outside. + * 2. Denominator must be normalized into range 0x40000001 to 0x7FFFFFFF (all positive) + * Note: In case of den=0x40000000, the caller is not allowed to call the division routine, + since the result is known. + * Note: num / 0x40000000 equals to num with exp += 1. + * 3. The result is in range 0x40000000 to 0x7FFFFFFF, finally multiplied by . + * BASOP weights: 24 (incl. L_dmult) + */ + +Word32 div_w_newton( Word32 num, Word32 den ) +{ + Word32 x0, x1, x2, x3, diff, result; + + x0 = div_w_newton_lookup[sub( extract_l( L_shr( den, 22 ) ), 256 )]; + move32(); + + diff = L_sub( 0x40000000, Mpy_32_32( den, x0 ) ); + + x1 = L_add( x0, L_dmult( x0, diff ) ); + diff = L_sub( 0x40000000, Mpy_32_32( den, x1 ) ); + + x2 = L_add( x1, L_dmult( x1, diff ) ); + diff = L_sub( 0x40000000, Mpy_32_32( den, x2 ) ); + + x3 = L_add( x2, L_dmult( x2, diff ) ); + + result = Mpy_32_32( num, x3 ); + + return result; +} + +/* + * 32 / 32 division + * Usage of this global procedure by the caller: + * 1. Numerator can use the full range of signed 32-bit datatypes: 0x80000000...0x7FFFFFFF + * Note: Since is not normalized here, but it is multplied to the reciprocal of the + * denominator, the caller should use a normalized and handle any exponent outside. + * 2. Denominator can use the full range of signed 32-bit datatypes: 0x80000000...0x7FFFFFFF + * except den=0x00000000. In case of 0x80000000, it becomes internally negated to 0x7FFFFFFF. + * 3. The result is 0x00000000 (*s=0)for equals 0x00000000. + * The result is rather left aligned, with up to 1 bit headroom. + * 4. The result exponent is stored in s[0] + * BASOP weights: 41 (incl. div_w_newton) + */ + +Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) +{ + Word32 z; + Word16 sx; + Word16 sy; + Word32 sign; + + assert( y != (Word32) 0 ); + + /* Early exit, if numerator is zero */ + IF( x == (Word32) 0 ) + { + *s = 0; + return ( (Word32) 0 ); + } + +#if 0 + sign = L_xor( x, y ); /* check (sign < 0) for result negation */ + + if ( x < 0 ) + { + x = L_negate( x ); + } +#else + IF( EQ_32( y, 0x80000000 ) ) + { + /* Division by -1.0: same as negation of numerator */ + /* Return normalized negated numerator */ + sx = norm_l( x ); + x = L_shl( x, sx ); + *s = negate( sx ); + return L_negate( x ); + } + sign = y; + move32(); +#endif + if ( y < 0 ) + { + y = L_negate( y ); + } + + /* Normalize numerator */ + sx = norm_l( x ); + x = L_shl( x, sx ); + + /* Normalize denominator */ + sy = norm_l( y ); + y = L_shl( y, sy ); + + /* Store exponent: + 1 for div_w_newton computing 0.5*num/den */ + *s = sub( add( sy, 1 ), sx ); + move16(); + + /* Special treatment for den=0x40000000 */ + /* Result is known: z=2*num */ + IF( EQ_32( y, 0x40000000 ) ) + { + if ( sign < 0 ) + { + x = L_negate( x ); + } + return x; + } + + /* Invoke division applying Newton/Raphson-Algorithm */ + z = div_w_newton( x, y ); + + if ( sign < 0 ) + { + z = L_negate( z ); + } + + return z; +} +#endif /* DIV32_OPT_NEWTON */ + Word16 BASOP_Util_Divide3232_Scale( Word32 x, Word32 y, Word16 *s ) { Word16 z; diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index a6db7dc8d..b1d4b5fc1 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -333,6 +333,13 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, /*!< i : Numerator*/ Word16 *s ); /*!< o : Additional scalefactor difference*/ +#ifdef DIV32_OPT_NEWTON +Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, /*!< i : Numerator*/ + Word32 y, /*!< i : Denominator*/ + Word16 *s ); /*!< o : Additional scalefactor difference*/ +#endif + + /************************************************************************/ /*! \brief Binary logarithm with 7 iterations diff --git a/lib_com/options.h b/lib_com/options.h index 2b88deb5d..90cd057d0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -80,4 +80,6 @@ #define HARM_PUSH_BIT #define HARM_ENC_INIT //#define HARM_SCE_INIT +#define DIV32_OPT_NEWTON /* FhG: faster 32 by 32 bit division */ + #endif -- GitLab From 75452c1c01d23b783455cd1b959ab27256e43fc8 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 6 Apr 2025 21:07:27 +0200 Subject: [PATCH 317/358] Force 32by32 div Newton variant --- lib_com/basop_util.c | 5 +++++ lib_com/options.h | 1 + 2 files changed, 6 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index ec15e9769..32f5cc55f 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1013,6 +1013,10 @@ Word32 div_w( Word32 L_num, Word32 L_den ) Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; +#ifdef FORCE_DIV32_OPT_NEWTON + z = BASOP_Util_Divide3232_Scale_newton( x, y, s ); + return z; +#else Word16 sx; Word16 sy; Word32 sign; @@ -1060,6 +1064,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) } return z; +#endif } #ifdef DIV32_OPT_NEWTON diff --git a/lib_com/options.h b/lib_com/options.h index 90cd057d0..e1e4f53a7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,5 +81,6 @@ #define HARM_ENC_INIT //#define HARM_SCE_INIT #define DIV32_OPT_NEWTON /* FhG: faster 32 by 32 bit division */ +#define FORCE_DIV32_OPT_NEWTON /* FhG: replace BASOP_Util_Divide3232_Scale_cadence() by BASOP_Util_Divide3232_Scale_newton() */ #endif -- GitLab From b88e235579de88acb9f94840c8ec32be4d4aee86 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 7 Apr 2025 09:59:52 +0530 Subject: [PATCH 318/358] Scaling fix in encode gen voice, enc gen audio, core-enc, acelp_fast_fx bug fixes, fine_gain_quant bug fix --- lib_com/ivas_prot_fx.h | 7 +- lib_com/prot_fx.h | 9 +- lib_com/pvq_com_fx.c | 67 --------- lib_enc/cod4t64_fast.c | 166 +++++++++++++++++------ lib_enc/enc_gen_voic_fx.c | 77 +++++++---- lib_enc/enc_pit_exc_fx.c | 13 +- lib_enc/ext_sig_ana_fx.c | 34 ++--- lib_enc/find_tar_fx.c | 135 +++++++++++++++++- lib_enc/gs_enc_fx.c | 8 +- lib_enc/inov_enc_fx.c | 14 +- lib_enc/ivas_core_enc_fx.c | 12 -- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 8 +- lib_enc/ivas_mdct_core_enc_fx.c | 9 +- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 6 +- lib_enc/ivas_tcx_core_enc_fx.c | 9 +- lib_enc/prot_fx_enc.h | 15 ++ lib_enc/pvq_core_enc_fx.c | 6 +- 17 files changed, 366 insertions(+), 229 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 1bc3c6c5b..036d546bc 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2998,11 +2998,12 @@ void acelp_fast_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 cdk_index, /* i : codebook index */ const Word16 dn_orig[L_SUBFR], - /* i : corr. between target and h[]. */ // Q_new + 1 + /* i : corr. between target and h[]. */ // Q_dn Word16 Q_dn, const Word16 cn[L_SUBFR], - /* i : residual after long term prediction */ // Q_new + 1 - const Word16 H[L_SUBFR], + /* i : residual after long term prediction */ // q_cn + const Word16 q_cn, + const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter */ // e(norm_s(H[0])+1) Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation */ Word16 y[], /* o : filtered fixed codebook excitation */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index ffd1d6032..1452d8e2e 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5077,14 +5077,7 @@ void fine_gain_quant_fx( Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q12 */ const Word16 *gopt /* i : Optimal gains Q12 */ ); -void fine_gain_quant_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 *ord, /* i : Indices for energy order Q0 */ - const Word16 num_sfm, /* i : Number of bands Q0 */ - const Word16 *gain_bits, /* i : Gain adjustment bits per sub band Q0 */ - Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains i:Q12 / o:Q11 */ - const Word16 *gopt /* i : Optimal gains Q12 */ -); + void get_max_pulses_fx( const Word16 *band_start, /* i : Sub band start indices */ const Word16 *band_end, /* i : Sub band end indices */ diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 9cf1226d8..a6c0bc462 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -509,73 +509,6 @@ void apply_gain_fx( * * Fine gain quantization *--------------------------------------------------------------------------*/ -void fine_gain_quant_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 *ord, /* i : Indices for energy order Q0 */ - const Word16 num_sfm, /* i : Number of bands Q0 */ - const Word16 *gain_bits, /* i : Gain adjustment bits per sub band Q0 */ - Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains i:Q12 / o:Q11 */ - const Word16 *gopt /* i : Optimal gains Q12 */ -) -{ - Word16 band; - Word16 gbits; - Word16 idx; - Word16 gain_db, gain_dbq; - Word16 err; - - Word16 tmp1, tmp2, exp1, exp2; - Word32 L_tmp; - UWord16 lsb; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - FOR( band = 0; band < num_sfm; band++ ) - { - gbits = gain_bits[ord[band]]; /* Q0 */ - move16(); - test(); - IF( fg_pred[band] != 0 && gbits > 0 ) - { - exp1 = norm_s( gopt[band] ); - exp1 = sub( exp1, 1 ); - tmp1 = shl( gopt[band], exp1 ); - exp2 = norm_s( fg_pred[band] ); - tmp2 = shl( fg_pred[band], exp2 ); /* Q12 + exp2 */ - exp1 = add( 15, sub( exp1, exp2 ) ); - err = div_s( tmp1, tmp2 ); /* Q15 */ - tmp1 = norm_s( err ); - exp2 = Log2_norm_lc( L_deposit_h( shl( err, tmp1 ) ) ); - tmp1 = sub( 14, tmp1 ); - tmp1 = sub( tmp1, exp1 ); - L_tmp = L_Comp( tmp1, exp2 ); - Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */ - gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); /* Q14 */ - - idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); /* Q0 */ - push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); - - L_tmp = L_mult0( gain_dbq, 21771 ); /* 21771=0.05*log2(10) */ /* 14+17=31 */ - L_tmp = L_shr( L_tmp, 15 ); /* Q16 */ - tmp1 = L_Extract_lc( L_tmp, &exp1 ); - tmp1 = abs_s( tmp1 ); - tmp1 = extract_l( Pow2( 14, tmp1 ) ); - exp1 = sub( 14, exp1 ); - - L_tmp = L_mult0( fg_pred[band], tmp1 ); /*12+exp1 */ - fg_pred[band] = round_fx( L_shl( L_tmp, sub( 15, exp1 ) ) ); /*12+exp1+16-exp1-16=12 - 1-> Q11*/ - move16(); - } - ELSE - { - fg_pred[band] = shr( fg_pred[band], 1 ); // Q12 -> Q11 To align all the fg_pred indices in same Q. - } - } - - return; -} void fine_gain_quant_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 *ord, /* i : Indices for energy order Q0 */ diff --git a/lib_enc/cod4t64_fast.c b/lib_enc/cod4t64_fast.c index 0e4c02744..e24f3b678 100644 --- a/lib_enc/cod4t64_fast.c +++ b/lib_enc/cod4t64_fast.c @@ -123,10 +123,11 @@ void acelp_fast_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 cdk_index, /* i : codebook index */ const Word16 dn_orig[L_SUBFR], - /* i : corr. between target and h[]. */ // Q_new + 1 + /* i : corr. between target and h[]. */ // Q_dn Word16 Q_dn, const Word16 cn[L_SUBFR], - /* i : residual after long term prediction */ // Q_new + 1 + /* i : residual after long term prediction */ // q_cn + const Word16 q_cn, const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter */ // e(norm_s(H[0])+1) Word16 code[L_SUBFR], @@ -161,7 +162,9 @@ void acelp_fast_fx( Word64 s64; Word16 flag = 0; move16(); - + Word32 temp1, temp2, temp3, temp4, temp5, temp6; + Word16 q_temp1, q_temp2; + Word16 scale_temp1, scale_temp2; /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -294,16 +297,23 @@ void acelp_fast_fx( exp = sub( Q31, shl( Q_dn, 1 ) ); + s64 = 0; + move64(); + FOR( i = 0; i < L_subfr; i++ ) + { + s64 = W_mac_16_16( s64, dn_orig[i], dn_orig[i] ); // 2 * Q_dn + 1 + } dndn_fx = 21474836 /*0.01f in Q31 */; move32(); dndn_e = 0; move16(); - FOR( i = 0; i < L_subfr; i++ ) + IF( s64 ) { - dndn_fx = BASOP_Util_Add_Mant32Exp( dndn_fx, dndn_e, L_mult0( dn_orig[i], dn_orig[i] ), exp, &dndn_e ); // Q(dndn_e) + Word16 new_exp1 = W_norm( s64 ); + dndn_fx = W_extract_h( W_shl( s64, new_exp1 ) ); // 2 * Q_dyn + exp1 - 31 + dndn_e = sub( 31, sub( add( add( shl( Q_dn, 1 ), 1 ), new_exp1 ), 32 ) ); } - exp1 = sub( Q31, shl( sub( Q_dn, 1 ), 1 ) ); cncn_fx = 214748365 /* 0.1f in Q31 */; move32(); @@ -312,31 +322,42 @@ void acelp_fast_fx( FOR( q = 0; q < nb_tracks; q++ ) { + s64 = 0; + move64(); + FOR( i = 0; i < L_subfr; i += nb_tracks ) + { + s64 = W_mac_16_16( s64, cn[i + q], cn[i + q] ); // 2 * q_cn + 1 + } + cncn_track[q] = 214748365 /* 0.1f in Q31 */; move32(); cncn_track_e[q] = 0; move16(); - - FOR( i = 0; i < L_subfr; i += nb_tracks ) + IF( s64 ) { - Word32 L_tmp = L_mult0( cn[i + q], cn[i + q] ); - shift = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, shift ); - cncn_track[q] = BASOP_Util_Add_Mant32Exp( cncn_track[q], cncn_track_e[q], L_tmp, sub( exp1, shift ), &cncn_track_e[q] ); // Q(cncn_track_e[q]) - move32(); + Word16 new_exp1 = W_norm( s64 ); + cncn_track[q] = W_extract_h( W_shl( s64, new_exp1 ) ); // 2 * Q_dyn + exp1 - 31 + cncn_track_e[q] = sub( 31, sub( add( add( shl( q_cn, 1 ), 1 ), new_exp1 ), 32 ) ); } cncn_fx = BASOP_Util_Add_Mant32Exp( cncn_fx, cncn_e, cncn_track[q], cncn_track_e[q], &cncn_e ); // Q(cncn_e) } - Word16 tmp; + Word16 tmp = 0; + move16(); s_coef_fx = BASOP_Util_Divide3232_Scale( dndn_fx, cncn_fx, &tmp ); tmp = add( tmp, sub( dndn_e, cncn_e ) ); s_coef_fx = Sqrt16( s_coef_fx, &tmp ); // Q(15 - tmp) - + q_temp1 = add( add( sub( Q15, tmp ), q_cn ), Q1 ); + scale_temp1 = sub( q_temp1, Q_dn ); FOR( i = 0; i < L_subfr; i++ ) { - bn_orig_fx[i] = L_mac0( L_shr( L_mult( s_coef_fx, cn[i] ), sub( 15, tmp ) ), beta1_fx, dn_orig[i] ); // Q_dn + temp1 = L_mult( s_coef_fx, cn[i] ); // Q(15 - tmp)+q_cn+1 + temp2 = L_mult( beta1_fx, dn_orig[i] ); // 1+Q_dn+1 + /* bn_orig_fx[i] is being used in Q_dn */ + temp2 = L_shr( temp2, 1 ); + temp1 = L_shr( temp1, scale_temp1 ); + bn_orig_fx[i] = L_add( temp1, temp2 ); // Q_dn move32(); IF( bn_orig_fx[i] >= 0 ) @@ -576,12 +597,12 @@ void acelp_fast_fx( } ELSE { - Gn = i_mult( s[0], shr( dn_orig[m[0]], 1 ) ); // Q_dn - 1 - Gd = alp[0]; // Q6 + Gn = i_mult( s[0], dn_orig[m[0]] ); // Q_dn + Gd = alp[0]; // Q6 move16(); - G = Gn; // Q_dn - 1 + G = Gn; // Q_dn move16(); - G = i_mult( G, s[0] ); // Q_dn - 1 + G = i_mult( G, s[0] ); // Q_dn track = track_order[q * nb_tracks + 1]; // Q0 move16(); @@ -596,14 +617,17 @@ void acelp_fast_fx( move64(); FOR( i = track; i < L_subfr; i += nb_tracks ) { - dn[i] = L_shr( L_msu( L_mult0( Gd, dn_orig[i] ), G, *alp_pos0 ), 6 ); // Q_dn + temp1 = L_mult0( Gd, dn_orig[i] ); + temp2 = L_mult0( G, *alp_pos0 ); + temp3 = L_sub( temp1, temp2 ); + dn[i] = L_shr( temp3, 6 ); move32(); alp_pos0 += nb_tracks; s64 = W_mac_32_32( s64, dn[i], dn[i] ); // 2 * Q_dn + 1 } exp1 = W_norm( s64 ); dndn_fx = W_extract_h( W_shl( s64, exp1 ) ); // 2 * Q_dyn + exp1 - 31 - dndn_e = sub( 31, sub( add( shl( Q_dn, 1 ), exp ), 31 ) ); + dndn_e = sub( 31, sub( add( add( shl( Q_dn, 1 ), 1 ), exp1 ), 32 ) ); IF( dndn_fx == 0 ) { @@ -612,17 +636,28 @@ void acelp_fast_fx( dndn_e = 0; move16(); } + exp1 = 0; + move16(); s_coef_fx = BASOP_Util_Divide3232_Scale( dndn_fx, cncn_track[track], &exp1 ); exp1 = add( exp1, sub( dndn_e, cncn_track_e[track] ) ); s_coef_fx = Sqrt16( s_coef_fx, &exp1 ); - exp1 = sub( exp1, shift ); max_val_fx = EPSILLON_FX; move16(); m[1] = track; // Q0 move16(); + q_temp1 = add( add( sub( Q15, exp1 ), q_cn ), 1 ); + q_temp2 = add( Q_dn, Q2 ); + scale_temp1 = sub( q_temp1, Q_dn ); + scale_temp2 = sub( q_temp2, Q_dn ); FOR( i = track; i < L_subfr; i += nb_tracks ) { - dn[i] = L_add( L_shr( L_mult( s_coef_fx, cn[i] ), sub( 15, exp1 ) ), L_shr( imult3216( dn[i], beta2_fx ), 2 ) ); // Q_dn + temp1 = L_mult( s_coef_fx, cn[i] ); // Q(15 - tmp)+q_cn+1 + temp2 = imult3216( dn[i], beta2_fx ); // Q_dn + 2 + + /* bn_orig_fx[i] is being used in Q_dn */ + temp2 = L_shr( temp2, scale_temp2 ); + temp1 = L_shr( temp1, scale_temp1 ); + dn[i] = L_add( temp1, temp2 ); // Q_dn move32(); temp_fx = imult3216( dn[i], sign_fx[i] ); // Q_dn @@ -645,14 +680,14 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 3 ) ) { - Gn = add( Gn, i_mult( s[1], shr( dn_orig[m[1]], 1 ) ) ); // Q_dn -1 + Gn = add( Gn, i_mult( s[1], dn_orig[m[1]] ) ); // Q_dn Gd32 = Gd; move16(); Gd32 = L_add( Gd32, L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[1] ), alp[m[0] - m[1]] ) ) ); // Q6 - G = Gn; // Q_dn - 1 + G = Gn; // Q_dn move16(); - G1 = i_mult( G, s[1] ); // Q_dn-1 - G = i_mult( G, s[0] ); // Q_dn-1 + G1 = i_mult( G, s[1] ); // Q_dn + G = i_mult( G, s[0] ); // Q_dn track = track_order[q * nb_tracks + 2]; // Q0 move16(); @@ -661,7 +696,12 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { - dn[i] = L_shr( L_msu( L_msu0( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), 6 ); // Q_dn + temp1 = imult3216( Gd32, dn_orig[i] ); + temp2 = L_mult0( G, *alp_pos0 ); + temp3 = L_mult0( G1, *alp_pos1 ); + temp4 = L_sub( temp1, temp2 ); + temp4 = L_sub( temp4, temp3 ); + dn[i] = L_shr( temp4, 6 ); move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; @@ -677,15 +717,19 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 4 ) ) { - Gn = add( Gn, i_mult( s[2], shr( dn_orig[m[2]], 1 ) ) ); // Q_dn-1 + Gn = add( Gn, i_mult( s[2], dn_orig[m[2]] ) ); // Q_dn Gd32 = Gd; move16(); - Gd32 = L_add( Gd32, L_add( L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ) ) ); // Q6 - G = Gn; // Q_dn-1 + temp1 = alp[0]; + move32(); + temp2 = L_mult0( i_mult( shl( s[0], 1 ), s[2] ), alp[m[0] - m[2]] ); + temp3 = L_mult0( i_mult( shl( s[1], 1 ), s[2] ), alp[m[1] - m[2]] ); + Gd32 = L_add( Gd32, L_add( L_add( temp1, temp2 ), temp3 ) ); // Q6 + G = Gn; // Q_dn move16(); - G1 = i_mult( G, s[1] ); // Q_dn-1 - G2 = i_mult( G, s[2] ); // Q_dn-1 - G = i_mult( G, s[0] ); // Q_dn-1 + G1 = i_mult( G, s[1] ); // Q_dn + G2 = i_mult( G, s[2] ); // Q_dn + G = i_mult( G, s[0] ); // Q_dn track = track_order[q * nb_tracks + 3]; move16(); @@ -695,7 +739,15 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { - dn[i] = L_shr( L_msu( L_msu( L_msu( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), 6 ); // Q_dn + + temp1 = imult3216( Gd32, dn_orig[i] ); + temp2 = L_mult0( G, *alp_pos0 ); + temp3 = L_mult0( G1, *alp_pos1 ); + temp4 = L_mult0( G2, *alp_pos2 ); + temp5 = L_sub( temp1, temp2 ); + temp5 = L_sub( temp5, temp3 ); + temp5 = L_sub( temp5, temp4 ); + dn[i] = L_shr( temp5, 6 ); move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; @@ -717,16 +769,22 @@ void acelp_fast_fx( IF( GE_16( nb_pulse, 5 ) ) { - Gn = add( Gn, i_mult( s[3], shr( dn_orig[m[3]], 1 ) ) ); // Q_dn-1 + Gn = add( Gn, i_mult( s[3], dn_orig[m[3]] ) ); // Q_dn Gd32 = Gd; move16(); - Gd32 = L_add( Gd32, L_add( L_add( L_add( alp[0], L_mult0( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ) ), L_mult0( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ) ), L_mult0( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ) ) ); // Q6 + temp1 = alp[0]; + move32(); + temp2 = L_mult0( i_mult( shl( s[0], 1 ), s[3] ), alp[m[0] - m[3]] ); + temp3 = L_mult0( i_mult( shl( s[1], 1 ), s[3] ), alp[m[1] - m[3]] ); + temp4 = L_mult0( i_mult( shl( s[2], 1 ), s[3] ), alp[m[2] - m[3]] ); + + Gd32 = L_add( Gd32, L_add( L_add( L_add( temp1, temp2 ), temp3 ), temp4 ) ); // Q6 G = Gn; - move16(); // Q_dn-1 - G1 = i_mult( G, s[1] ); // Q_dn-1 - G2 = i_mult( G, s[2] ); // Q_dn-1 - G3 = i_mult( G, s[3] ); // Q_dn-1 - G = i_mult( G, s[0] ); // Q_dn-1 + move16(); // Q_dn + G1 = i_mult( G, s[1] ); // Q_dn + G2 = i_mult( G, s[2] ); // Q_dn + G3 = i_mult( G, s[3] ); // Q_dn + G = i_mult( G, s[0] ); // Q_dn IF( EQ_16( cdk_index, 6 ) ) { @@ -740,7 +798,16 @@ void acelp_fast_fx( FOR( i = track; i < L_subfr; i += nb_tracks ) { - dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); // Q_dn + temp1 = imult3216( Gd32, dn_orig[i] ); + temp2 = L_mult0( G, *alp_pos0 ); + temp3 = L_mult0( G1, *alp_pos1 ); + temp4 = L_mult0( G2, *alp_pos2 ); + temp5 = L_mult0( G3, *alp_pos3 ); + temp6 = L_sub( temp1, temp2 ); + temp6 = L_sub( temp6, temp3 ); + temp6 = L_sub( temp6, temp4 ); + temp6 = L_sub( temp6, temp5 ); + dn[i] = L_shr( temp6, 6 ); move32(); alp_pos0 += nb_tracks; alp_pos1 += nb_tracks; @@ -760,7 +827,16 @@ void acelp_fast_fx( FOR( i = 0; i < L_subfr; i++ ) { - dn[i] = L_shr( L_msu( L_msu( L_msu( L_msu( imult3216( Gd32, dn_orig[i] ), G, *alp_pos0 ), G1, *alp_pos1 ), G2, *alp_pos2 ), G3, *alp_pos3 ), 6 ); /*Q_dn*/ + temp1 = imult3216( Gd32, dn_orig[i] ); + temp2 = L_mult0( G, *alp_pos0 ); + temp3 = L_mult0( G1, *alp_pos1 ); + temp4 = L_mult0( G2, *alp_pos2 ); + temp5 = L_mult0( G3, *alp_pos3 ); + temp6 = L_sub( temp1, temp2 ); + temp6 = L_sub( temp6, temp3 ); + temp6 = L_sub( temp6, temp4 ); + temp6 = L_sub( temp6, temp5 ); + dn[i] = L_shr( temp6, 6 ); move16(); alp_pos0++; alp_pos1++; diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 00c7d28d7..22af9097d 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -403,14 +403,14 @@ void encod_gen_voic_fx( void encod_gen_voic_ivas_fx( Encoder_State *st_fx, /* i/o: state structure */ - const Word16 speech_fx[], /* i : input speech Q0*/ + const Word16 speech_fx[], /* i : input speech Qnew -1 */ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient Q12*/ const Word16 Es_pred_fx, /* i : predicted scaled innov. energy Q8*/ const Word16 *res_fx, /* i : residual signal Q_new*/ - Word16 *syn_fx, /* i/o: core synthesis Q_new*/ - Word16 *exc_fx, /* i/o: current non-enhanced excitation Q0*/ - Word16 *exc2_fx, /* i/o: current enhanced excitation Q0*/ + Word16 *syn_fx, /* i/o: core synthesis Q_new - 1*/ + Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/ + Word16 *exc2_fx, /* i/o: current enhanced excitation Q_new*/ Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe Q6*/ Word16 *voice_factors_fx, /* o : voicing factors Q15*/ Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q0*/ @@ -550,12 +550,12 @@ void encod_gen_voic_ivas_fx( Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/ - find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx, - res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); + find_targets_ivas_new_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx, + res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx ); q_h1 = sub( 14, norm_s( h1_fx[0] ) ); Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ - + Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); @@ -587,7 +587,7 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ - Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ + lp_select = lp_filt_exc_enc_ivas_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); @@ -646,7 +646,7 @@ void encod_gen_voic_ivas_fx( gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_o( Lgcode, &Overflow ); /* Q0 */ + gcode16 = round_fx_o( Lgcode, &Overflow ); hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, Q_new, L_SUBFR, 0 ); /* Q15 */ move16(); @@ -666,14 +666,30 @@ void encod_gen_voic_ivas_fx( * Update memory of the weighting filter *-----------------------------------------------------------------*/ + + /*At this point + xn has to be in Qnew + yn has to be in Qnew + y2_fx has to be in Q9 + gcode16 in Q_new + gain_pit_fx in Q14 + */ + Scale_sig( xn_fx, L_SUBFR, 1 ); + Scale_sig( y1_fx, L_SUBFR, 1 ); /* st_fx->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */ - Ltmp = L_mult0( gcode16, y2_fx[L_SUBFR - 1] ); /* Q9 */ - Ltmp = L_shl( Ltmp, add( 5, shift ) ); // Q_new+14+shift + Ltmp = L_mult0( gcode16, y2_fx[L_SUBFR - 1] ); + Ltmp = L_shl( Ltmp, add( 5, shift ) ); Ltmp = L_negate( Ltmp ); - Ltmp = L_mac( Ltmp, xn_fx[L_SUBFR - 1], 16384 /*Q14*/ ); // Q_new-1+15+shift - Ltmp = L_msu( Ltmp, y1_fx[L_SUBFR - 1], gain_pit_fx /*Q14*/ ); // Q_new-1+15+shift - Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); // Q_new+15 - hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ + Word32 Ltmp2 = L_mult0( xn_fx[L_SUBFR - 1], 16384 ); + Ltmp = L_add( Ltmp, Ltmp2 ); + Word32 Ltmp3 = L_mult0( y1_fx[L_SUBFR - 1], gain_pit_fx ); + Ltmp = L_sub( Ltmp, Ltmp3 ); + + /*Ltmp is in Q14 + Qnew here + We need memWo in Qnew -1 */ + + Ltmp = L_shl( Ltmp, sub( 1, shift ) ); // Q14 + Qnew + 1 + hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ move16(); IF( gain_preQ_fx != 0 ) { @@ -682,20 +698,20 @@ void encod_gen_voic_ivas_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* Contribution from AVQ layer */ - Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); /* Q2 + Q6 -> Q9*/ - Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); /* Q16 + Q_exc */ + Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); + Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); /* Compute exc2 */ - Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); /* Q0 */ - exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */ + Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); + exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); move16(); /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ - Ltmp = L_shl( Ltmp, 5 ); /* Q15 */ - Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */ + Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */ + Ltmp = L_shl( Ltmp, 5 ); /*Qnew + 9+ 1+5 */ + Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/ + Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/ + exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); move16(); } } @@ -708,11 +724,12 @@ void encod_gen_voic_ivas_fx( FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ - Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */ - Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 */ - Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /* Q15 */ - Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/ - exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); /* Q0 */ + /*gcode16 in Qnew*/ + Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */ + Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /*Qnew + 9+ 1+5 */ + Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /*Qnew + 14 + 1*/ + Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */ + exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); } } /*-----------------------------------------------------------------* @@ -729,7 +746,7 @@ void encod_gen_voic_ivas_fx( * Update A(z) filters *-----------------------------------------------------------------*/ - Syn_filt_s( 1, p_Aq_fx, M, &exc_fx[i_subfr_fx], &syn_fx[i_subfr_fx], L_SUBFR, hLPDmem->mem_syn, 1 ); + syn_filt_fx( 1, p_Aq_fx, M, &exc_fx[i_subfr_fx], &syn_fx[i_subfr_fx], L_SUBFR, hLPDmem->mem_syn, 1 ); p_Aw_fx += ( M + 1 ); p_Aq_fx += ( M + 1 ); diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 3cb2cc066..47338f743 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -549,6 +549,7 @@ void enc_pit_exc_ivas_fx( Word16 xn[PIT_EXC_L_SUBFR]; /* Target vector for pitch search */ Word16 xn2[PIT_EXC_L_SUBFR]; /* Target vector for codebook search */ Word16 h1[PIT_EXC_L_SUBFR + ( M + 1 )]; /* Impulse response vector */ + Word16 cn[PIT_EXC_L_SUBFR]; Word16 y1[PIT_EXC_L_SUBFR]; /* Filtered adaptive excitation */ Word16 code[2 * L_SUBFR]; /* Fixed codebook excitation */ Word16 y2[2 * L_SUBFR]; /* Filtered algebraic excitation */ @@ -561,7 +562,6 @@ void enc_pit_exc_ivas_fx( Word16 g_corr[10]; /* ACELP correlation values + gain pitch */ Word16 clip_gain, i; /* LSF clip gain and LP flag */ const Word16 *p_Aw, *p_Aq; /* pointer to LP filter coefficient vector */ - Word16 cn1[PIT_EXC_L_SUBFR], *cn; /* (Used only when L_subfr == L_SUBFR) Target vector in residual domain */ Word16 *pt_pitch; /* pointer to floating pitch */ Word16 L_subfr; Word16 cum_gpit, gpit_tmp; @@ -599,7 +599,7 @@ void enc_pit_exc_ivas_fx( move16(); Pitch_CT = GENERIC; move16(); - set16_fx( cn1, 0, PIT_EXC_L_SUBFR ); + set16_fx( cn, 0, PIT_EXC_L_SUBFR ); test(); test(); IF( st_fx->GSC_IVAS_mode > 0 && ( st_fx->GSC_noisy_speech || GT_32( st_fx->core_brate, GSC_H_RATE_STG ) ) ) @@ -709,13 +709,6 @@ void enc_pit_exc_ivas_fx( /*------------------------------------------------------------------* * ACELP subframe loop *------------------------------------------------------------------*/ - cn = NULL; - test(); - if ( EQ_16( L_subfr, L_SUBFR ) || EQ_16( L_subfr, L_SUBFR * 2 ) ) - { - cn = cn1; - move16(); - } p_Aw = Aw; p_Aq = Aq; @@ -733,7 +726,7 @@ void enc_pit_exc_ivas_fx( Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */ /* condition on target (compared to float) has been put outside the loop */ - find_targets_ivas_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq, + find_targets_ivas_new_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq, res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); q_h1 = sub( 14, norm_s( h1[0] ) ); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 6414a81b6..58c1f9641 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -696,6 +696,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( move16(); Word16 win_len[2]; move16(); + Word16 shift; set32_fx( buf_powerSPec, 0, N_MAX + L_MDCT_OVLP_MAX ); set16_fx( buf_powerSPec_exp, 0, N_MAX + L_MDCT_OVLP_MAX ); @@ -986,7 +987,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outter left folding */ FOR( i = 0; i < folding_offset; i++ ) { - tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win + tcx20Win[folding_offset + i] = sub( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win move16(); } @@ -1001,16 +1002,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } } @@ -1019,7 +1018,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = shr( right_overlap, 1 ); FOR( i = 0; i < tmp; i++ ) { - tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win + tcx20Win[L_subframe + folding_offset - 1 - i] = add( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win move16(); } @@ -1031,7 +1030,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmpP32 = hTcxEnc->spectrum_fx[frameno]; assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); Word16 len[2], exp[2]; - hTcxEnc->spectrum_e[frameno] = 16; + hTcxEnc->spectrum_e[frameno] = sub( 16, q_tcx20Win ); exp[0] = exp[1] = hTcxEnc->spectrum_e[frameno]; move16(); move16(); @@ -1078,11 +1077,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( FOR( i = 0; i < 2; i++ ) { - Scale_sig32( hTcxEnc->spectrum_fx[frameno] + i * L_subframe, len[i], sub( exp[i], hTcxEnc->spectrum_e[frameno] ) ); + scale_sig32( hTcxEnc->spectrum_fx[frameno] + i * L_subframe, len[i], sub( exp[i], hTcxEnc->spectrum_e[frameno] ) ); } - - hTcxEnc->spectrum_e[frameno] = sub( hTcxEnc->spectrum_e[frameno], q_tcx20Win ); - move16(); } ELSE /* transform_type[frameno] != TCX_5 */ { @@ -1126,16 +1122,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 + q_tcx20Win - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } } @@ -1225,12 +1219,13 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( frameno == 0 && overlap_mode[0] == FULL_OVERLAP && GT_16( sub( L_subframe, left_overlap ), minWindowLen ) ) { tmp = shr( st->hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ); + shift = sub( q_mdstWin, add( Q16, st->q_inp ) ); Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp - L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin + L_tmp = L_shl( L_tmp, shift ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } @@ -1238,7 +1233,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp - L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin + L_tmp = L_shl( L_tmp, shift ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } @@ -1313,11 +1308,12 @@ void core_signal_analysis_high_bitrate_ivas_fx( { tmp = shr( st->hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ); Word32 L_tmp; + shift = sub( q_mdstWin, add( Q16, st->q_inp ) ); FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp - L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin + L_tmp = L_shl( L_tmp, shift ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } @@ -1325,7 +1321,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp - L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin + L_tmp = L_shl( L_tmp, shift ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index 16ec45c78..ddcb3ff9b 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -3,7 +3,7 @@ ====================================================================================*/ #include #include "options.h" /* Compilation switches */ -//#include "prot_fx.h" /* Function prototypes */ +// #include "prot_fx.h" /* Function prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "cnst.h" /* Common constants */ @@ -293,3 +293,136 @@ void find_targets_ivas_fx( return; } + +void find_targets_ivas_new_fx( + const Word16 *speech, /* i : pointer to the speech frame Q_new-1*/ + const Word16 *mem_syn, /* i : memory of the synthesis filter Q_new-1*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + Word16 *mem_w0, /* i/o: weighting filter denominator memory Q_new-1*/ + const Word16 *p_Aq, /* i : interpolated quantized A(z) filter Q12*/ + const Word16 *res, /* i : residual signal Q_new*/ + const Word16 L_subfr, /* i : length of vectors for gain quantization Q0*/ + const Word16 *Ap, /* i : unquantized A(z) filter with bandwidth expansion Q12*/ + Word16 tilt_fac, /* i : tilt factor Q15*/ + Word16 *xn, /* o : Close-loop Pitch search target vector Q_new-1*/ + Word16 *cn, /* o : target vector in residual domain Q_new*/ + Word16 *h1 /* o : impulse response of weighted synthesis filter Q(14 - norm_s(h1[0]))*/ +) +{ + Word16 i; + Word16 temp[M + 6 * L_SUBFR]; /* error of quantization */ + Word16 scale, scaleq, j, d, s, s2, tmp; + Word16 Aqs[M + 1]; + Word32 h1_32[6 * L_SUBFR]; + Word16 sf; + Word64 Ltmp64; +#ifdef BASOP_NOGLOB_DECLARE_LOCAL + Flag Overflow = 0; + move16(); +#endif + /*------------------------------------------------------------------------* + * Find the target vector for excitation search: + * + * |------| res[n] + * speech[n]---| A(z) |-------- + * |------| | |--------| error[n] |------| + * zero -- (-)--| 1/A(z) |-----------| W(z) |-- target + * exc |--------| |------| + * + * Instead of subtracting the zero-input response of filters from + * the weighted input speech, the above configuration is used to + * compute the target vector. + *-----------------------------------------------------------------------*/ + FOR( i = 0; i < M; i++ ) + { + temp[i] = sub_sat( speech[i + i_subfr - M], mem_syn[i] ); /* Q_new - 1 */ + move16(); + } + + syn_filt_fx( 1, p_Aq, M, &res[i_subfr], temp + M, L_subfr, temp, 0 ); + + Residu3_fx( Ap, temp + M, xn, L_subfr, 0 ); /* xn in Q_new - 1 */ + + deemph_fx( xn, tilt_fac, L_subfr, mem_w0 ); /* xn in Q_new - 1 */ + + + /*-----------------------------------------------------------------* + * Find target in residual domain (cn[]) for innovation search + *--------------------------------------------------------------*/ + IF( cn != NULL ) + { + /* first half: xn[] --> cn[] */ + temp[0] = 0; + move16(); + preemph_copy_fx( xn, cn, tilt_fac, L_SUBFR / 2, temp ); + syn_filt_s_lc_fx( 1, Ap, cn, temp, L_SUBFR / 2 ); /* Q-1 -> Q-2 */ + Residu3_lc_fx( p_Aq, M, temp, cn, L_SUBFR / 2, 1 ); /* Q-2 -> Q-1 */ + Scale_sig( cn, L_SUBFR / 2, 1 ); + + /* second half: res[] --> cn[] (approximated and faster) */ + Copy( &res[i_subfr + ( L_SUBFR / 2 )], cn + ( L_SUBFR / 2 ), L_SUBFR / 2 ); + } + + /*---------------------------------------------------------------* + * Compute impulse response, h1[], of weighted synthesis filter * + *---------------------------------------------------------------*/ + + scale = norm_s( Ap[0] ); + scaleq = norm_s( p_Aq[0] ); + d = sub( scaleq, scale ); + IF( d >= 0 ) + { + Copy( p_Aq, Aqs, M + 1 ); /* Q12 */ + s = add( scaleq, 1 ); + s2 = shr( 16384, d ); + } + ELSE + { + Copy_Scale_sig( p_Aq, Aqs, M + 1, d ); /* Q12 */ + s = add( scale, 1 ); + s2 = 16384; + move16(); + } + + set32_fx( h1_32, 0, L_subfr ); + Overflow = 0; + move16(); + FOR( i = 0; i < M; i++ ) + { + Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */ + FOR( j = 1; j <= i; j++ ) + { + Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ + } + h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */ + move32(); + } + + Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */ + FOR( j = 1; j <= M; j++ ) + { + Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ + } + h1_32[M] = W_extract_l( Ltmp64 ); /* Q27 */ + move32(); + + FOR( i = M + 1; i < L_subfr; i++ ) + { + Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_o( h1_32[i - 1], s, &Overflow ) ) ); /* Q27 */ + FOR( j = 2; j <= M; j++ ) + { + Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */ + } + h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */ + move32(); + } + + sf = sub( L_norm_arr( h1_32, L_subfr ), 1 ); + Copy_Scale_sig32_16( h1_32, h1, L_subfr, sf ); // Q11 + sf + + tmp = 0; + move16(); + Deemph2( h1, tilt_fac, L_subfr, &tmp ); // Q11 + sf - 1 + + return; +} \ No newline at end of file diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 1a3d2cb56..2bfb87a2e 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -439,8 +439,8 @@ void encod_audio_ivas_fx( move16(); T0_frac_tmp = 0; move16(); - Copy( hLPDmem->mem_syn, hGSCEnc->mem_syn_tmp_fx, M ); - hGSCEnc->mem_w0_tmp_fx = hLPDmem->mem_w0; + Copy_Scale_sig( hLPDmem->mem_syn, hGSCEnc->mem_syn_tmp_fx, M, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); + Copy_Scale_sig( &hLPDmem->mem_w0, &hGSCEnc->mem_w0_tmp_fx, 1, sub( sub( Q_new, 1 ), hLPDmem->q_mem_syn ) ); move16(); Es_pred = 0; move16(); @@ -763,8 +763,8 @@ void encod_audio_ivas_fx( /*--------------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------------*/ - - hLPDmem->mem_w0 = hGSCEnc->mem_w0_tmp_fx; /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */ + Copy_Scale_sig(&hGSCEnc->mem_w0_tmp_fx, &hLPDmem->mem_w0, 1, sub(hLPDmem->q_mem_syn , sub(Q_new , 1))); + /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */ move16(); Copy( exc_wo_nf, exc, st_fx->L_frame ); /* Q_new */ diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index e47b14559..a1fdae804 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -420,19 +420,16 @@ Word16 inov_encode_ivas_fx( { acelpautoc = 1; move16(); - + Word16 q_h1 = sub(14, norm_s(h2[0])); + Scale_sig(h2, L_SUBFR, sub(11, q_h1)); /* set h2[] in Q11*/ cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_SUBFR ); /* h2: Q11, Rw: (Rw_e)Q */ - // Word16 Rw_e = E_ACELP_hh_corr( h2, Rw, L_SUBFR, 3 ); corr_hh_ivas_fx( h2, Rw, &Rw_q, L_subfr ); // Q(Rw) = Q11-2 - E_ACELP_conv_ivas_fx( xn2, h2, cn ); // Qcn = Qxn2 /* dn_e -> Rw_e*Q_xn */ - // Scale_sig(Rw, L_SUBFR, sub(5, Rw_e)); //Q9 j = E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); Qdn = add( add( Qxn, Rw_q ), add( j, 1 ) ); - // Scale_sig(Rw, L_subfr, -3); //Q9->Q6 } ELSE { @@ -441,7 +438,8 @@ Word16 inov_encode_ivas_fx( updt_tar_fx( cn, cn, &exc[i_subfr], gain_pit, L_subfr ); /* scaling of cn[] to limit dynamic at 12 bits */ Scale_sig( cn, L_subfr, shift ); - + Word16 q_h1 = sub(14, norm_s(h2[0])); + Scale_sig(h2, L_SUBFR, sub(11, q_h1)); /* set h2[] in Q11*/ cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); corr_xh_ivas_fx( xn2, Qxn, dn, &Qdn, h2, L_subfr ); // Q(dn) = Q_new+1 } @@ -609,7 +607,7 @@ Word16 inov_encode_ivas_fx( } ELSE { - acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, h2, code, y2, L_subfr ); + acelp_fast_fx( hBstr, nBits, dn, Qdn, cn,Q_new, h2, code, y2, L_subfr ); } } ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) ) @@ -620,7 +618,7 @@ Word16 inov_encode_ivas_fx( } ELSE { - acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, h2, code, y2, L_SUBFR ); + acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn,Q_new, h2, code, y2, L_SUBFR ); } } ELSE diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 1e7a13d45..3c62a0d18 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -444,13 +444,6 @@ ivas_error ivas_core_enc_fx( st->hTcxEnc->exp_buf_speech_ltp = st->exp_buf_speech_enc; move16(); } - - Scale_sig( st->input_fx, input_frame, negate( st->q_inp ) ); // Q0 - Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0 - st->q_old_inp = 0; - move16(); - st->q_inp = 0; - move16(); } Word16 Q_spec_old[2], L_spec; Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e; @@ -623,11 +616,6 @@ ivas_error ivas_core_enc_fx( { st = sts[n]; - Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0 - Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); // Q0 - st->q_old_inp = st->q_inp = 0; - move16(); - move16(); IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( negate( 1 ), st->Q_old_wtda ) ); // Q(-1) diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index a1f2196fb..2e09c42ed 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -221,12 +221,12 @@ ivas_error ivas_corecoder_enc_reconfig_fx( { FOR( k = 0; k < nSCE_old; k++ ) { - shift = getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->old_input_signal_fx, input_frame ); + shift = sub( getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->old_input_signal_fx, input_frame ), Q1 ); Scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->old_input_signal_fx, input_frame, shift ); /* st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp + shift */ st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp = add( st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp, shift ); move16(); q_com_sce = s_min( q_com_sce, st_ivas->hSCE[k]->hCoreCoder[0]->q_old_inp ); - shift = getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ); + shift = sub( getScaleFactor16( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 ); Scale_sig( st_ivas->hSCE[k]->hCoreCoder[0]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift ); /* st_ivas->hSCE[k]->hCoreCoder[0]->q_inp + shift */ st_ivas->hSCE[k]->hCoreCoder[0]->q_inp = add( st_ivas->hSCE[k]->hCoreCoder[0]->q_inp, shift ); move16(); @@ -241,12 +241,12 @@ ivas_error ivas_corecoder_enc_reconfig_fx( { FOR( n = 0; n < CPE_CHANNELS; n++ ) { - shift = getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_input_signal_fx, input_frame ); + shift = sub( getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_input_signal_fx, input_frame ), Q1 ); Scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_input_signal_fx, input_frame, shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp + shift */ st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp = add( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp, shift ); move16(); q_com_cpe = s_min( q_com_cpe, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_old_inp ); - shift = getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ); + shift = sub( getScaleFactor16( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ) ), Q1 ); Scale_sig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_fx, sub( L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), input_frame ), shift ); /* st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp + shift */ st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp = add( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->q_inp, shift ); move16(); diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index d0a91a098..e744c7f47 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -466,13 +466,14 @@ static void kernel_switch_update_transforms_fx( { Word16 tmp = shr( hTcxCfg->tcx_mdct_window_min_lengthFB, 1 ); Word32 L_tmp; + Word16 shift = sub( *q_windowedTimeSignal, add( Q16, q_speech ) ); IF( GE_32( kernelType, MDCT_II ) ) { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal + L_tmp = L_shl( L_tmp, shift ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -480,7 +481,7 @@ static void kernel_switch_update_transforms_fx( { L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal + L_tmp = L_shl( L_tmp, shift ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -491,7 +492,7 @@ static void kernel_switch_update_transforms_fx( { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal + L_tmp = L_shl( L_tmp, shift ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -499,7 +500,7 @@ static void kernel_switch_update_transforms_fx( { L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal + L_tmp = L_shl( L_tmp, shift ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 2e365be47..1346d634b 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -253,7 +253,7 @@ void stereo_mdct_core_enc_fx( Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); - q_com = s_min( 0, q_com ); + q_com = sub( q_com, Q1 ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; @@ -275,8 +275,8 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); - Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* Q0 */ - Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* Q0 */ + scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* q_com */ + scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* q_com */ sts[ch]->q_old_inp = q_com; move16(); sts[ch]->q_inp = q_com; diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 8dbd4731c..fd84d2f21 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -205,7 +205,7 @@ void stereo_tcx_core_enc( /*HM*/ Word16 indexBuffer[2 * ( ( N_MAX / 2 ) + 1 )]; - Word16 s, input_frame; + Word16 s; CONTEXT_HM_CONFIG hm_cfg[2]; @@ -377,13 +377,6 @@ void stereo_tcx_core_enc( Q_new = 0; move16(); - input_frame = idiv1616U( extract_l( L_shr( st->input_Fs, 1 ) ), FRAMES_PER_SEC / 2 ); - Scale_sig( st->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( st->q_inp ) ); - Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); - st->q_old_inp = 0; - move16(); - st->q_inp = 0; - move16(); core_signal_analysis_high_bitrate_ivas_fx( p_new_samples, T_op, lsp_new_fx, lsp_mid_fx, st, tnsSize, tnsBits, param_core, <pBits, NULL, st->L_frame, hTcxEnc->L_frameTCX, last_element_mode, vad_hover_flag, NULL, NULL, &Q_new, NULL ); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 64402bf3c..a14f134ee 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2321,6 +2321,21 @@ void find_targets_ivas_fx( Word16 *h1 /* o : impulse response of weighted synthesis filter Q(14 - norm_s(h1[0]))*/ ); +void find_targets_ivas_new_fx( + const Word16 *speech, /* i : pointer to the speech frame Q_new-1*/ + const Word16 *mem_syn, /* i : memory of the synthesis filter Q_new-1*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + Word16 *mem_w0, /* i/o: weighting filter denominator memory Q_new-1*/ + const Word16 *p_Aq, /* i : interpolated quantized A(z) filter Q12*/ + const Word16 *res, /* i : residual signal Q_new*/ + const Word16 L_subfr, /* i : length of vectors for gain quantization Q0*/ + const Word16 *Ap, /* i : unquantized A(z) filter with bandwidth expansion Q12*/ + Word16 tilt_fac, /* i : tilt factor Q15*/ + Word16 *xn, /* o : Close-loop Pitch search target vector Q_new-1*/ + Word16 *cn, /* o : target vector in residual domain Q_new*/ + Word16 *h1 /* o : impulse response of weighted synthesis filter Q(14 - norm_s(h1[0]))*/ +); + void E_ACELP_adaptive_codebook( Word16 *exc, /* i : pointer to the excitation frame Q_new */ Word16 T0, /* i : integer pitch lag Q0 */ diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 214522126..fc6994139 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -550,13 +550,13 @@ Word16 pvq_core_enc_ivas_fx( get_max_pulses_fx( sfm_start, sfm_end, ord, npulses, nb_sfm, pulse_vector, maxpulse ); /* Fine gain prediction */ - ivas_fine_gain_pred_fx( sfm_start, sfm_end, sfmsize, ord, npulses, maxpulse, R, nb_sfm, + fine_gain_pred_fx( sfm_start, sfm_end, sfmsize, ord, npulses, maxpulse, R, nb_sfm, coefs_quant, pulse_vector, fg_pred, core ); - fine_gain_quant_ivas_fx( hBstr, ord, nb_sfm, gain_bits_array, fg_pred, gopt ); + fine_gain_quant_fx( hBstr, ord, nb_sfm, gain_bits_array, fg_pred, gopt ); apply_gain_fx( ord, sfm_start, sfm_end, nb_sfm, fg_pred, coefs_quant ); - *Q_coefs = 11; + *Q_coefs = 12; move16(); return add( pvq_bits, gain_bits_tot ); } -- GitLab From f05dc3869e93813322efa50e91cfb1d16aa8b137 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 7 Apr 2025 10:04:43 +0530 Subject: [PATCH 319/358] Clang formatting changes --- lib_com/ivas_prot_fx.h | 4 ++-- lib_enc/enc_pit_exc_fx.c | 28 ++++++++++++++-------------- lib_enc/find_tar_fx.c | 2 +- lib_enc/gs_enc_fx.c | 2 +- lib_enc/inov_enc_fx.c | 14 +++++++------- lib_enc/prot_fx_enc.h | 24 ++++++++++++------------ lib_enc/pvq_core_enc_fx.c | 2 +- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 036d546bc..8da9cd9ac 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3002,8 +3002,8 @@ void acelp_fast_fx( Word16 Q_dn, const Word16 cn[L_SUBFR], /* i : residual after long term prediction */ // q_cn - const Word16 q_cn, - const Word16 H[L_SUBFR], + const Word16 q_cn, + const Word16 H[L_SUBFR], /* i : impulse response of weighted synthesis filter */ // e(norm_s(H[0])+1) Word16 code[L_SUBFR], /* o : algebraic (fixed) codebook excitation */ Word16 y[], /* o : filtered fixed codebook excitation */ diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 47338f743..9180d73b8 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -550,19 +550,19 @@ void enc_pit_exc_ivas_fx( Word16 xn2[PIT_EXC_L_SUBFR]; /* Target vector for codebook search */ Word16 h1[PIT_EXC_L_SUBFR + ( M + 1 )]; /* Impulse response vector */ Word16 cn[PIT_EXC_L_SUBFR]; - Word16 y1[PIT_EXC_L_SUBFR]; /* Filtered adaptive excitation */ - Word16 code[2 * L_SUBFR]; /* Fixed codebook excitation */ - Word16 y2[2 * L_SUBFR]; /* Filtered algebraic excitation */ - Word16 voice_fac; /* Voicing factor */ - Word32 gain_code; /* Gain of code */ - Word16 gain_inov; /* inovation gain */ - Word16 gain_pit; /* Pitch gain */ - Word16 pit_idx, i_subfr; /* tmp variables */ - Word16 T0_min, T0_max; /* pitch variables */ - Word16 g_corr[10]; /* ACELP correlation values + gain pitch */ - Word16 clip_gain, i; /* LSF clip gain and LP flag */ - const Word16 *p_Aw, *p_Aq; /* pointer to LP filter coefficient vector */ - Word16 *pt_pitch; /* pointer to floating pitch */ + Word16 y1[PIT_EXC_L_SUBFR]; /* Filtered adaptive excitation */ + Word16 code[2 * L_SUBFR]; /* Fixed codebook excitation */ + Word16 y2[2 * L_SUBFR]; /* Filtered algebraic excitation */ + Word16 voice_fac; /* Voicing factor */ + Word32 gain_code; /* Gain of code */ + Word16 gain_inov; /* inovation gain */ + Word16 gain_pit; /* Pitch gain */ + Word16 pit_idx, i_subfr; /* tmp variables */ + Word16 T0_min, T0_max; /* pitch variables */ + Word16 g_corr[10]; /* ACELP correlation values + gain pitch */ + Word16 clip_gain, i; /* LSF clip gain and LP flag */ + const Word16 *p_Aw, *p_Aq; /* pointer to LP filter coefficient vector */ + Word16 *pt_pitch; /* pointer to floating pitch */ Word16 L_subfr; Word16 cum_gpit, gpit_tmp; Word32 Local_BR, Pitch_BR; @@ -727,7 +727,7 @@ void enc_pit_exc_ivas_fx( /* condition on target (compared to float) has been put outside the loop */ find_targets_ivas_new_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq, - res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); + res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); q_h1 = sub( 14, norm_s( h1[0] ) ); Copy_Scale_sig( h1, h2, L_subfr, sub( 11, q_h1 ) ); /*Q11*/ diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index ddcb3ff9b..4f24ec39f 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -425,4 +425,4 @@ void find_targets_ivas_new_fx( Deemph2( h1, tilt_fac, L_subfr, &tmp ); // Q11 + sf - 1 return; -} \ No newline at end of file +} diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 2bfb87a2e..77470c255 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -763,7 +763,7 @@ void encod_audio_ivas_fx( /*--------------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------------*/ - Copy_Scale_sig(&hGSCEnc->mem_w0_tmp_fx, &hLPDmem->mem_w0, 1, sub(hLPDmem->q_mem_syn , sub(Q_new , 1))); + Copy_Scale_sig( &hGSCEnc->mem_w0_tmp_fx, &hLPDmem->mem_w0, 1, sub( hLPDmem->q_mem_syn, sub( Q_new, 1 ) ) ); /*_DIFF_FLOAT_FIX_ The way it is written in the original fix point is that at this point mem_w0 falls back to its original value (before enc_pit_exc, seems not the case in float */ move16(); Copy( exc_wo_nf, exc, st_fx->L_frame ); /* Q_new */ diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index a1fdae804..fe22ee398 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -420,12 +420,12 @@ Word16 inov_encode_ivas_fx( { acelpautoc = 1; move16(); - Word16 q_h1 = sub(14, norm_s(h2[0])); - Scale_sig(h2, L_SUBFR, sub(11, q_h1)); /* set h2[] in Q11*/ + Word16 q_h1 = sub( 14, norm_s( h2[0] ) ); + Scale_sig( h2, L_SUBFR, sub( 11, q_h1 ) ); /* set h2[] in Q11*/ cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_SUBFR ); /* h2: Q11, Rw: (Rw_e)Q */ corr_hh_ivas_fx( h2, Rw, &Rw_q, L_subfr ); // Q(Rw) = Q11-2 - E_ACELP_conv_ivas_fx( xn2, h2, cn ); // Qcn = Qxn2 + E_ACELP_conv_ivas_fx( xn2, h2, cn ); // Qcn = Qxn2 /* dn_e -> Rw_e*Q_xn */ j = E_ACELP_toeplitz_mul_fx( Rw, cn, dn, L_SUBFR, 1 ); @@ -438,8 +438,8 @@ Word16 inov_encode_ivas_fx( updt_tar_fx( cn, cn, &exc[i_subfr], gain_pit, L_subfr ); /* scaling of cn[] to limit dynamic at 12 bits */ Scale_sig( cn, L_subfr, shift ); - Word16 q_h1 = sub(14, norm_s(h2[0])); - Scale_sig(h2, L_SUBFR, sub(11, q_h1)); /* set h2[] in Q11*/ + Word16 q_h1 = sub( 14, norm_s( h2[0] ) ); + Scale_sig( h2, L_SUBFR, sub( 11, q_h1 ) ); /* set h2[] in Q11*/ cb_shape_fx( 1, 1, 0, sharpFlag, 0, g1, g2, p_Aq, h2, tilt_code, shr( add( pt_pitch, 26 ), 6 ), 0, L_subfr ); corr_xh_ivas_fx( xn2, Qxn, dn, &Qdn, h2, L_subfr ); // Q(dn) = Q_new+1 } @@ -607,7 +607,7 @@ Word16 inov_encode_ivas_fx( } ELSE { - acelp_fast_fx( hBstr, nBits, dn, Qdn, cn,Q_new, h2, code, y2, L_subfr ); + acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, Q_new, h2, code, y2, L_subfr ); } } ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) ) @@ -618,7 +618,7 @@ Word16 inov_encode_ivas_fx( } ELSE { - acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn,Q_new, h2, code, y2, L_SUBFR ); + acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, Q_new, h2, code, y2, L_SUBFR ); } } ELSE diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index a14f134ee..95bcb70d2 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2322,18 +2322,18 @@ void find_targets_ivas_fx( ); void find_targets_ivas_new_fx( - const Word16 *speech, /* i : pointer to the speech frame Q_new-1*/ - const Word16 *mem_syn, /* i : memory of the synthesis filter Q_new-1*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - Word16 *mem_w0, /* i/o: weighting filter denominator memory Q_new-1*/ - const Word16 *p_Aq, /* i : interpolated quantized A(z) filter Q12*/ - const Word16 *res, /* i : residual signal Q_new*/ - const Word16 L_subfr, /* i : length of vectors for gain quantization Q0*/ - const Word16 *Ap, /* i : unquantized A(z) filter with bandwidth expansion Q12*/ - Word16 tilt_fac, /* i : tilt factor Q15*/ - Word16 *xn, /* o : Close-loop Pitch search target vector Q_new-1*/ - Word16 *cn, /* o : target vector in residual domain Q_new*/ - Word16 *h1 /* o : impulse response of weighted synthesis filter Q(14 - norm_s(h1[0]))*/ + const Word16 *speech, /* i : pointer to the speech frame Q_new-1*/ + const Word16 *mem_syn, /* i : memory of the synthesis filter Q_new-1*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + Word16 *mem_w0, /* i/o: weighting filter denominator memory Q_new-1*/ + const Word16 *p_Aq, /* i : interpolated quantized A(z) filter Q12*/ + const Word16 *res, /* i : residual signal Q_new*/ + const Word16 L_subfr, /* i : length of vectors for gain quantization Q0*/ + const Word16 *Ap, /* i : unquantized A(z) filter with bandwidth expansion Q12*/ + Word16 tilt_fac, /* i : tilt factor Q15*/ + Word16 *xn, /* o : Close-loop Pitch search target vector Q_new-1*/ + Word16 *cn, /* o : target vector in residual domain Q_new*/ + Word16 *h1 /* o : impulse response of weighted synthesis filter Q(14 - norm_s(h1[0]))*/ ); void E_ACELP_adaptive_codebook( diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index fc6994139..356f2beaf 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -551,7 +551,7 @@ Word16 pvq_core_enc_ivas_fx( /* Fine gain prediction */ fine_gain_pred_fx( sfm_start, sfm_end, sfmsize, ord, npulses, maxpulse, R, nb_sfm, - coefs_quant, pulse_vector, fg_pred, core ); + coefs_quant, pulse_vector, fg_pred, core ); fine_gain_quant_fx( hBstr, ord, nb_sfm, gain_bits_array, fg_pred, gopt ); -- GitLab From 44cd194eb3ae5b774cdf0eff230d8a00ea2581ff Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Apr 2025 09:03:05 +0530 Subject: [PATCH 320/358] Precision improvements in mdct core enc --- lib_com/ivas_spar_com_fx.c | 181 ++++++++++--------------- lib_enc/ext_sig_ana_fx.c | 105 ++++++++------ lib_enc/ivas_mdct_core_enc_fx.c | 53 ++++---- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 14 +- lib_enc/prot_fx_enc.h | 3 +- lib_enc/tcx_utils_enc_fx.c | 6 +- 6 files changed, 176 insertions(+), 186 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 317ea0249..0da6b90c2 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -51,24 +51,16 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define IVAS_FLT_EPS ( 1e-10F ) -#define IVAS_FIX_EPS ( 1 ) -#define IVAS_DBL_EPS ( (double) 1e-20 ) +#define IVAS_FIX_EPS ( 1 ) +#define IVAS_FIX_EPS_Q40 ( 110 ) -#define IVAS_REMIX_MULT_FAC ( 0.5f ) -#define IVAS_ACTIVEW_DM_F ( 1.0f ) #define IVAS_ACTIVEW_DM_F_Q30 ( ONE_IN_Q30 ) /*1 Q30*/ -#define IVAS_ACTIVEW_DM_F_DTX ( 0.25f ) -#define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ -#define IVAS_ACTIVEW_DM_F_VLBR ( 0.25f ) -#define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ -#define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH ( 3.0f ) +#define IVAS_ACTIVEW_DM_F_DTX_Q30 ( 268435456 ) /*0.25 Q30*/ +#define IVAS_ACTIVEW_DM_F_VLBR_Q30 ( 268435456 ) /*0.25 Q30*/ #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH_Q29 ( 1610612736 ) /*3 Q29*/ -#define IVAS_P_NORM_SCALING ( 1.0f ) #define IVAS_P_NORM_SCALING_FX ( ONE_IN_Q31 ) // 1 Q31 -#define IVAS_P_NORM_SCALING_DTX ( 0.75f ) #define IVAS_P_NORM_SCALING_DTX_FX ( 1610612736 ) // 0.75 Q31 #define IVAS_MAT_DIM_3 ( 3 ) @@ -1626,8 +1618,18 @@ static void ivas_get_Wscaling_factor_enc_fx( ivas_calc_post_pred_per_band_enc_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, b, postpred_cov_re, &q_postpred_cov_re ); } - Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], L_max( postpred_cov_re[0][0], IVAS_FIX_EPS ), &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) - q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); + tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_postpred_cov_re, 40 ) ); + + IF( LE_32( postpred_cov_re[0][0], tmp ) ) + { + Gw_sq = Mpy_32_32( cov_real[0][0][b], 1250000000 ); /*1/1e-10 = 1250000000 Q(-4)*/ + q_Gw_sq = add( q_cov_real[0][0][b], -4 - 31 ); + } + ELSE + { + Gw_sq = BASOP_Util_Divide3232_Scale( cov_real[0][0][b], postpred_cov_re[0][0], &tmp_exp ); // 15-(tmp_exp-(q_cov_real[0][0][b]- q_postpred_cov_re)) + q_Gw_sq = add( sub( 15, tmp_exp ), sub( q_cov_real[0][0][b], q_postpred_cov_re ) ); + } shift = MAX16B; move16(); @@ -1992,12 +1994,15 @@ static void ivas_calc_post_pred_per_band_enc_fx( Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], /*q_postpred_cov_re*/ Word16 *q_postpred_cov_re ) { - Word16 i, j, k, guard_bits, tmp, q_temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], q_tmp_re, q_W_tmp; + Word16 i, j, k; Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - Word32 max_val; - Word64 tmp_re, W_tmp; - Word16 q_postpred_cov_re_per_value[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 temp_mat_e[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 q_postpred_cov_re_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word16 min_val; + Word32 tmp_re; + Word16 tmp_q; + Word16 tmp_e; FOR( i = 0; i < num_ch; i++ ) { @@ -2014,135 +2019,71 @@ static void ivas_calc_post_pred_per_band_enc_fx( set32_fx( postpred_cov_re[i], 0, num_ch ); } - max_val = 1; - move32(); + min_val = MAX16B; + move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < num_ch; j++ ) { - tmp_re = 0; - move64(); - q_tmp_re = 31; + temp_mat[i][j] = 0; + move32(); + temp_mat_e[i][j] = 0; move16(); FOR( k = 0; k < num_ch; k++ ) { - W_tmp = W_shr( W_mult0_32_32( cov_real[i][k][band_idx], dmx_mat_conj[k][j] ), q_mixer_mat ); /*q_cov_real[i][k][band_idx]*/ - IF( LT_16( q_cov_real[i][k][band_idx], q_tmp_re ) ) - { - tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_cov_real[i][k][band_idx] ) ), W_tmp ); /*q_cov_real[i][k][band_idx]*/ - q_tmp_re = q_cov_real[i][k][band_idx]; - move16(); - } - ELSE + tmp_re = 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 ) { - tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_cov_real[i][k][band_idx], q_tmp_re ) ) ); /*q_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(); } } - IF( tmp_re == 0 ) - { - q_temp_mat[i][j] = 31; - move16(); - temp_mat[i][j] = 0; - move32(); - } - ELSE - { - q_temp_mat[i][j] = q_tmp_re; - move16(); - q_tmp_re = W_norm( tmp_re ); - temp_mat[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /*q_temp_mat[i][j]+ q_tmp_re -32*/ - move32(); - q_temp_mat[i][j] = sub( add( q_temp_mat[i][j], q_tmp_re ), 32 ); - move16(); - } - max_val = L_max( max_val, L_abs( temp_mat[i][j] ) ); } } - guard_bits = find_guarded_bits_fx( num_ch ); - - tmp = norm_l( max_val ); - IF( LT_16( tmp, guard_bits ) ) - { - guard_bits = sub( guard_bits, tmp ); - } - ELSE - { - guard_bits = 0; - move16(); - } - - *q_postpred_cov_re = 31; - move16(); /* num_ch x num_ch mult */ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { - tmp_re = 0; - move64(); - q_tmp_re = 31; + q_postpred_cov_re_buf[i][j] = *q_postpred_cov_re; move16(); FOR( k = 0; k < num_ch; k++ ) { - W_tmp = W_shr( W_mult0_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ), guard_bits ); // q_temp_mat[k][j]+ q_mixer_mat-guard_bits - q_W_tmp = sub( add( q_temp_mat[k][j], q_mixer_mat ), guard_bits ); - IF( LT_16( q_W_tmp, q_tmp_re ) ) + tmp_re = Mpy_32_32( mixer_mat[i][k][band_idx], temp_mat[k][j] ); + tmp_q = sub( q_mixer_mat, temp_mat_e[k][j] ); + IF( tmp_re ) { - tmp_re = W_add( W_shr( tmp_re, sub( q_tmp_re, q_W_tmp ) ), W_tmp ); // q_W_tmp - q_tmp_re = q_W_tmp; + tmp_e = sub( 31, q_postpred_cov_re_buf[i][j] ); + postpred_cov_re[i][j] = BASOP_Util_Add_Mant32Exp( postpred_cov_re[i][j], tmp_e, tmp_re, sub( Q31, tmp_q ), &tmp_e ); + move32(); + q_postpred_cov_re_buf[i][j] = sub( 31, tmp_e ); move16(); } - ELSE - { - tmp_re = W_add( tmp_re, W_shr( W_tmp, sub( q_W_tmp, q_tmp_re ) ) ); // q_tmp_re - } } - - if ( LT_64( W_abs( tmp_re ), L_shl( IVAS_FIX_EPS, guard_bits ) ) ) + IF( postpred_cov_re[i][j] ) { - tmp_re = 0; - move64(); - } - - q_postpred_cov_re_per_value[i][j] = q_tmp_re; - move16(); - IF( tmp_re == 0 ) - { - postpred_cov_re[i][j] = W_extract_l( tmp_re ); /* q_tmp_re*/ - move32(); - } - ELSE - { - q_tmp_re = W_norm( tmp_re ); - postpred_cov_re[i][j] = W_extract_h( W_shl( tmp_re, q_tmp_re ) ); /* q_tmp_re+ q_postpred_cov_re_per_value[i][j] -32*/ - move32(); - q_postpred_cov_re_per_value[i][j] = sub( add( q_tmp_re, q_postpred_cov_re_per_value[i][j] ), 32 ); - move16(); + min_val = s_min( min_val, q_postpred_cov_re_buf[i][j] ); } - *q_postpred_cov_re = s_min( *q_postpred_cov_re, q_postpred_cov_re_per_value[i][j] ); - move16(); } } + /*Changing Q of postpred_cov_re to min_val*/ FOR( i = 0; i < num_ch; i++ ) { FOR( j = i; j < num_ch; j++ ) { - IF( postpred_cov_re[i][j] >= 0 ) - { - postpred_cov_re[i][j] = L_shr( postpred_cov_re[i][j], sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ); //*q_postpred_cov_re - move32(); - } - ELSE + IF( postpred_cov_re[i][j] ) { - postpred_cov_re[i][j] = L_negate( L_shr( L_negate( postpred_cov_re[i][j] ), sub( q_postpred_cov_re_per_value[i][j], *q_postpred_cov_re ) ) ); //*q_postpred_cov_re + postpred_cov_re[i][j] = L_shl( postpred_cov_re[i][j], sub( min_val, q_postpred_cov_re_buf[i][j] ) ); move32(); } } } + FOR( i = 0; i < num_ch; i++ ) { FOR( j = 0; j < i; j++ ) @@ -2152,6 +2093,14 @@ static void ivas_calc_post_pred_per_band_enc_fx( } } + if ( EQ_16( min_val, MAX16B ) ) + { + min_val = Q31; + move16(); + } + *q_postpred_cov_re = min_val; + move16(); + return; } @@ -2687,7 +2636,8 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( trace = W_add( trace, W_deposit32_l( L_abs( cov_uu_re[i - num_dmx][i - num_dmx] ) ) ); // q_cov_uu_re } - factor = L_max( IVAS_FIX_EPS, postpred_cov_re[0][0] ); // q_postpred_cov_re + factor = postpred_cov_re[0][0]; // q_postpred_cov_re + move32(); q_factor = q_postpred_cov_re; move16(); IF( trace != 0 ) @@ -2708,10 +2658,20 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( factor = L_max( factor, tmp ); // q_factor } + tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_factor, 40 ) ); + Word16 factor_exp = 0; move16(); - factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) - factor_exp = add( factor_exp, q_factor ); + IF( LE_32( factor, tmp ) ) + { + factor = 1250000000; + factor_exp = Q31 - ( -4 ); + } + ELSE + { + factor = BASOP_Util_Divide3232_Scale( 1, factor, &factor_exp ); // q=15-(factor_exp+31-(31-q_factor)) + factor_exp = add( factor_exp, q_factor ); + } /* normalise Hermitian (except for rounding) cov_uu */ FOR( i = num_dmx; i < num_ch; i++ ) @@ -3311,6 +3271,9 @@ void ivas_calc_c_p_coeffs_enc_fx( Word16 i, j, q_postpred_cov_re; Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + q_postpred_cov_re = 0; + move16(); + FOR( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { set_zero_fx( postpred_cov_re[i], IVAS_SPAR_MAX_CH ); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 087d892e3..6414a81b6 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -675,6 +675,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 alw_voicing[2], alw_voicing_wc = -1; Word16 disable_ltp = 0; Word16 tmp, *tmpP16; + Word16 q_mdstWin = st->q_inp, q_tcx20Win = st->q_inp; Word32 *tmpP32; Word16 Q_exp; Word32 L_tmpbuf[N_MAX + L_MDCT_OVLP_MAX]; @@ -684,12 +685,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( move16(); move16(); move16(); + move16(); + move16(); (void) vad_hover_flag; Word16 Q_win_temp[2]; Word16 *speech_ltp_fx = NULL; Word16 *wspeech_fx = NULL; Word16 *speech_fx = NULL; - Word16 q_out_wtda = 0; + Word16 q_out_wtda = st->q_inp; move16(); Word16 win_len[2]; move16(); @@ -961,7 +964,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( move32(); windowed_samples[frameno * L_FRAME_MAX + 1] = L_deposit_l( overlap_mode[frameno + 1] ); // Q0 move32(); - Copy_Scale_sig_16_32_DEPREC( tcx20Win, windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), 0 ); + Copy_Scale_sig_16_32_DEPREC( tcx20Win, windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), negate( q_tcx20Win ) ); *q_win = s_min( *q_win, sub( L_norm_arr( windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ) ), 1 ) ); move16(); Q_win_temp[frameno] = *q_win; @@ -983,7 +986,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outter left folding */ FOR( i = 0; i < folding_offset; i++ ) { - tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // Q0 + tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win move16(); } @@ -996,18 +999,18 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } } @@ -1016,7 +1019,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = shr( right_overlap, 1 ); FOR( i = 0; i < tmp; i++ ) { - tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // Q0 + tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win move16(); } @@ -1027,6 +1030,12 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmpP16 = tcx20Win; tmpP32 = hTcxEnc->spectrum_fx[frameno]; assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); + Word16 len[2], exp[2]; + hTcxEnc->spectrum_e[frameno] = 16; + exp[0] = exp[1] = hTcxEnc->spectrum_e[frameno]; + move16(); + move16(); + move16(); FOR( i = 0; i < 2; i++ ) { test(); @@ -1037,17 +1046,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( mac_r( 2 << 16, -( 3 << 8 ), shl( i, 7 ) ), /* equivalent to: sub(i, 1) == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP */ &left_overlap, &right_overlap, tmpP16, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 ); - hTcxEnc->spectrum_e[frameno] = 16; - move16(); TCX_MDCT( tcx5Win, tmpP32, - &hTcxEnc->spectrum_e[frameno], + &exp[i], left_overlap, sub( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); tmpP16 += tcx5SizeFB; tmpP32 += tcx5SizeFB; + len[i] = L_subframe; + move16(); /* high-band gain control in case of BWS */ IF( st->bwidth_sw_cnt > 0 ) @@ -1064,6 +1073,16 @@ void core_signal_analysis_high_bitrate_ivas_fx( L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); } } + hTcxEnc->spectrum_e[frameno] = s_max( exp[0], exp[1] ); + move16(); + + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( hTcxEnc->spectrum_fx[frameno] + i * L_subframe, len[i], sub( exp[i], hTcxEnc->spectrum_e[frameno] ) ); + } + + hTcxEnc->spectrum_e[frameno] = sub( hTcxEnc->spectrum_e[frameno], q_tcx20Win ); + move16(); } ELSE /* transform_type[frameno] != TCX_5 */ { @@ -1105,23 +1124,25 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // Q0 - tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // Q0 + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win + L_tmp = L_shl( L_tmp, sub( 0, Q16 ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_l( L_tmp ) ); // q_tcx20Win move32(); } } TCX_MDCT( tcx20Win, hTcxEnc->spectrum_fx[frameno], &hTcxEnc->spectrum_e[frameno], left_overlap, sub( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); + hTcxEnc->spectrum_e[frameno] = sub( hTcxEnc->spectrum_e[frameno], q_tcx20Win ); + move16(); } /* high-band gain control in case of BWS */ @@ -1147,23 +1168,27 @@ void core_signal_analysis_high_bitrate_ivas_fx( IF( EQ_16( hTcxEnc->tcxMode, TCX_20 ) && ( ( LT_32( st->total_brate, HQ_96k ) ) || st->igf ) ) { pMdstWin = tcx20Win; + Word16 q_pmdstWin = q_tcx20Win; + move16(); test(); if ( ( ( EQ_16( hTcxEnc->tcxMode, TCX_20 ) ) && ( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) ) ) { pMdstWin = mdstWin; + q_pmdstWin = q_mdstWin; + move16(); } /* Compute noise-measure flags for spectrum filling and quantization */ AnalyzePowerSpectrum_ivas_fx( st, div_l( L_mult( L_subframe, st->L_frame ), hTcxEnc->L_frameTCX ), L_subframe, left_overlap, right_overlap, hTcxEnc->spectrum_fx[frameno], hTcxEnc->spectrum_e[frameno], - pMdstWin, powerSpec, powerSpec_e ); + pMdstWin, q_pmdstWin, powerSpec, powerSpec_e ); } } } IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { - Word16 q_mdstWin, scale; + Word16 scale; L_subframe = idiv1616( L_frameTCX, nSubframes ); /* Q0 */ test(); @@ -1173,8 +1198,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( scale = sub( norm_arr( mdstWin, L_frameTCX ), 1 ); scale = s_min( 1, scale ); // restricting the Q to zero or less scale_sig( mdstWin, L_frameTCX, scale ); - q_mdstWin = add( -1, scale ); - move16(); + q_mdstWin = add( add( st->q_inp, -1 ), scale ); } ELSE { @@ -1185,8 +1209,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( scale = sub( norm_arr( mdstWin, sig_len ), 1 ); scale = s_min( 0, scale ); // restricting the Q to zero or less scale_sig( mdstWin, sig_len, scale ); - q_mdstWin = scale; - move16(); + q_mdstWin = add( scale, st->q_inp ); } IF( EQ_16( transform_type[frameno], TCX_5 ) ) @@ -1205,17 +1228,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } @@ -1292,17 +1315,17 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word32 L_tmp; FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) ); // q_mdstWin + L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp + L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_inp, Q15) -> Q16 + q_inp + L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) ); // q_mdstWin mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) ); // q_mdstWin move32(); } diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 7c3daebda..d0a91a098 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -370,15 +370,16 @@ static void kernel_switch_trafo_fx( static void kernel_switch_update_transforms_fx( - Word32 *sigR, /* i/o: MDCT samples of the given channel (*q_sig) */ - Word32 *sigI, /* i/o: MDST samples of the given channel (*q_sig) */ - Word16 *q_sig, /* i/o: Common Q of MDCT and MDST samples of the given channel */ - const Word16 tcxTransType, /* i : TCX transform type, cf also above */ - TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration handle, pointer */ - const Word16 bwidthSwCnt, /* i : bandwidth switching counter in st */ - const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ - Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ - const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ + Word32 *sigR, /* i/o: MDCT samples of the given channel (*q_sig) */ + Word32 *sigI, /* i/o: MDST samples of the given channel (*q_sig) */ + Word16 *q_sig, /* i/o: Common Q of MDCT and MDST samples of the given channel */ + const Word16 tcxTransType, /* i : TCX transform type, cf also above */ + TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration handle, pointer */ + const Word16 bwidthSwCnt, /* i : bandwidth switching counter in st */ + const UWord16 kernelType, /* i : TCX transform kernel type (0 - 3) */ + Word16 *tcxTimeSignal, /* i : hTcxEnc->new_speech_TCX buf in st */ + const Word16 *speech_TCX, /* i : hTcxEnc->speech_TCX buffer in st */ + const Word16 q_speech, Word32 *windowedTimeSignal, /* i/o: windowed input and scratch buffer (*q_windowedTimeSignal) */ Word16 *q_windowedTimeSignal, /* i/o: Q of windowed input and scratch buffer */ const Word16 L_subframe /* i : transform length (number of bins) */ @@ -429,9 +430,9 @@ static void kernel_switch_update_transforms_fx( Word32 factor; n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) ); - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 ); // Q0 -> Q-1 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( -Q1, q_speech ) ); // q_speech -> Q-1 wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2 - Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 ); // Q-1 -> Q0 + Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( q_speech, -Q1 ) ); // Q-1 -> q_speech Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 ); // Q14 scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ ); // Q6 edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE ); @@ -469,17 +470,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( speech_TCX[-1 - i], hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -488,17 +489,17 @@ static void kernel_switch_update_transforms_fx( { FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { - L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16 - L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16, Q15) -> Q16 - L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, Q16 ) ); // *q_windowedTimeSignal + L_tmp = L_mult( negate( speech_TCX[-1 - i] ), hTcxCfg->tcx_aldo_window_1_FB[leftOverlap / 2 + minWindowLen - i] ); // (q_speech, Q15) -> Q16 + q_speech + L_tmp = Mpy_32_16_1( L_tmp, hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_speech, Q15) -> Q16 + q_speech + L_tmp = L_shl( L_tmp, sub( *q_windowedTimeSignal, add( Q16, q_speech ) ) ); // *q_windowedTimeSignal windowedTimeSignal[2 + leftOverlap + i] = L_add( windowedTimeSignal[2 + leftOverlap + i], L_tmp ); // *q_windowedTimeSignal move32(); } @@ -1486,7 +1487,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc0->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc0->spectrum_fx[n], mdst_spectrum_fx[0][n], &q_com, hTcxEnc0->transform_type[n], sts[0]->hTcxCfg, sts[0]->bwidth_sw_cnt, hTcxEnc0->kernel_type[n], - hTcxEnc0->new_speech_TCX, speech, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEnc0->new_speech_TCX, speech, sts[0]->q_inp, windowedSignal_fx[0] + i_mult( n, L_FRAME48k ), &q_windowedSignal[0], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[0][n] = sub( Q31, q_com ); hTcxEnc0->spectrum_e[n] = sub( Q31, q_com ); move16(); @@ -1507,7 +1508,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = hTcxEnc1->speech_TCX; } kernel_switch_update_transforms_fx( hTcxEnc1->spectrum_fx[n], mdst_spectrum_fx[1][n], &q_com, hTcxEnc1->transform_type[n], sts[1]->hTcxCfg, sts[1]->bwidth_sw_cnt, hTcxEnc1->kernel_type[n], - hTcxEnc1->new_speech_TCX, speech, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEnc1->new_speech_TCX, speech, sts[1]->q_inp, windowedSignal_fx[1] + i_mult( n, L_FRAME48k ), &q_windowedSignal[1], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[1][n] = sub( Q31, q_com ); hTcxEnc1->spectrum_e[n] = sub( Q31, q_com ); move16(); @@ -1741,7 +1742,7 @@ void ivas_mdct_core_whitening_enc_fx( speech = NULL; } kernel_switch_update_transforms_fx( hTcxEncCh->spectrum_fx[n], mdst_spectrum_fx[ch][n], &q_com, hTcxEncCh->transform_type[n], sts[ch]->hTcxCfg, sts[ch]->bwidth_sw_cnt, hTcxEncCh->kernel_type[n], - hTcxEncCh->new_speech_TCX, speech, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); + hTcxEncCh->new_speech_TCX, speech, sts[ch]->q_inp, windowedSignal_fx[ch] + i_mult( n, L_FRAME48k ), &q_windowedSignal[ch], shr( L_subframeTCX, shift ) /*L_subframeTCX / nSubframes*/ ); mdst_spectrum_e[ch][n] = sub( Q31, q_com ); move16(); hTcxEncCh->spectrum_e[n] = sub( Q31, q_com ); diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index b32e8a561..2e365be47 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -250,7 +250,10 @@ void stereo_mdct_core_enc_fx( hCPE->hStereoMdct->stbParamsTCX20.nBandsStereoCore = hCPE->hStereoMdct->stbParamsTCX20.sfbCnt; move16(); } - + Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), + s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); + q_com = s_min( 0, q_com ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; @@ -272,11 +275,11 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); - Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), negate( sts[ch]->q_inp ) ); /* Q0 */ - Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), negate( sts[ch]->q_old_inp ) ); /* Q0 */ - sts[ch]->q_old_inp = 0; + Scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* Q0 */ + Scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* Q0 */ + sts[ch]->q_old_inp = q_com; move16(); - sts[ch]->q_inp = 0; + sts[ch]->q_inp = q_com; move16(); } @@ -765,7 +768,6 @@ void stereo_mdct_core_enc_fx( * Split available bits between channels *---------------------------------------------------------------*/ - Word16 q_com; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n_sb = NB_DIV; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index e54d3025e..64402bf3c 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1278,7 +1278,8 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* i : MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* i : windowed signal corresponding to mdctSpectrum */ - Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ + const Word16 q_signal, + Word32 powerSpec[], /* o : Power spectrum. Can point to signal */ Word16 powerSpec_e[] ); void AdaptLowFreqEmph_fx( Word32 x[], diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 5bea901bb..ad1720665 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -330,7 +330,8 @@ void AnalyzePowerSpectrum_ivas_fx( Word32 const mdctSpectrum[], /* input: MDCT spectrum */ Word16 mdctSpectrum_e, Word16 const signal[], /* input: windowed signal corresponding to mdctSpectrum */ - Word32 powerSpec[], /* output: Power spectrum. Can point to signal */ + const Word16 q_signal, + Word32 powerSpec[], /* output: Power spectrum. Can point to signal */ Word16 powerSpec_e[] ) { Word16 i, iStart, iEnd, lowpassLine; @@ -342,8 +343,7 @@ void AnalyzePowerSpectrum_ivas_fx( lowpassLine = L_frameTCX; move16(); - Word16 temp_powerSpec_e = 16; - move16(); + Word16 temp_powerSpec_e = sub( 16, q_signal ); TCX_MDST( signal, powerSpec, &temp_powerSpec_e, left_overlap, sub( L_frameTCX, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); shift = L_norm_arr( powerSpec, N_MAX + L_MDCT_OVLP_MAX ); -- GitLab From 40dd464d457399bc0bfe0aa9f3f448dc253fe782 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 12 Mar 2025 10:45:04 +0100 Subject: [PATCH 321/358] Fix issue 1378 (invalid read access) --- diff | 1068 ++++++++++++++++++++++++++++++++++++++++ lib_com/options.h | 3 + lib_dec/dec_acelp_fx.c | 12 + 3 files changed, 1083 insertions(+) create mode 100644 diff diff --git a/diff b/diff new file mode 100644 index 000000000..e782cdaf8 --- /dev/null +++ b/diff @@ -0,0 +1,1068 @@ +diff --git a/Makefile b/Makefile +index 9d18cbde..8087038a 100644 +--- a/Makefile ++++ b/Makefile +@@ -26,10 +26,17 @@ LIB_LIBREND ?= libivasrend.a + LIB_LIBUTIL ?= libivasutil.a + + # Default tool settings +-CC ?= gcc ++#CC ?= gcc ++CC ?= clang + RM ?= rm -f + AR ?= ar + ++#CFLAGS += -fsanitize=address,undefined,integer,nullability ++#LDFLAGS += -fsanitize=address,undefined,integer,nullability ++#CFLAGS += -fsanitize=address,undefined,nullability ++#LDFLAGS += -fsanitize=address,undefined,nullability ++ ++ + # Detect system + UNAME_S := $(shell uname -s) + +diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c +index 48c00ed9..12bfee13 100644 +--- a/lib_dec/ivas_dirac_dec_fx.c ++++ b/lib_dec/ivas_dirac_dec_fx.c +@@ -3678,6 +3678,7 @@ void ivas_dirac_dec_render_sf_fx( + 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 ); ++#if 0 + IF( LT_16( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // q_reference_power_smooth[0] +@@ -3696,10 +3697,11 @@ void ivas_dirac_dec_render_sf_fx( + q_reference_power_smooth[0] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0]; + move16(); + } +- ++#endif + exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), exp ); // q_reference_power_smooth + exp + q_reference_power_smooth[1] = add( q_reference_power_smooth[1], exp ); ++#if 0 + IF( LT_16( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ) + { + 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( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // q_reference_power_smooth +@@ -3718,6 +3720,7 @@ 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(); + } ++#endif + #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 +@@ -3782,6 +3785,7 @@ void ivas_dirac_dec_render_sf_fx( + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); + move16(); ++#if 0 + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) + { + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) +@@ -3800,6 +3804,7 @@ void ivas_dirac_dec_render_sf_fx( + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; + move16(); + } ++#endif + exp = 31; + move16(); + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) +@@ -3812,6 +3817,7 @@ void ivas_dirac_dec_render_sf_fx( + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); + move16(); ++#if 0 + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ) + { + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) +@@ -3830,6 +3836,7 @@ 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(); + } ++#endif + #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) +diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +index 77826b96..1cc6cd4d 100644 +--- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c ++++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +@@ -2173,13 +2173,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + reference_power_smooth[l] ); //(Q31, q_reference_power_smooth) -> q_reference_power_smooth + 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 ++#ifndef FIX_867_CLDFB_NRG_SCALE + 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 +@@ -2187,6 +2182,23 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + + exp = 0; + move16(); ++#else ++ Word16 s1, s2, qidx; ++ qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); ++ ++ s1 = s_max( 0, sub( q_reference_power_smooth[qidx], h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx] ) ); ++ s2 = s_max( 0, sub( h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx], q_reference_power_smooth[qidx] ) ); ++ currWeight = L_shr( currWeight, s1 ); ++ prevWeight = L_shr( prevWeight, s2 ); ++ 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 ++ sumWeight = L_add( currWeight, prevWeight ); // q_reference_power_smooth ++ ++ exp = s_min( q_reference_power_smooth[qidx], h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx] ); ++ move16(); ++#endif ++ + #if 1 + tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ + smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 +@@ -2222,6 +2234,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; + set16_fx( exp_arr, 0, i_mult( num_protos_dir, num_freq_bands ) ); + ++#ifndef FIX_867_CLDFB_NRG_SCALE + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < num_freq_bands; l++ ) +@@ -2234,27 +2247,76 @@ 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(); + ++ assert(h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q); ++ + IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) + { + p_power_smooth_prev++; +- L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ ++ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + exp_arr[k * num_freq_bands + l] = exp; + move16(); + +- *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-q_proto_power_smooth))*/ ++ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + move32(); + } + ELSE + { +- L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ ++ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + exp_arr[k * num_freq_bands + l] = exp; + move16(); + +- *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-q_proto_power_smooth))*/ ++ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + move32(); + } + } + } ++#else ++ Word16 shift_prev0, shift_curr0, shift_prev1, shift_curr1; ++ shift_prev0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); ++ shift_curr0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); ++ shift_prev1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); ++ shift_curr1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); ++ ++ FOR( k = 0; k < num_protos_dir; k++ ) ++ { ++ FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) ++ { ++ g1 = alpha[l]; // Q31 ++ move32(); ++ g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 ++ *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev0 ) ) ); //(Q31, proto_power_smooth_q) -> proto_power_smooth_q ++ move32(); ++ *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), ++ L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr0 ) ); //(Q31, proto_power_smooth_q) -> min(proto_power_smooth_q, proto_power_smooth_prev_q) ++ move32(); ++ ++ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ ++ exp_arr[k * num_freq_bands + l] = exp; ++ move16(); ++ ++ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ ++ move32(); ++ } ++ FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) ++ { ++ g1 = alpha[l]; // Q31 ++ move32(); ++ g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 ++ *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev1 ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth ++ move32(); ++ *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), ++ L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr1 ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth ++ move32(); ++ ++ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ ++ exp_arr[k * num_freq_bands + l] = exp; ++ move16(); ++ ++ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ ++ move32(); ++ } ++ } ++#endif + + // Move proto_power_smooth_fx to common Q-factor + +@@ -2297,14 +2359,23 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + p_power_smooth++; + } + } ++ ++ // Update the Q-factor ++#if 0 + q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); + q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); + +- // Update the Q-factor + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = h_dirac_output_synthesis_state->proto_power_smooth_q[0]; + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = h_dirac_output_synthesis_state->proto_power_smooth_q[1]; +- move16(); +- move16(); ++ move16(); move16(); ++#else ++ h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ); ++ h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ); ++ move16(); move16(); ++ ++ q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); ++ q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); ++#endif + h_dirac_output_synthesis_state->proto_power_smooth_q[0] = q_tmp; + h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; + move16(); +diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c +index 18c9269d..d1071b39 100644 +--- a/lib_rend/ivas_dirac_rend_fx.c ++++ b/lib_rend/ivas_dirac_rend_fx.c +@@ -1774,15 +1774,32 @@ 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], temp_q_shift, q_temp2; ++#else + Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; ++#endif + Word32 temp; + Word64 W_tmp1, W_tmp2; + Word64 reference_power_64fx[CLDFB_NO_CHANNELS_MAX]; + Word16 q_reference_power_64fx; ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ Word16 head_room, q_Left_Right_power[2]; ++#else + Word16 head_room, q_Left_Right_power; ++#endif ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ const 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 + temp_q_shift = Q31; + move16(); + q_sum_total_ratio = Q31; +@@ -1797,18 +1814,35 @@ 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 ); ++#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 + + #ifdef MSAN_FIX + 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 ) ) ); + #else + q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ), L_norm_arr( ImagBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ) ); + #endif // MSAN_FIX ++#ifdef FIX_867_CLDFB_NRG_SCALE ++#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 ++#endif + temp_q_shift = s_min( temp_q_shift, q_shift ); + } + ++#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 + temp_q_shift = sub( temp_q_shift, 2 ); // guard bits + + /* Upscaling of the buffer proto_power_smooth_fx */ +@@ -1868,16 +1902,29 @@ void protoSignalComputation2_fx( + { + 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 ); ++ move16(); ++#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 + +@@ -1894,14 +1941,13 @@ 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 +- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); +- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -1910,7 +1956,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -1925,13 +1971,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -1940,7 +1986,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -1954,13 +2000,13 @@ void protoSignalComputation2_fx( + + 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -1969,7 +2015,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2042,20 +2088,29 @@ void protoSignalComputation2_fx( + interpolatorSpaced_fx = sub( MAX16B, interpolatorDmx_fx ); /* Q15 */ + } + } +- ++#ifndef FIX_867_CLDFB_NRG_SCALE + 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 + q_temp2 = sub( add( add( q_cldfb, temp_q_shift ), add( q_cldfb, temp_q_shift ) ), 31 ); +- + 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 ) ); +@@ -2063,15 +2118,28 @@ void protoSignalComputation2_fx( + head_room = s_min( head_room, W_norm( W_add( W_tmp1, W_tmp2 ) ) ); + } + head_room = sub( head_room, find_guarded_bits_fx( num_freq_bands ) ); ++ ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ q_Left_Right_power[0] = add( shl( add( q_cldfb, min_q_shift[0] ), 1 ), sub( head_room, 32 ) ); ++ q_Left_Right_power[1] = add( shl( add( q_cldfb, min_q_shift[1] ), 1 ), sub( head_room, 32 ) ); ++#else + q_Left_Right_power = add( shl( add( q_cldfb, min_q_shift ), 1 ), sub( head_room, 32 ) ); ++#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 + /* Compute sum signal */ + Real_aux_fx = L_add( re1, re2 ); // q_cldfb+min_q_shift + Imag_aux_fx = L_add( im1, im2 ); // q_cldfb+min_q_shift +@@ -2091,6 +2159,7 @@ void protoSignalComputation2_fx( + 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] ); ++ assert(0 /* Fix 2 scale regions for total_bb_power_fx, left_hi_power_fx, right_hi_power_fx and total_hi_power_fx */ ); + 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 + + IF( GT_16( l, MASA_HI_FREQ_START_BIN ) ) +@@ -2103,9 +2172,14 @@ void protoSignalComputation2_fx( + + IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) + { ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ assert( qidx == 0 ); ++ re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[qidx] ) ); // q_cldfb+temp_q_shift ++ im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift[qidx] ) ); // q_cldfb+temp_q_shift ++#else + re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift + im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift +- ++#endif + sum_power_fx = Madd_32_32( Mpy_32_32( re_aux, re_aux ), im_aux, im_aux ); // 2*(q_cldfb+temp_q_shift)-31 + temp = Mpy_32_32( a_fx, sum_power_fx ); // 2*(q_cldfb+temp_q_shift)-31 + +@@ -2121,6 +2195,18 @@ void protoSignalComputation2_fx( + } + + temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ IF( LT_16( q_temp[qidx], stereo_type_detect->q_total_power ) ) ++ { ++ stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); // q_temp ++ move32(); ++ } ++ ELSE ++ { ++ stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power ++ move32(); ++ } ++#else + IF( LT_16( q_temp, stereo_type_detect->q_total_power ) ) + { + stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp ) ) ); // q_temp +@@ -2131,7 +2217,7 @@ void protoSignalComputation2_fx( + stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power + move32(); + } +- ++#endif + test(); + IF( ( stereo_type_detect->sum_power_fx[l] == 0 ) && ( stereo_type_detect->total_power_fx[l] == 0 ) ) + { +@@ -2147,7 +2233,11 @@ void protoSignalComputation2_fx( + { + sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], stereo_type_detect->total_power_fx[l], &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) + move32(); ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); ++#else + q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) ); ++#endif + sum_total_ratio_fx[l] = L_shl( sum_total_ratio_fx[l], sub( Q15, q_sum_total_ratio ) ); // q15 + move32(); + } +@@ -2159,6 +2249,22 @@ 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 ) ) ++ { ++ 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[qidx] ) ), temp ); // q_temp ++ move32(); ++ stereo_type_detect->q_subtract_power_y = q_temp[qidx]; ++ move16(); ++ } ++ ELSE ++ { ++ 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(); ++ } ++ ++#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 +@@ -2171,12 +2277,10 @@ 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, 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 */ +-#ifdef FIX_867_CLDFB_NRG_SCALE +- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); +-#endif + + /* W prototype */ + IF( stereo_type_detect->interpolator > 0 ) +@@ -2188,13 +2292,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2203,7 +2307,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2222,13 +2326,13 @@ void protoSignalComputation2_fx( + + 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2237,7 +2341,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2258,13 +2362,13 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2273,7 +2377,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2289,13 +2393,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2304,7 +2408,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2321,13 +2425,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2336,7 +2440,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2376,13 +2480,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2391,7 +2495,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2418,13 +2522,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2433,7 +2537,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2459,13 +2563,13 @@ 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, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2474,7 +2578,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2499,8 +2603,12 @@ void protoSignalComputation2_fx( + + stereo_type_detect->q_sum_power = s_min( stereo_type_detect->q_sum_power, q_temp2 ); + move16(); ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ assert(0); ++#else + stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp ); + move16(); ++#endif + q_sum_total_ratio = Q15; + move16(); + +@@ -2517,6 +2625,22 @@ void protoSignalComputation2_fx( + } + + temp = Mpy_32_32( a_fx, left_bb_power_fx ); // q_Left_Right_power ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); ++ assert( 0 /* qidx has no valid value ? */ ); ++ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_left_bb_power ) ) ++ { ++ stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power ++ move32(); ++ stereo_type_detect->q_left_bb_power = q_Left_Right_power[qidx]; ++ move16(); ++ } ++ ELSE ++ { ++ stereo_type_detect->left_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_left_bb_power ) ), b_fx, stereo_type_detect->left_bb_power_fx ); // stereo_type_detect->q_left_bb_power ++ move32(); ++ } ++#else + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ) + { + stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power +@@ -2529,8 +2653,24 @@ void protoSignalComputation2_fx( + stereo_type_detect->left_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ), b_fx, stereo_type_detect->left_bb_power_fx ); // stereo_type_detect->q_left_bb_power + move32(); + } ++#endif + + temp = Mpy_32_32( a_fx, right_bb_power_fx ); // q_Left_Right_power ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ assert( 0 /* qidx has no valid value ? */ ); ++ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_right_bb_power ) ) ++ { ++ stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power ++ move32(); ++ stereo_type_detect->q_right_bb_power = q_Left_Right_power[qidx]; ++ move16(); ++ } ++ ELSE ++ { ++ stereo_type_detect->right_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_right_bb_power ) ), b_fx, stereo_type_detect->right_bb_power_fx ); // stereo_type_detect->q_right_bb_power ++ move32(); ++ } ++#else + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ) + { + stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power +@@ -2543,8 +2683,23 @@ void protoSignalComputation2_fx( + stereo_type_detect->right_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ), b_fx, stereo_type_detect->right_bb_power_fx ); // stereo_type_detect->q_right_bb_power + move32(); + } ++#endif + + temp = Mpy_32_32( a_fx, total_bb_power_fx ); // q_Left_Right_power ++#ifdef FIX_867_CLDFB_NRG_SCALE ++ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_total_bb_power ) ) ++ { ++ stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power ++ move32(); ++ stereo_type_detect->q_total_bb_power = q_Left_Right_power[qidx]; ++ move16(); ++ } ++ ELSE ++ { ++ stereo_type_detect->total_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_total_bb_power ) ), b_fx, stereo_type_detect->total_bb_power_fx ); // stereo_type_detect->q_total_bb_power ++ move32(); ++ } ++#else + IF( LT_16( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ) + { + stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power +@@ -2557,6 +2712,7 @@ void protoSignalComputation2_fx( + stereo_type_detect->total_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ), b_fx, stereo_type_detect->total_bb_power_fx ); // stereo_type_detect->q_total_bb_power + move32(); + } ++#endif + + IF( LT_16( stereo_type_detect->q_left_bb_power, stereo_type_detect->q_right_bb_power ) ) + { +@@ -2583,6 +2739,9 @@ 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 ++ assert(0); ++#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 ); +@@ -2593,6 +2752,7 @@ void protoSignalComputation2_fx( + 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(); + +@@ -2637,19 +2797,33 @@ void protoSignalComputation2_fx( + move32(); + + ivas_masa_stereotype_detection_fx( stereo_type_detect ); ++ + } + ELSE + { + 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 +@@ -2659,14 +2833,13 @@ void protoSignalComputation2_fx( + move64(); + + #ifdef FIX_867_CLDFB_NRG_SCALE +- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); +- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // q_temp ++ 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 +@@ -2675,7 +2848,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2694,13 +2867,13 @@ 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] ); // q_temp + #ifdef FIX_867_CLDFB_NRG_SCALE +- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) ++ 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 ) ), temp ); // q_temp ++ 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 +@@ -2709,7 +2882,7 @@ void protoSignalComputation2_fx( + 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth ++ 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 +@@ -2730,9 +2903,11 @@ void protoSignalComputation2_fx( + proto_frame_f_fx[4 * num_freq_bands + 2 * l + 1] = im2; // q_cldfb+ min_q_shift + move32(); + } ++ + } +- q_reference_power_64fx = shl( add( q_cldfb, min_q_shift ), 1 ); + #ifdef FIX_867_CLDFB_NRG_SCALE ++ q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[0] ), 1 ); ++ + Word16 norm_shift = 63; + move16(); + FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) +@@ -2749,6 +2924,8 @@ void protoSignalComputation2_fx( + } + q_reference_power[0] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); + move16(); ++ ++ q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[1] ), 1 ); + norm_shift = 63; + move16(); + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) +@@ -2766,6 +2943,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++ ) +@@ -2784,13 +2962,48 @@ void protoSignalComputation2_fx( + 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 ) ++ { ++ Scale_sig32(proto_frame_f_fx + l*2, CLDFB_NO_CHANNELS_HALF*2, sub( min_q_shift[1], min_q_shift[0] ) ); ++ } ++ *q_proto_frame_f = add( q_cldfb, min_q_shift[1] ); ++ move16(); ++ } ELSE { ++ FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) ++ { ++ Scale_sig32(proto_frame_f_fx + (l + CLDFB_NO_CHANNELS_HALF)*2, 2*s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( min_q_shift[0], min_q_shift[1] ) ); ++ } ++ *q_proto_frame_f = add( q_cldfb, min_q_shift[0] ); ++ move16(); ++ } ++ 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 ) ++ { ++ Scale_sig32(proto_direct_buffer_f_fx + l*2, CLDFB_NO_CHANNELS_HALF*2, sub( min_q_shift[1], min_q_shift[0] ) ); ++ } ++ *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[0] ); ++ move16(); ++ } ELSE { ++ FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) ++ { ++ Scale_sig32(proto_direct_buffer_f_fx + (l + CLDFB_NO_CHANNELS_HALF)*2, 2*s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( min_q_shift[0], min_q_shift[1] ) ); ++ } ++ *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 ); +- q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp ); ++ 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 diff --git a/lib_com/options.h b/lib_com/options.h index aff979023..37660ea47 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -69,6 +69,9 @@ #define FIX_867_CLDFB_NRG_SCALE + +#define FIX_1378_ACELP_OUT_OF_BOUNDS + /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ diff --git a/lib_dec/dec_acelp_fx.c b/lib_dec/dec_acelp_fx.c index 07750469f..51cbef624 100644 --- a/lib_dec/dec_acelp_fx.c +++ b/lib_dec/dec_acelp_fx.c @@ -169,6 +169,7 @@ void D_ACELP_indexing_fx( pulses = pulsestrack[0]; move16(); +#ifndef FIX_1378_ACELP_OUT_OF_BOUNDS /* safety check in case of bit errors */ IF( GE_64( s, pulsestostates[16][pulses - 1] ) ) { @@ -177,9 +178,20 @@ void D_ACELP_indexing_fx( move16(); return; } +#endif IF( pulses ) { +#ifdef FIX_1378_ACELP_OUT_OF_BOUNDS + /* safety check in case of bit errors */ + IF( GE_64( s, pulsestostates[16][pulses - 1] ) ) + { + set16_fx( code, 0, L_SUBFR ); + *BER_detect = 1; + move16(); + return; + } +#endif D_ACELP_decode_arithtrack_fx( code, s, pulses, num_tracks, 16 ); } ELSE -- GitLab From 1276285c20e4dee68009ddc9e3e38776549e7b9b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 16:35:27 +0530 Subject: [PATCH 322/358] Fix for 3GPP issue 1018: ParamISM: Ext-Output: Difference in high-band Link #1018 --- lib_com/swb_tbe_com_fx.c | 125 ++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 2a2841966..238b478c5 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -12,11 +12,12 @@ #include "ivas_prot_fx.h" #include "options_warnings.h" -#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ -#define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 -#define POW_EXC16k_WHTND_FX 178125000 // Q-6 -#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ -#define THR_ENV_ERROR_PLOSIVE_FX 200 /* threshold for envelope error used in plosive detection Q0 */ +#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ +#define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31 +#define POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49 1667313793 // Q49 +#define POW_EXC16k_WHTND_FX 178125000 // Q-6 +#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ +#define THR_ENV_ERROR_PLOSIVE_FX 200 /* threshold for envelope error used in plosive detection Q0 */ /*-----------------------------------------------------------------* * Local function prototypes @@ -3958,7 +3959,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word16 exc32k[L_FRAME32k], exc16k[L_FRAME16k]; Word32 pow1, pow22; Word16 scale, temp1, temp2, temp3; - + Word16 Q_White_exc16k; Word16 excTmp2[L_FRAME16k]; Word16 *White_exc16k; Word16 excNoisyEnv[L_FRAME16k]; @@ -3989,12 +3990,13 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word32 White_exc16k_32[L_FRAME16k]; Word16 White_exc16k_tmp[L_FRAME16k]; Word16 Q_temp; - Word16 prev_Q_bwe_exc_fb; - Word16 chk1, chk2; + Word16 prev_Q_bwe_exc_fb, Q_exc16kWhtnd; + Word16 chk1; + Word32 chk2; chk1 = 0; chk2 = 0; move16(); - move16(); + move32(); #if 1 // def ADD_IVAS_TBE_CODE Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k]; @@ -4262,7 +4264,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( } /* normalize the amplitude of the gaussian excitation to that of the LB exc. */ - Word32 pow22_inv = POW_EXC16k_WHTND_FX_INV_SQRT; + Word32 pow22_inv = POW_EXC16k_WHTND_FX_INV_SQRT_IN_Q49; move32(); move32(); pow22 = POW_EXC16k_WHTND_FX; @@ -4271,21 +4273,23 @@ void GenShapedSHBExcitation_ivas_dec_fx( // v_multc(White_exc16k, (float)sqrt(pow1 / pow22), White_exc16k, L_FRAME16k); Word16 pow1_exp = sub( Q31, Q_pow1 ); Word32 temp_pow = Sqrt32( pow1, &pow1_exp ); - temp_pow = L_shl( Mpy_32_32( temp_pow, pow22_inv ), pow1_exp ); + temp_pow = Mpy_32_32( temp_pow, pow22_inv ); /*Word16 out_exp; Word32 temp_pow1 = root_a_over_b_fx(pow1, Q_pow1, pow22, Q_pow22, &out_exp); temp_pow1 = L_shl(temp_pow1, out_exp);*/ // v_multc_fixed_16_16(White_exc16k, round_fx(temp_pow), White_exc16k, L_FRAME16k); L_tmp = 0; move32(); + shift = getScaleFactor16( White_exc16k, L_FRAME16k ); FOR( k = 0; k < L_FRAME16k; k++ ) { White_exc16k_32[k] = Mpy_32_16_1( temp_pow, White_exc16k[k] ); move32(); - White_exc16k[k] = round_fx( L_shl( White_exc16k_32[k], sub( *Q_bwe_exc, NOISE_QADJ ) ) ); // Q_bwe_exc - NOISE_QADJ + White_exc16k[k] = round_fx( L_shl( White_exc16k_32[k], shift ) ); // Q_White_exc16k move16(); L_tmp = L_max( L_tmp, L_abs( White_exc16k_32[k] ) ); } + Q_White_exc16k = add( shift, sub( 49 - 31, pow1_exp ) ); Q_temp = norm_l( L_tmp ); IF( L_tmp == 0 ) { @@ -4323,22 +4327,24 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* calculate pow22 */ /* pow22=0.00001f */ tmp = sub( shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1 ), 31 ); - pow22 = L_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(*Q_bwe_exc-NOISE_QADJ) */ + Word64 sum = W_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(*Q_bwe_exc-NOISE_QADJ) */ + Q_White_exc16k = getScaleFactor32( White_exc16k_32, L_FRAME16k ); FOR( k = 0; k < L_FRAME16k; k++ ) { - /* White_exc16k[k] *= excNoisyEnv[k]; */ - White_exc16k[k] = mult_r( excNoisyEnv[k], shl( White_exc16k[k], 1 ) ); // Q_excTmp2 + 5 + 1 - 15 ==> Q_excTmp2 - 9 - move16(); - chk2 = s_or( chk2, White_exc16k[k] ); + + White_exc16k[k] = extract_h( L_shl( White_exc16k_32[k], Q_White_exc16k ) ); // Q_excTmp2 + 6 + Q_White_exc16k - 16 ==> Q_excTmp2 + Q_White_exc16k - 10 + chk2 = L_or( chk2, White_exc16k_32[k] ); /* i: excNoisyEnv in (Q_excTmp2) */ /* i: White_exc16k in Q6 */ - /* o: White_exc16k in (Q_bwe_exc-NOISE_QADJ) */ + /* o: White_exc16k in (Q_White_exc16k) */ /* pow22 += White_exc16k[k] * White_exc16k[k]; */ - pow22 = L_mac0_sat( pow22, White_exc16k[k], White_exc16k[k] ); /* 2*(Q_excTmp2-NOISE_QADJ)*/ + sum = W_mac0_16_16( sum, White_exc16k[k], White_exc16k[k] ); /* 2*(Q_excTmp2 + Q_White_exc16k - 10)*/ + move16(); } - /*Q_pow22 = sub( shl(*Q_bwe_exc,1), 18 );*/ - Q_pow22 = shl( sub( Q_excTmp2, NOISE_QADJ ), 1 ); - Scale_sig( White_exc16k, L_FRAME16k, sub( *Q_bwe_exc, Q_excTmp2 ) ); + Q_pow22 = W_norm( sum ); + pow22 = W_extract_h( W_shl( sum, Q_pow22 ) ); // 2*(Q_excTmp2 + Q_White_exc16k - 10)+Q_pow22-32 + Q_pow22 = sub( add( Q_pow22, shl( sub( add( Q_White_exc16k, Q_excTmp2 ), 10 ), 1 ) ), 32 ); + Q_White_exc16k = add( Q_White_exc16k, sub( Q_excTmp2, 10 ) ); } #if 1 // def ADD_IVAS_TBE_CODE @@ -4625,7 +4631,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( move16(); } } -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( GE_16( element_mode, IVAS_CPE_DFT ) && nlExc16k != NULL ) { @@ -4638,29 +4643,42 @@ void GenShapedSHBExcitation_ivas_dec_fx( temp_fac = Sqrt16(temp_fac, &temp_fac_exp);*/ L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); Word16 temp_fac = round_fx_sat( L_shl_sat( L_tmp, exp ) ); // Q15 + shift = sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ); // v_multc_fixed_16_16(White_exc16k,shr(temp_fac, temp_fac_exp) , mixExc16k, L_FRAME16k); FOR( k = 0; k < L_FRAME16k; k++ ) { - mixExc16k[k] = mult_r( White_exc16k[k], temp_fac ); + mixExc16k[k] = mult_r( shl_sat( White_exc16k[k], shift ), temp_fac ); move16(); } } -#endif tmp = sub( Q_temp, 3 ); FOR( k = 0; k < L_FRAME16k; k++ ) { - White_exc16k_FB[k] = White_exc16k[k]; /* Q_bwe_exc-NOISE_QADJ */ + White_exc16k_FB[k] = White_exc16k[k]; /* Q_White_exc16k */ } prev_Q_bwe_exc_fb = *Q_bwe_exc_fb; move16(); - *Q_bwe_exc_fb = sub( *Q_bwe_exc, NOISE_QADJ ); + *Q_bwe_exc_fb = Q_White_exc16k; move16(); + *tbe_demph = shl_sat( *tbe_demph, sub( Q_White_exc16k, sub( *Q_bwe_exc, NOISE_QADJ ) ) ); deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph ); - /* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */ - /* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */ + *tbe_demph = shl_sat( *tbe_demph, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); -#if 1 // def ADD_IVAS_TBE_CODE + Q_exc16kWhtnd = getScaleFactor16( exc16kWhtnd, L_FRAME16k ); + Q_exc16kWhtnd = add( Q_exc16kWhtnd, *Q_bwe_exc ); + + shift = getScaleFactor16( White_exc16k, L_FRAME16k ); + + shift = s_min( Q_exc16kWhtnd, add( shift, Q_White_exc16k ) ); + scale_sig( exc16kWhtnd, L_FRAME16k, sub( shift, *Q_bwe_exc ) ); + scale_sig( White_exc16k, L_FRAME16k, sub( shift, Q_White_exc16k ) ); + + Q_exc16kWhtnd = Q_White_exc16k = shift; + move16(); + move16(); + *tbe_premph = shl_sat( *tbe_premph, sub( Q_White_exc16k, sub( *Q_bwe_exc, NOISE_QADJ ) ) ); + move16(); test(); IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { @@ -4693,11 +4711,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* mixing of LB and gaussian excitation in the first half of the frame */ FOR( k = 0; k < L_FRAME16k / 2; k++ ) { - // exc16kWhtnd[k] = (float)fact * (White_exc16k[k] * scale) + (float)(1 - fact) * exc16kWhtnd[k]; - // exc16kWhtnd[k] = add(mult_r(fact, mult(shl(White_exc16k[k], *Q_bwe_exc), scale)), mult_r(sub(32767, fact), exc16kWhtnd[k])); - L_tmp = L_add( L_shl( L_mult( fact, mult_r( White_exc16k[k], scale ) ), NOISE_QADJ ), - L_mult( sub( 32767, fact ), exc16kWhtnd[k] ) ); // Q_bwe_exc - exc16kWhtnd[k] = round_fx( L_tmp ); + exc16kWhtnd[k] = mac_r( L_mult( fact, mult_r( White_exc16k[k], scale ) ), + sub( 32767, fact ), exc16kWhtnd[k] ); // Q_exc16kWhtnd move16(); fact = add_sat( fact, step ); scale = add_sat( scale, step_scale ); @@ -4706,11 +4721,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* mixing of LB and gaussian excitation in the second half of the frame */ FOR( ; k < L_FRAME16k; k++ ) { - // exc16kWhtnd[k] = (float)new_fact * White_exc16k[k] + (float)(1 - new_fact) * exc16kWhtnd[k]; - // exc16kWhtnd[k] = add(mult_r(new_fact, shl(White_exc16k[k], *Q_bwe_exc)), mult_r(sub(32767, new_fact), exc16kWhtnd[k])); - L_tmp = L_add( L_shl( L_mult( new_fact, White_exc16k[k] ), NOISE_QADJ ), - mult_r( sub( 32767, new_fact ), exc16kWhtnd[k] ) ); // Q_bwe_exc - exc16kWhtnd[k] = round_fx( L_tmp ); + exc16kWhtnd[k] = mac_r( L_mult( new_fact, White_exc16k[k] ), + sub( 32767, new_fact ), exc16kWhtnd[k] ); // Q_exc16kWhtnd move16(); } } @@ -4718,14 +4730,9 @@ void GenShapedSHBExcitation_ivas_dec_fx( PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); } ELSE -#endif { -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( EQ_16( coder_type, UNVOICED ) || EQ_16( MSFlag, 1 ) ) -#else - IF( EQ_16( coder_type, UNVOICED ) ) -#endif { L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); test(); @@ -4737,16 +4744,12 @@ void GenShapedSHBExcitation_ivas_dec_fx( scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ FOR( k = 0; k < L_FRAME16k; k++ ) { - /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */ - L_tmp = L_mult( White_exc16k[k], scale ); - /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */ - exc16kWhtnd[k] = round_fx_sat( L_shl_sat( L_tmp, NOISE_QADJ ) ); + exc16kWhtnd[k] = mult_r_sat( White_exc16k[k], scale ); move16(); - /* exc16kWhtnd: Q_bwe_exc */ } PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); - /* i/o: exc16kWhtnd (Q_bwe_exc) */ - /* i/o: tbe_premph (Q_bwe_exc) */ + /* i/o: exc16kWhtnd (Q_exc16kWhtnd) */ + /* i/o: tbe_premph (Q_exc16kWhtnd) */ } ELSE { @@ -4809,11 +4812,10 @@ void GenShapedSHBExcitation_ivas_dec_fx( FOR( j = 0; j < lSubFr; j++ ) { /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */ - L_tmp = L_mult( temp2, White_exc16k[k + j] ); /* 16+(Q_bwe_exc-NOISE_QADJ)*/ - L_tmp = L_shl_sat( L_tmp, NOISE_QADJ ); /* 16+(Q_bwe_exc) */ + L_tmp = L_mult( temp2, White_exc16k[k + j] ); exc16kWhtnd[k + j] = mac_r_sat( L_tmp, temp1, exc16kWhtnd[k + j] ); move16(); - /* Q_bwe_exc */ + /* Q_exc16kWhtnd */ } k = add( k, lSubFr ); @@ -4827,19 +4829,18 @@ void GenShapedSHBExcitation_ivas_dec_fx( temp2 = add( temp, shl( temp1, -1 ) ); /* shift right by 1 to avoid overflow */ temp = div_s( temp, temp2 ); /* Q15 */ temp = mult_r( PREEMPH_FAC, temp ); - PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph ); - /* exc16kWhtnd: Q_bwe_exc; - tbe_premph: Q_bwe_exc*/ + /* exc16kWhtnd: Q_exc16kWhtnd; + tbe_premph: Q_exc16kWhtnd*/ } } } + *tbe_premph = shl_sat( *tbe_premph, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); + move16(); + Scale_sig( White_exc16k, L_FRAME16k, sub( sub( *Q_bwe_exc, NOISE_QADJ ), Q_White_exc16k ) ); + Scale_sig( exc16kWhtnd, L_FRAME16k, sub( *Q_bwe_exc, Q_White_exc16k ) ); -#if 1 // def ADD_IVAS_TBE_CODE IF( LT_32( extl_brate, SWB_TBE_2k8 ) ) -#else - IF( LT_32( bitrate, ACELP_24k40 ) ) -#endif { Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 ); /* i: exc16kWhtnd in Q_bwe_exc */ -- GitLab From dae405dff2d126ba3527028002c3ba0aac5e5985 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 7 Apr 2025 17:57:40 +0530 Subject: [PATCH 323/358] Fix for LTV crashes --- lib_com/ivas_spar_com_fx.c | 10 ++++++---- lib_enc/ext_sig_ana_fx.c | 12 ++++++------ lib_enc/pvq_core_enc_fx.c | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index 0da6b90c2..8aaeb7f63 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -2658,14 +2658,16 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( factor = L_max( factor, tmp ); // q_factor } - tmp = L_shl_sat( IVAS_FIX_EPS_Q40, sub( q_factor, 40 ) ); + tmp = L_shl_sat( 189 /* 1e-20 in Q74 */, sub( q_factor, 74 ) ); Word16 factor_exp = 0; move16(); IF( LE_32( factor, tmp ) ) { - factor = 1250000000; - factor_exp = Q31 - ( -4 ); + factor = 22204; // (1 / 1e-20) in Q(-52) + factor_exp = Q15 - ( -52 ); + move32(); + move16(); } ELSE { @@ -2688,7 +2690,7 @@ static void ivas_calc_p_coeffs_per_band_enc_fx( { q_tmp = W_norm( W_tmp ); } - cov_uu_re[i - num_dmx][j - num_dmx] = W_extract_h( W_shl( W_mult0_32_32( cov_uu_re[i - num_dmx][j - num_dmx], factor ), q_tmp ) ); /*q_cov_uu_re+15-factor_exp+q_tmp-32*/ + cov_uu_re[i - num_dmx][j - num_dmx] = W_extract_h( W_shl( W_tmp, q_tmp ) ); /*q_cov_uu_re+15-factor_exp+q_tmp-32*/ move32(); q_cov_uu_re_per_value[i - num_dmx][j - num_dmx] = sub( add( add( q_cov_uu_re, sub( 15, factor_exp ) ), q_tmp ), 32 ); move16(); diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 58c1f9641..200e7e8ed 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -987,7 +987,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* Outter left folding */ FOR( i = 0; i < folding_offset; i++ ) { - tcx20Win[folding_offset + i] = sub( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win + tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // q_tcx20Win move16(); } @@ -1002,14 +1002,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } } @@ -1018,7 +1018,7 @@ void core_signal_analysis_high_bitrate_ivas_fx( tmp = shr( right_overlap, 1 ); FOR( i = 0; i < tmp; i++ ) { - tcx20Win[L_subframe + folding_offset - 1 - i] = add( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win + tcx20Win[L_subframe + folding_offset - 1 - i] = add_sat( tcx20Win[L_subframe + folding_offset - 1 - i], tcx20Win[L_subframe + folding_offset + i] ); // q_tcx20Win move16(); } @@ -1122,14 +1122,14 @@ void core_signal_analysis_high_bitrate_ivas_fx( { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im ); // (Q16, Q15) -> Q16 + q_tcx20Win - tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ { L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_tcx20Win, Q15) -> Q16 + q_tcx20Win L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re ); // (Q16 + q_tcx20Win, Q15) -> Q16 + q_tcx20Win - tcx20Win[left_overlap + i] = sub( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win + tcx20Win[left_overlap + i] = sub_sat( tcx20Win[left_overlap + i], extract_h( L_tmp ) ); // q_tcx20Win move32(); } } diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 356f2beaf..e2d5fb264 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -550,8 +550,8 @@ Word16 pvq_core_enc_ivas_fx( get_max_pulses_fx( sfm_start, sfm_end, ord, npulses, nb_sfm, pulse_vector, maxpulse ); /* Fine gain prediction */ - fine_gain_pred_fx( sfm_start, sfm_end, sfmsize, ord, npulses, maxpulse, R, nb_sfm, - coefs_quant, pulse_vector, fg_pred, core ); + ivas_fine_gain_pred_fx( sfm_start, sfm_end, sfmsize, ord, npulses, maxpulse, R, nb_sfm, + coefs_quant, pulse_vector, fg_pred, core ); fine_gain_quant_fx( hBstr, ord, nb_sfm, gain_bits_array, fg_pred, gopt ); -- GitLab From fc7b3bc84d82d9419b007699399f8a79e9bbd11c Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 7 Apr 2025 20:24:42 +0200 Subject: [PATCH 324/358] Improve precision of proto power. Reduces hight frequency noise for MASA_1dir_2TC_at_96_kbps_48kHz_in_48kHz_out_MONO test case. --- diff | 1068 ----------------- lib_com/options.h | 2 +- lib_dec/ivas_dirac_dec_fx.c | 27 +- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 61 +- lib_rend/ivas_dirac_rend_fx.c | 293 ++++- 5 files changed, 306 insertions(+), 1145 deletions(-) delete mode 100644 diff diff --git a/diff b/diff deleted file mode 100644 index e782cdaf8..000000000 --- a/diff +++ /dev/null @@ -1,1068 +0,0 @@ -diff --git a/Makefile b/Makefile -index 9d18cbde..8087038a 100644 ---- a/Makefile -+++ b/Makefile -@@ -26,10 +26,17 @@ LIB_LIBREND ?= libivasrend.a - LIB_LIBUTIL ?= libivasutil.a - - # Default tool settings --CC ?= gcc -+#CC ?= gcc -+CC ?= clang - RM ?= rm -f - AR ?= ar - -+#CFLAGS += -fsanitize=address,undefined,integer,nullability -+#LDFLAGS += -fsanitize=address,undefined,integer,nullability -+#CFLAGS += -fsanitize=address,undefined,nullability -+#LDFLAGS += -fsanitize=address,undefined,nullability -+ -+ - # Detect system - UNAME_S := $(shell uname -s) - -diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c -index 48c00ed9..12bfee13 100644 ---- a/lib_dec/ivas_dirac_dec_fx.c -+++ b/lib_dec/ivas_dirac_dec_fx.c -@@ -3678,6 +3678,7 @@ void ivas_dirac_dec_render_sf_fx( - 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 ); -+#if 0 - IF( LT_16( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_reference_power_smooth[0], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0] ) ); // q_reference_power_smooth[0] -@@ -3696,10 +3697,11 @@ void ivas_dirac_dec_render_sf_fx( - q_reference_power_smooth[0] = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[0]; - move16(); - } -- -+#endif - exp = L_norm_arr( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - scale_sig32( reference_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), exp ); // q_reference_power_smooth + exp - q_reference_power_smooth[1] = add( q_reference_power_smooth[1], exp ); -+#if 0 - IF( LT_16( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ) - { - 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( q_reference_power_smooth[1], hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1] ) ); // q_reference_power_smooth -@@ -3718,6 +3720,7 @@ 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(); - } -+#endif - #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 -@@ -3782,6 +3785,7 @@ void ivas_dirac_dec_render_sf_fx( - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); - move16(); -+#if 0 - IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) - { - FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) -@@ -3800,6 +3804,7 @@ void ivas_dirac_dec_render_sf_fx( - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; - move16(); - } -+#endif - exp = 31; - move16(); - FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) -@@ -3812,6 +3817,7 @@ void ivas_dirac_dec_render_sf_fx( - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); - move16(); -+#if 0 - IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ) - { - FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) -@@ -3830,6 +3836,7 @@ 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(); - } -+#endif - #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) -diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c -index 77826b96..1cc6cd4d 100644 ---- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c -+++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c -@@ -2173,13 +2173,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( - reference_power_smooth[l] ); //(Q31, q_reference_power_smooth) -> q_reference_power_smooth - 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 -+#ifndef FIX_867_CLDFB_NRG_SCALE - 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 -@@ -2187,6 +2182,23 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( - - exp = 0; - move16(); -+#else -+ Word16 s1, s2, qidx; -+ qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -+ -+ s1 = s_max( 0, sub( q_reference_power_smooth[qidx], h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx] ) ); -+ s2 = s_max( 0, sub( h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx], q_reference_power_smooth[qidx] ) ); -+ currWeight = L_shr( currWeight, s1 ); -+ prevWeight = L_shr( prevWeight, s2 ); -+ 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 -+ sumWeight = L_add( currWeight, prevWeight ); // q_reference_power_smooth -+ -+ exp = s_min( q_reference_power_smooth[qidx], h_dirac_output_synthesis_state->reference_power_smooth_prev_q[qidx] ); -+ move16(); -+#endif -+ - #if 1 - tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); /*Q(15-exp)*/ - smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 -@@ -2222,6 +2234,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( - p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; - set16_fx( exp_arr, 0, i_mult( num_protos_dir, num_freq_bands ) ); - -+#ifndef FIX_867_CLDFB_NRG_SCALE - FOR( k = 0; k < num_protos_dir; k++ ) - { - FOR( l = 0; l < num_freq_bands; l++ ) -@@ -2234,27 +2247,76 @@ 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(); - -+ assert(h_dirac_output_synthesis_state->proto_power_smooth_prev_q == h_dirac_output_synthesis_state->proto_power_smooth_q); -+ - IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) - { - p_power_smooth_prev++; -- L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ -+ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - exp_arr[k * num_freq_bands + l] = exp; - move16(); - -- *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-q_proto_power_smooth))*/ -+ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - move32(); - } - ELSE - { -- L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ -+ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - exp_arr[k * num_freq_bands + l] = exp; - move16(); - -- *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-q_proto_power_smooth))*/ -+ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - move32(); - } - } - } -+#else -+ Word16 shift_prev0, shift_curr0, shift_prev1, shift_curr1; -+ shift_prev0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); -+ shift_curr0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); -+ shift_prev1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); -+ shift_curr1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); -+ -+ FOR( k = 0; k < num_protos_dir; k++ ) -+ { -+ FOR( l = 0; l < CLDFB_NO_CHANNELS_HALF; l++ ) -+ { -+ g1 = alpha[l]; // Q31 -+ move32(); -+ g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 -+ *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev0 ) ) ); //(Q31, proto_power_smooth_q) -> proto_power_smooth_q -+ move32(); -+ *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), -+ L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr0 ) ); //(Q31, proto_power_smooth_q) -> min(proto_power_smooth_q, proto_power_smooth_prev_q) -+ move32(); -+ -+ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ -+ exp_arr[k * num_freq_bands + l] = exp; -+ move16(); -+ -+ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ -+ move32(); -+ } -+ FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) -+ { -+ g1 = alpha[l]; // Q31 -+ move32(); -+ g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 -+ *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev1 ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth -+ move32(); -+ *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), -+ L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr1 ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth -+ move32(); -+ -+ L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ -+ exp_arr[k * num_freq_bands + l] = exp; -+ move16(); -+ -+ *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ -+ move32(); -+ } -+ } -+#endif - - // Move proto_power_smooth_fx to common Q-factor - -@@ -2297,14 +2359,23 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( - p_power_smooth++; - } - } -+ -+ // Update the Q-factor -+#if 0 - q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); - q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); - -- // Update the Q-factor - h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = h_dirac_output_synthesis_state->proto_power_smooth_q[0]; - h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = h_dirac_output_synthesis_state->proto_power_smooth_q[1]; -- move16(); -- move16(); -+ move16(); move16(); -+#else -+ h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ); -+ h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ); -+ move16(); move16(); -+ -+ q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); -+ q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); -+#endif - h_dirac_output_synthesis_state->proto_power_smooth_q[0] = q_tmp; - h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; - move16(); -diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c -index 18c9269d..d1071b39 100644 ---- a/lib_rend/ivas_dirac_rend_fx.c -+++ b/lib_rend/ivas_dirac_rend_fx.c -@@ -1774,15 +1774,32 @@ 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], temp_q_shift, q_temp2; -+#else - Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; -+#endif - Word32 temp; - Word64 W_tmp1, W_tmp2; - Word64 reference_power_64fx[CLDFB_NO_CHANNELS_MAX]; - Word16 q_reference_power_64fx; -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ Word16 head_room, q_Left_Right_power[2]; -+#else - Word16 head_room, q_Left_Right_power; -+#endif -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ const 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 - temp_q_shift = Q31; - move16(); - q_sum_total_ratio = Q31; -@@ -1797,18 +1814,35 @@ 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 ); -+#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 - - #ifdef MSAN_FIX - 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 ) ) ); - #else - q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ), L_norm_arr( ImagBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ) ); - #endif // MSAN_FIX -+#ifdef FIX_867_CLDFB_NRG_SCALE -+#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 -+#endif - temp_q_shift = s_min( temp_q_shift, q_shift ); - } - -+#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 - temp_q_shift = sub( temp_q_shift, 2 ); // guard bits - - /* Upscaling of the buffer proto_power_smooth_fx */ -@@ -1868,16 +1902,29 @@ void protoSignalComputation2_fx( - { - 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 ); -+ move16(); -+#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 - -@@ -1894,14 +1941,13 @@ 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 -- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -1910,7 +1956,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -1925,13 +1971,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -1940,7 +1986,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -1954,13 +2000,13 @@ void protoSignalComputation2_fx( - - 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -1969,7 +2015,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2042,20 +2088,29 @@ void protoSignalComputation2_fx( - interpolatorSpaced_fx = sub( MAX16B, interpolatorDmx_fx ); /* Q15 */ - } - } -- -+#ifndef FIX_867_CLDFB_NRG_SCALE - 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 - q_temp2 = sub( add( add( q_cldfb, temp_q_shift ), add( q_cldfb, temp_q_shift ) ), 31 ); -- - 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 ) ); -@@ -2063,15 +2118,28 @@ void protoSignalComputation2_fx( - head_room = s_min( head_room, W_norm( W_add( W_tmp1, W_tmp2 ) ) ); - } - head_room = sub( head_room, find_guarded_bits_fx( num_freq_bands ) ); -+ -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ q_Left_Right_power[0] = add( shl( add( q_cldfb, min_q_shift[0] ), 1 ), sub( head_room, 32 ) ); -+ q_Left_Right_power[1] = add( shl( add( q_cldfb, min_q_shift[1] ), 1 ), sub( head_room, 32 ) ); -+#else - q_Left_Right_power = add( shl( add( q_cldfb, min_q_shift ), 1 ), sub( head_room, 32 ) ); -+#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 - /* Compute sum signal */ - Real_aux_fx = L_add( re1, re2 ); // q_cldfb+min_q_shift - Imag_aux_fx = L_add( im1, im2 ); // q_cldfb+min_q_shift -@@ -2091,6 +2159,7 @@ void protoSignalComputation2_fx( - 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] ); -+ assert(0 /* Fix 2 scale regions for total_bb_power_fx, left_hi_power_fx, right_hi_power_fx and total_hi_power_fx */ ); - 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 - - IF( GT_16( l, MASA_HI_FREQ_START_BIN ) ) -@@ -2103,9 +2172,14 @@ void protoSignalComputation2_fx( - - IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) - { -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ assert( qidx == 0 ); -+ re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[qidx] ) ); // q_cldfb+temp_q_shift -+ im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift[qidx] ) ); // q_cldfb+temp_q_shift -+#else - re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift - im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift -- -+#endif - sum_power_fx = Madd_32_32( Mpy_32_32( re_aux, re_aux ), im_aux, im_aux ); // 2*(q_cldfb+temp_q_shift)-31 - temp = Mpy_32_32( a_fx, sum_power_fx ); // 2*(q_cldfb+temp_q_shift)-31 - -@@ -2121,6 +2195,18 @@ void protoSignalComputation2_fx( - } - - temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ IF( LT_16( q_temp[qidx], stereo_type_detect->q_total_power ) ) -+ { -+ stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); // q_temp -+ move32(); -+ } -+ ELSE -+ { -+ stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power -+ move32(); -+ } -+#else - IF( LT_16( q_temp, stereo_type_detect->q_total_power ) ) - { - stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp ) ) ); // q_temp -@@ -2131,7 +2217,7 @@ void protoSignalComputation2_fx( - stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power - move32(); - } -- -+#endif - test(); - IF( ( stereo_type_detect->sum_power_fx[l] == 0 ) && ( stereo_type_detect->total_power_fx[l] == 0 ) ) - { -@@ -2147,7 +2233,11 @@ void protoSignalComputation2_fx( - { - sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], stereo_type_detect->total_power_fx[l], &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) - move32(); -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); -+#else - q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) ); -+#endif - sum_total_ratio_fx[l] = L_shl( sum_total_ratio_fx[l], sub( Q15, q_sum_total_ratio ) ); // q15 - move32(); - } -@@ -2159,6 +2249,22 @@ 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 ) ) -+ { -+ 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[qidx] ) ), temp ); // q_temp -+ move32(); -+ stereo_type_detect->q_subtract_power_y = q_temp[qidx]; -+ move16(); -+ } -+ ELSE -+ { -+ 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(); -+ } -+ -+#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 -@@ -2171,12 +2277,10 @@ 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, 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 */ --#ifdef FIX_867_CLDFB_NRG_SCALE -- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); --#endif - - /* W prototype */ - IF( stereo_type_detect->interpolator > 0 ) -@@ -2188,13 +2292,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2203,7 +2307,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2222,13 +2326,13 @@ void protoSignalComputation2_fx( - - 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2237,7 +2341,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2258,13 +2362,13 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2273,7 +2377,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2289,13 +2393,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2304,7 +2408,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2321,13 +2425,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2336,7 +2440,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2376,13 +2480,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2391,7 +2495,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2418,13 +2522,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2433,7 +2537,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2459,13 +2563,13 @@ 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, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2474,7 +2578,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2499,8 +2603,12 @@ void protoSignalComputation2_fx( - - stereo_type_detect->q_sum_power = s_min( stereo_type_detect->q_sum_power, q_temp2 ); - move16(); -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ assert(0); -+#else - stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp ); - move16(); -+#endif - q_sum_total_ratio = Q15; - move16(); - -@@ -2517,6 +2625,22 @@ void protoSignalComputation2_fx( - } - - temp = Mpy_32_32( a_fx, left_bb_power_fx ); // q_Left_Right_power -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -+ assert( 0 /* qidx has no valid value ? */ ); -+ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_left_bb_power ) ) -+ { -+ stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power -+ move32(); -+ stereo_type_detect->q_left_bb_power = q_Left_Right_power[qidx]; -+ move16(); -+ } -+ ELSE -+ { -+ stereo_type_detect->left_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_left_bb_power ) ), b_fx, stereo_type_detect->left_bb_power_fx ); // stereo_type_detect->q_left_bb_power -+ move32(); -+ } -+#else - IF( LT_16( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ) - { - stereo_type_detect->left_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_bb_power_fx ), sub( stereo_type_detect->q_left_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power -@@ -2529,8 +2653,24 @@ void protoSignalComputation2_fx( - stereo_type_detect->left_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_left_bb_power ) ), b_fx, stereo_type_detect->left_bb_power_fx ); // stereo_type_detect->q_left_bb_power - move32(); - } -+#endif - - temp = Mpy_32_32( a_fx, right_bb_power_fx ); // q_Left_Right_power -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ assert( 0 /* qidx has no valid value ? */ ); -+ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_right_bb_power ) ) -+ { -+ stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power -+ move32(); -+ stereo_type_detect->q_right_bb_power = q_Left_Right_power[qidx]; -+ move16(); -+ } -+ ELSE -+ { -+ stereo_type_detect->right_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_right_bb_power ) ), b_fx, stereo_type_detect->right_bb_power_fx ); // stereo_type_detect->q_right_bb_power -+ move32(); -+ } -+#else - IF( LT_16( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ) - { - stereo_type_detect->right_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_bb_power_fx ), sub( stereo_type_detect->q_right_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power -@@ -2543,8 +2683,23 @@ void protoSignalComputation2_fx( - stereo_type_detect->right_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_right_bb_power ) ), b_fx, stereo_type_detect->right_bb_power_fx ); // stereo_type_detect->q_right_bb_power - move32(); - } -+#endif - - temp = Mpy_32_32( a_fx, total_bb_power_fx ); // q_Left_Right_power -+#ifdef FIX_867_CLDFB_NRG_SCALE -+ IF( LT_16( q_Left_Right_power[qidx], stereo_type_detect->q_total_bb_power ) ) -+ { -+ stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_Left_Right_power[qidx] ) ) ); // q_Left_Right_power -+ move32(); -+ stereo_type_detect->q_total_bb_power = q_Left_Right_power[qidx]; -+ move16(); -+ } -+ ELSE -+ { -+ stereo_type_detect->total_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power[qidx], stereo_type_detect->q_total_bb_power ) ), b_fx, stereo_type_detect->total_bb_power_fx ); // stereo_type_detect->q_total_bb_power -+ move32(); -+ } -+#else - IF( LT_16( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ) - { - stereo_type_detect->total_bb_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_bb_power_fx ), sub( stereo_type_detect->q_total_bb_power, q_Left_Right_power ) ) ); // q_Left_Right_power -@@ -2557,6 +2712,7 @@ void protoSignalComputation2_fx( - stereo_type_detect->total_bb_power_fx = Madd_32_32( L_shr( temp, sub( q_Left_Right_power, stereo_type_detect->q_total_bb_power ) ), b_fx, stereo_type_detect->total_bb_power_fx ); // stereo_type_detect->q_total_bb_power - move32(); - } -+#endif - - IF( LT_16( stereo_type_detect->q_left_bb_power, stereo_type_detect->q_right_bb_power ) ) - { -@@ -2583,6 +2739,9 @@ 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 -+ assert(0); -+#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 ); -@@ -2593,6 +2752,7 @@ void protoSignalComputation2_fx( - 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(); - -@@ -2637,19 +2797,33 @@ void protoSignalComputation2_fx( - move32(); - - ivas_masa_stereotype_detection_fx( stereo_type_detect ); -+ - } - ELSE - { - 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 -@@ -2659,14 +2833,13 @@ void protoSignalComputation2_fx( - move64(); - - #ifdef FIX_867_CLDFB_NRG_SCALE -- Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // q_temp -+ 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 -@@ -2675,7 +2848,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2694,13 +2867,13 @@ 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] ); // q_temp - #ifdef FIX_867_CLDFB_NRG_SCALE -- IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) -+ 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 ) ), temp ); // q_temp -+ 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 -@@ -2709,7 +2882,7 @@ void protoSignalComputation2_fx( - 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth -+ 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 -@@ -2730,9 +2903,11 @@ void protoSignalComputation2_fx( - proto_frame_f_fx[4 * num_freq_bands + 2 * l + 1] = im2; // q_cldfb+ min_q_shift - move32(); - } -+ - } -- q_reference_power_64fx = shl( add( q_cldfb, min_q_shift ), 1 ); - #ifdef FIX_867_CLDFB_NRG_SCALE -+ q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[0] ), 1 ); -+ - Word16 norm_shift = 63; - move16(); - FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) -@@ -2749,6 +2924,8 @@ void protoSignalComputation2_fx( - } - q_reference_power[0] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); - move16(); -+ -+ q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[1] ), 1 ); - norm_shift = 63; - move16(); - FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) -@@ -2766,6 +2943,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++ ) -@@ -2784,13 +2962,48 @@ void protoSignalComputation2_fx( - 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 ) -+ { -+ Scale_sig32(proto_frame_f_fx + l*2, CLDFB_NO_CHANNELS_HALF*2, sub( min_q_shift[1], min_q_shift[0] ) ); -+ } -+ *q_proto_frame_f = add( q_cldfb, min_q_shift[1] ); -+ move16(); -+ } ELSE { -+ FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) -+ { -+ Scale_sig32(proto_frame_f_fx + (l + CLDFB_NO_CHANNELS_HALF)*2, 2*s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( min_q_shift[0], min_q_shift[1] ) ); -+ } -+ *q_proto_frame_f = add( q_cldfb, min_q_shift[0] ); -+ move16(); -+ } -+ 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 ) -+ { -+ Scale_sig32(proto_direct_buffer_f_fx + l*2, CLDFB_NO_CHANNELS_HALF*2, sub( min_q_shift[1], min_q_shift[0] ) ); -+ } -+ *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[0] ); -+ move16(); -+ } ELSE { -+ FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) -+ { -+ Scale_sig32(proto_direct_buffer_f_fx + (l + CLDFB_NO_CHANNELS_HALF)*2, 2*s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( min_q_shift[0], min_q_shift[1] ) ); -+ } -+ *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 ); -- q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp ); -+ 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 diff --git a/lib_com/options.h b/lib_com/options.h index 37660ea47..f9c99b0f9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,7 +68,7 @@ #endif #define FIX_867_CLDFB_NRG_SCALE - +#define FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE #define FIX_1378_ACELP_OUT_OF_BOUNDS diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index c2ef3b92e..d186de136 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3727,6 +3727,20 @@ void ivas_dirac_dec_render_sf_fx( } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], exp ); move16(); + exp = 31; + move16(); + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + exp = s_min( exp, L_norm_arr( 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 ) ) ) ); + } + FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); + move16(); + +#ifndef FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) { FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -3745,18 +3759,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0]; move16(); } - exp = 31; - move16(); - FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) - { - exp = s_min( exp, L_norm_arr( 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 ) ) ) ); - } - FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + i, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), exp ); // Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + exp) - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); - move16(); IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ) ) { FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -3775,6 +3777,7 @@ 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(); } +#endif #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) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 8b94a7cf7..93533c702 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2247,6 +2247,53 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; set16_fx( exp_arr, 0, i_mult( num_protos_dir, num_freq_bands ) ); +#ifdef FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE + Word16 shift_prev0, shift_curr0, shift_prev1, shift_curr1; + shift_prev0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); + shift_curr0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); + shift_prev1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); + shift_curr1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ ) + { + g1 = alpha[l]; // Q31 + move32(); + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev0 ) ) ); //(Q31, proto_power_smooth_q) -> proto_power_smooth_q + move32(); + *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), + L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr0 ) ); //(Q31, proto_power_smooth_q) -> min(proto_power_smooth_q, proto_power_smooth_prev_q) + move32(); + + L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ + exp_arr[k * num_freq_bands + l] = exp; + move16(); + + *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ + move32(); + } + FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) + { + g1 = alpha[l]; // Q31 + move32(); + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev1 ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth + move32(); + *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), + L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr1 ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth + move32(); + + L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + exp_arr[k * num_freq_bands + l] = exp; + move16(); + + *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ + move32(); + } + } +#else FOR( k = 0; k < num_protos_dir; k++ ) { FOR( l = 0; l < num_freq_bands; l++ ) @@ -2286,6 +2333,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( } } } +#endif // Move proto_power_smooth_fx to common Q-factor @@ -2328,14 +2376,15 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( p_power_smooth++; } } - q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); - q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); // Update the Q-factor - h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = h_dirac_output_synthesis_state->proto_power_smooth_q[0]; - h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = h_dirac_output_synthesis_state->proto_power_smooth_q[1]; - move16(); - move16(); + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ); + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ); + move16(); move16(); + + q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); + q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); + h_dirac_output_synthesis_state->proto_power_smooth_q[0] = q_tmp; h_dirac_output_synthesis_state->proto_power_smooth_q[1] = q_tmp2; move16(); diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 573ece7cb..1ded63197 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1762,15 +1762,28 @@ 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], temp_q_shift, q_temp2; +#else Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; +#endif Word32 temp; Word64 W_tmp1, W_tmp2; 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 temp_q_shift = Q31; move16(); q_sum_total_ratio = Q31; @@ -1785,31 +1798,47 @@ 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 ) ) ); temp_q_shift = s_min( temp_q_shift, q_shift ); } +#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 temp_q_shift = sub( temp_q_shift, 2 ); // guard bits /* Upscaling of the buffer proto_power_smooth_fx */ #ifdef FIX_867_CLDFB_NRG_SCALE IF( isloudspeaker ) { - q_shift = getScaleFactor32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + num_proto = 3; + q_shift = L_norm_arr( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { - q_shift = getScaleFactor32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + num_proto = 2; + q_shift = L_norm_arr( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); scale_sig32( proto_power_smooth_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } @@ -1817,17 +1846,17 @@ void protoSignalComputation2_fx( move16(); IF( isloudspeaker ) { - q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + q_shift = L_norm_arr( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } ELSE { - q_shift = getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - q_shift = s_min( q_shift, getScaleFactor32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); + q_shift = L_norm_arr( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); + q_shift = s_min( q_shift, L_norm_arr( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 scale_sig32( proto_power_smooth_fx + CLDFB_NO_CHANNELS_HALF + num_freq_bands, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_shift, 1 ) ); // q_proto_power_smooth+q_shift-1 } @@ -1852,15 +1881,29 @@ void protoSignalComputation2_fx( { 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 @@ -1878,14 +1921,13 @@ 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 - Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); - IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -1894,7 +1936,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -1909,13 +1951,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -1924,7 +1966,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -1938,13 +1980,13 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -1953,7 +1995,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2027,19 +2069,32 @@ void protoSignalComputation2_fx( } } +#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 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 q_temp2 = sub( add( add( q_cldfb, temp_q_shift ), add( q_cldfb, temp_q_shift ) ), 31 ); 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 ) ); @@ -2047,14 +2102,30 @@ void protoSignalComputation2_fx( head_room = s_min( head_room, W_norm( W_add( W_tmp1, W_tmp2 ) ) ); } 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 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 @@ -2064,6 +2135,7 @@ void protoSignalComputation2_fx( // Left_power_fx = Madd_32_32( Mpy_32_32( re1, re1 ), im1, im1 ); W_tmp1 = W_add( W_mult0_32_32( re1, re1 ), W_mult0_32_32( im1, im1 ) ); // 2*(q_cldfb+min_q_shift) Left_power_fx = W_extract_h( W_shl( W_tmp1, head_room ) ); // q_Left_Right_power + // Right_power_fx = Madd_32_32( Mpy_32_32( re2, re2 ), im2, im2 ); W_tmp2 = W_add( W_mult0_32_32( re2, re2 ), W_mult0_32_32( im2, im2 ) ); // 2*(q_cldfb+min_q_shift) Right_power_fx = W_extract_h( W_shl( W_tmp2, head_room ) ); // q_Left_Right_power @@ -2087,8 +2159,13 @@ void protoSignalComputation2_fx( IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) { +#ifdef FIX_867_CLDFB_NRG_SCALE + re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[0]) ); // q_cldfb+temp_q_shift + im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift[0] ) ); // q_cldfb+temp_q_shift +#else re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift +#endif sum_power_fx = Madd_32_32( Mpy_32_32( re_aux, re_aux ), im_aux, im_aux ); // 2*(q_cldfb+temp_q_shift)-31 temp = Mpy_32_32( a_fx, sum_power_fx ); // 2*(q_cldfb+temp_q_shift)-31 @@ -2105,6 +2182,18 @@ void protoSignalComputation2_fx( } temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 +#ifdef FIX_867_CLDFB_NRG_SCALE + IF( LT_16( q_temp[qidx], stereo_type_detect->q_total_power ) ) + { + stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); // q_temp + move32(); + } + ELSE + { + stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power + move32(); + } +#else IF( LT_16( q_temp, stereo_type_detect->q_total_power ) ) { stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp ) ) ); // q_temp @@ -2115,6 +2204,7 @@ void protoSignalComputation2_fx( stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power move32(); } +#endif test(); IF( ( stereo_type_detect->sum_power_fx[l] == 0 ) && ( stereo_type_detect->total_power_fx[l] == 0 ) ) @@ -2131,7 +2221,11 @@ void protoSignalComputation2_fx( { sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], stereo_type_detect->total_power_fx[l], &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) move32(); +#ifdef FIX_867_CLDFB_NRG_SCALE + q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); +#else q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) ); +#endif sum_total_ratio_fx[l] = L_shl( sum_total_ratio_fx[l], sub( Q15, q_sum_total_ratio ) ); // q15 move32(); } @@ -2143,6 +2237,21 @@ 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 + IF( LT_16( q_temp[qidx], 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[qidx] ) ), temp ); // q_temp + move32(); + stereo_type_detect->q_subtract_power_y = q_temp[qidx]; + move16(); + } + ELSE + { + 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(); + } + +#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 @@ -2155,12 +2264,10 @@ 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, 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 */ -#ifdef FIX_867_CLDFB_NRG_SCALE - Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); -#endif /* W prototype */ IF( stereo_type_detect->interpolator > 0 ) @@ -2172,13 +2279,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2187,7 +2294,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2206,13 +2313,13 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2221,7 +2328,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2242,13 +2349,13 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2257,7 +2364,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2273,13 +2380,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2288,7 +2395,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2305,13 +2412,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2320,7 +2427,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2360,13 +2467,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2375,7 +2482,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2402,13 +2509,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2417,7 +2524,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2443,13 +2550,13 @@ 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, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2458,7 +2565,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2483,8 +2590,13 @@ void protoSignalComputation2_fx( stereo_type_detect->q_sum_power = s_min( stereo_type_detect->q_sum_power, q_temp2 ); move16(); +#ifdef FIX_867_CLDFB_NRG_SCALE + stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp[0] ); + move16(); +#else stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp ); move16(); +#endif q_sum_total_ratio = Q15; move16(); @@ -2567,6 +2679,18 @@ 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 ), sub( 31, q_temp[0] ), 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[0] ), 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[0] ), 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 ); @@ -2577,6 +2701,7 @@ void protoSignalComputation2_fx( 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(); @@ -2626,14 +2751,27 @@ 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 @@ -2643,14 +2781,13 @@ void protoSignalComputation2_fx( move64(); #ifdef FIX_867_CLDFB_NRG_SCALE - Word16 qidx = s_min( 1, s_max( 0, sub( l, CLDFB_NO_CHANNELS_HALF - 1 ) ) ); - IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) + 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 ) ), W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // q_temp + 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 @@ -2659,7 +2796,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2678,13 +2815,13 @@ 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] ); // q_temp #ifdef FIX_867_CLDFB_NRG_SCALE - IF( LT_16( q_temp, q_proto_power_smooth[qidx] ) ) + 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 ) ), temp ); // q_temp + 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 @@ -2693,7 +2830,7 @@ void protoSignalComputation2_fx( 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, q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth + 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 @@ -2714,9 +2851,11 @@ void protoSignalComputation2_fx( proto_frame_f_fx[4 * num_freq_bands + 2 * l + 1] = im2; // q_cldfb+ min_q_shift move32(); } + } - q_reference_power_64fx = shl( add( q_cldfb, min_q_shift ), 1 ); #ifdef FIX_867_CLDFB_NRG_SCALE + q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[0] ), 1 ); + Word16 norm_shift = 63; move16(); FOR( l = 0; l < s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ); l++ ) @@ -2733,6 +2872,8 @@ void protoSignalComputation2_fx( } q_reference_power[0] = sub( add( q_reference_power_64fx, norm_shift ), 32 ); move16(); + + q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[1] ), 1 ); norm_shift = 63; move16(); FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) @@ -2750,6 +2891,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++ ) @@ -2768,13 +2910,48 @@ void protoSignalComputation2_fx( 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 ) + { + Scale_sig32(proto_frame_f_fx + shl( l, 1) , shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); + } + *q_proto_frame_f = add( q_cldfb, min_q_shift[1] ); + move16(); + } ELSE { + FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) + { + Scale_sig32(proto_frame_f_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); + } + *q_proto_frame_f = add( q_cldfb, min_q_shift[0] ); + move16(); + } + 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 ) + { + Scale_sig32(p_proto_buffer_fx + shl( l, 1) , shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); + } + *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[1] ); + move16(); + } ELSE { + FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) + { + Scale_sig32(p_proto_buffer_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); + } + *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 ); - q_proto_power_smooth[1] = s_min( q_proto_power_smooth[1], q_temp ); + 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 -- GitLab From aab8df2e95447dbae770bf63769b44cce59cca36 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 7 Apr 2025 20:29:52 +0200 Subject: [PATCH 325/358] clang format and deactivate FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE. --- lib_com/options.h | 2 +- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 19 +++---- lib_rend/ivas_dirac_rend_fx.c | 50 ++++++++++--------- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f9c99b0f9..e5c7467a0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,7 +68,7 @@ #endif #define FIX_867_CLDFB_NRG_SCALE -#define FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE +//#define FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE #define FIX_1378_ACELP_OUT_OF_BOUNDS diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 93533c702..44ddf8609 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2249,10 +2249,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( #ifdef FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE Word16 shift_prev0, shift_curr0, shift_prev1, shift_curr1; - shift_prev0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); - shift_curr0 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); - shift_prev1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); - shift_curr1 = s_max( 0 , sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); + shift_prev0 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); + shift_curr0 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); + shift_prev1 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); + shift_curr1 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); FOR( k = 0; k < num_protos_dir; k++ ) { @@ -2260,7 +2260,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { g1 = alpha[l]; // Q31 move32(); - g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev0 ) ) ); //(Q31, proto_power_smooth_q) -> proto_power_smooth_q move32(); *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), @@ -2278,10 +2278,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { g1 = alpha[l]; // Q31 move32(); - g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev1 ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth move32(); - *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), + *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr1 ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth move32(); @@ -2379,8 +2379,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( // Update the Q-factor h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ); - h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ); - move16(); move16(); + h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] = s_min( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ); + move16(); + move16(); q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); q_tmp2 = add( sub( Q31, min_exp2 ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 1ded63197..3b32d30d1 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1779,7 +1779,8 @@ void protoSignalComputation2_fx( #ifdef FIX_867_CLDFB_NRG_SCALE min_q_shift[0] = Q31; min_q_shift[1] = Q31; - move16(); move16(); + move16(); + move16(); #else min_q_shift = Q31; move16(); @@ -1815,10 +1816,10 @@ void protoSignalComputation2_fx( } #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 + 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 + min_q_shift = sub( min_q_shift, 2 ); // guard bits #endif temp_q_shift = sub( temp_q_shift, 2 ); // guard bits @@ -2105,7 +2106,7 @@ void protoSignalComputation2_fx( #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 +#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 @@ -2121,10 +2122,10 @@ void protoSignalComputation2_fx( 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 + 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 */ @@ -2160,7 +2161,7 @@ void protoSignalComputation2_fx( IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) { #ifdef FIX_867_CLDFB_NRG_SCALE - re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[0]) ); // q_cldfb+temp_q_shift + re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[0] ) ); // q_cldfb+temp_q_shift im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift[0] ) ); // q_cldfb+temp_q_shift #else re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift @@ -2851,7 +2852,6 @@ void protoSignalComputation2_fx( proto_frame_f_fx[4 * num_freq_bands + 2 * l + 1] = im2; // q_cldfb+ min_q_shift move32(); } - } #ifdef FIX_867_CLDFB_NRG_SCALE q_reference_power_64fx = shl( add( q_cldfb, min_q_shift[0] ), 1 ); @@ -2911,34 +2911,38 @@ void protoSignalComputation2_fx( #endif #ifdef FIX_867_CLDFB_NRG_SCALE - IF ( GT_16( min_q_shift[0], min_q_shift[1] ) ) + 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 ) + FOR( l = 0; l < i_mult( num_proto, num_freq_bands ); l += num_freq_bands ) { - Scale_sig32(proto_frame_f_fx + shl( l, 1) , shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); + Scale_sig32( proto_frame_f_fx + shl( l, 1 ), shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); } *q_proto_frame_f = add( q_cldfb, min_q_shift[1] ); move16(); - } ELSE { - FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) + } + ELSE + { + FOR( l = 0; l < i_mult( num_proto, num_freq_bands ); l += num_freq_bands ) { - Scale_sig32(proto_frame_f_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); + Scale_sig32( proto_frame_f_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); } *q_proto_frame_f = add( q_cldfb, min_q_shift[0] ); move16(); } - IF ( GT_16( min_q_shift[0], min_q_shift[1] ) ) + 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 ) + FOR( l = 0; l < i_mult( num_proto, num_freq_bands ); l += num_freq_bands ) { - Scale_sig32(p_proto_buffer_fx + shl( l, 1) , shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); + Scale_sig32( p_proto_buffer_fx + shl( l, 1 ), shl( s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ), 1 ), sub( min_q_shift[1], min_q_shift[0] ) ); } *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[1] ); move16(); - } ELSE { - FOR ( l = 0; l < i_mult(num_proto, num_freq_bands); l += num_freq_bands ) + } + ELSE + { + FOR( l = 0; l < i_mult( num_proto, num_freq_bands ); l += num_freq_bands ) { - Scale_sig32(p_proto_buffer_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); + Scale_sig32( p_proto_buffer_fx + shl( add( l, CLDFB_NO_CHANNELS_HALF ), 1 ), shl( s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), 1 ), sub( min_q_shift[0], min_q_shift[1] ) ); } *q_proto_direct_buffer_f = add( q_cldfb, min_q_shift[0] ); move16(); -- GitLab From 3f24f37600668fd12c833eec819aa9ca208d4a2a Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 8 Apr 2025 08:11:19 +0200 Subject: [PATCH 326/358] Correct calculation of total_bb_power_fx --- lib_rend/ivas_dirac_rend_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 3b32d30d1..02a26a74e 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2071,6 +2071,10 @@ void protoSignalComputation2_fx( } #ifdef FIX_867_CLDFB_NRG_SCALE + /* Make both shift the same because of total_bb_power_fx */ + min_q_shift[0] = s_min( min_q_shift[0], min_q_shift[1] ); + min_q_shift[1] = min_q_shift[0]; + move16(); 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 -- GitLab From b9db88a72c7431e0c15373b1edf9bcb619fb422f Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 8 Apr 2025 16:48:44 +0200 Subject: [PATCH 327/358] Fix missing guard bits. Fixes regression for MASA_2dir_2TC_at_128_kbps_48kHz_in_48kHz_out_FOA. --- lib_rend/ivas_dirac_rend_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 02a26a74e..d64cffa26 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2075,6 +2075,8 @@ void protoSignalComputation2_fx( min_q_shift[0] = s_min( min_q_shift[0], min_q_shift[1] ); min_q_shift[1] = min_q_shift[0]; move16(); + min_q_shift[0] = sub( min_q_shift[0], idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); + 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 -- GitLab From 8cf8d354f628490634ab12caad66a9773113c381 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 8 Apr 2025 18:12:01 +0200 Subject: [PATCH 328/358] Improve proto power accuracy also for stereo_type_detect not NULL case. --- lib_rend/ivas_dirac_rend_fx.c | 42 ++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index d64cffa26..576964c29 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2071,14 +2071,15 @@ void protoSignalComputation2_fx( } #ifdef FIX_867_CLDFB_NRG_SCALE - /* Make both shift the same because of total_bb_power_fx */ - min_q_shift[0] = s_min( min_q_shift[0], min_q_shift[1] ); - min_q_shift[1] = min_q_shift[0]; - move16(); + Word16 total_shift[2], q_temp_total; + /* total_shift shift required to get common Q */ + total_shift[0] = s_max( 0, sub( min_q_shift[0], min_q_shift[1] ) ); + total_shift[1] = s_max( 0, sub( min_q_shift[1], min_q_shift[0] ) ); min_q_shift[0] = sub( min_q_shift[0], idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); 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 ); + q_temp_total = s_min( q_temp[0], q_temp[1] ); #else min_q_shift = sub( min_q_shift, idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); @@ -2151,17 +2152,30 @@ 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 ) ) { left_hi_power_fx = L_add( left_hi_power_fx, Left_power_fx ); // q_Left_Right_power right_hi_power_fx = L_add( right_hi_power_fx, Right_power_fx ); // q_Left_Right_power // total_hi_power_fx = L_add( total_hi_power_fx, reference_power_fx[l] ); +#ifdef FIX_867_CLDFB_NRG_SCALE + total_hi_power_fx = L_add( total_hi_power_fx, W_extract_h( W_shl( reference_power_64fx[l], sub( head_room, total_shift[qidx] ) ) ) ); // q_Left_Right_power +#else total_hi_power_fx = L_add( total_hi_power_fx, W_extract_h( W_shl( reference_power_64fx[l], head_room ) ) ); // q_Left_Right_power +#endif } IF( LT_16( l, s_min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) ) @@ -2188,19 +2202,20 @@ void protoSignalComputation2_fx( move32(); } - temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 #ifdef FIX_867_CLDFB_NRG_SCALE - IF( LT_16( q_temp[qidx], stereo_type_detect->q_total_power ) ) + temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], add( 31, total_shift[qidx] ) ) ) ); // 2*(q_cldfb+min_q_shift) -31 + IF( LT_16( q_temp_total, stereo_type_detect->q_total_power ) ) { - stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); // q_temp + stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp_total ) ) ); // q_temp move32(); } ELSE { - stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power + stereo_type_detect->total_power_fx[l] = L_add( L_shr( temp, sub( q_temp_total, stereo_type_detect->q_total_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ) ); // stereo_type_detect->q_total_power move32(); } #else + temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 IF( LT_16( q_temp, stereo_type_detect->q_total_power ) ) { stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp ) ) ); // q_temp @@ -2229,7 +2244,7 @@ void protoSignalComputation2_fx( sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], stereo_type_detect->total_power_fx[l], &exp ); // 15-(exp+s_min( stereo_type_detect->q_total_power, q_temp )-s_min( stereo_type_detect->q_sum_power, q_temp2 )) move32(); #ifdef FIX_867_CLDFB_NRG_SCALE - q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp[qidx] ) ) ); + q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp_total ) ) ); #else q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) ); #endif @@ -2245,6 +2260,7 @@ void protoSignalComputation2_fx( 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 ) ) { 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[qidx] ) ), temp ); // q_temp @@ -2598,7 +2614,7 @@ void protoSignalComputation2_fx( stereo_type_detect->q_sum_power = s_min( stereo_type_detect->q_sum_power, q_temp2 ); move16(); #ifdef FIX_867_CLDFB_NRG_SCALE - stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp[0] ); + stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp_total ); move16(); #else stereo_type_detect->q_total_power = s_min( stereo_type_detect->q_total_power, q_temp ); @@ -2687,15 +2703,15 @@ void protoSignalComputation2_fx( 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 ), sub( 31, q_temp[0] ), 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 ); + stereo_type_detect->left_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, left_hi_power_fx ), sub( 31, q_temp_total ), 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[0] ), 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 ); + stereo_type_detect->right_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, right_hi_power_fx ), sub( 31, q_temp_total ), 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[0] ), 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 ); + stereo_type_detect->total_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a2_fx, total_hi_power_fx ), sub( 31, q_temp_total ), 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 ); -- GitLab From 8e1cdae974b4ff286afb05306be9ddc597458a02 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 8 Apr 2025 18:14:57 +0200 Subject: [PATCH 329/358] format fix --- lib_rend/ivas_dirac_rend_fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 576964c29..7b4ec0a35 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2129,10 +2129,10 @@ void protoSignalComputation2_fx( 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 + 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 */ @@ -2163,14 +2163,14 @@ void protoSignalComputation2_fx( 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 + 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 ) ) { left_hi_power_fx = L_add( left_hi_power_fx, Left_power_fx ); // q_Left_Right_power right_hi_power_fx = L_add( right_hi_power_fx, Right_power_fx ); // q_Left_Right_power - // total_hi_power_fx = L_add( total_hi_power_fx, reference_power_fx[l] ); + // total_hi_power_fx = L_add( total_hi_power_fx, reference_power_fx[l] ); #ifdef FIX_867_CLDFB_NRG_SCALE total_hi_power_fx = L_add( total_hi_power_fx, W_extract_h( W_shl( reference_power_64fx[l], sub( head_room, total_shift[qidx] ) ) ) ); // q_Left_Right_power #else @@ -2184,8 +2184,8 @@ void protoSignalComputation2_fx( re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift[0] ) ); // q_cldfb+temp_q_shift im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift[0] ) ); // q_cldfb+temp_q_shift #else - re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift - im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift + re_aux = L_shl( Real_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift + im_aux = L_shl( Imag_aux_fx, sub( temp_q_shift, min_q_shift ) ); // q_cldfb+temp_q_shift #endif sum_power_fx = Madd_32_32( Mpy_32_32( re_aux, re_aux ), im_aux, im_aux ); // 2*(q_cldfb+temp_q_shift)-31 @@ -2215,7 +2215,7 @@ void protoSignalComputation2_fx( move32(); } #else - temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 + temp = Mpy_32_32( a_fx, W_extract_l( W_shr( reference_power_64fx[l], 31 ) ) ); // 2*(q_cldfb+min_q_shift) -31 IF( LT_16( q_temp, stereo_type_detect->q_total_power ) ) { stereo_type_detect->total_power_fx[l] = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_power_fx[l] ), sub( stereo_type_detect->q_total_power, q_temp ) ) ); // q_temp -- GitLab From 8a2459dce972e7f3ec89ad21d591c390084ac6e6 Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Tue, 8 Apr 2025 22:02:03 +0530 Subject: [PATCH 330/358] Fix for 3GPP issue 1459: Complexity measurement crashes: ISM+ encoder --- lib_enc/ivas_core_pre_proc_front_fx.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index bb065ae20..405d08301 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1226,9 +1226,6 @@ ivas_error pre_proc_front_ivas_fx( st->mem_wsp_q = *Q_new; move16(); move16(); - scale_sig( old_wsp_fx, L_WSP_MEM, sub( *Q_new, *q_old_wsp ) ); - *q_old_wsp = *Q_new; - move16(); ivas_find_wsp_fx( L_FRAME, L_SUBFR, NB_SUBFR, A_fx, Aw_fx, inp_12k8_fx, TILT_FAC_FX, wsp_fx, &st->mem_wsp_fx, GAMMA1, L_LOOK_12k8 ); @@ -1244,18 +1241,6 @@ ivas_error pre_proc_front_ivas_fx( Word16 shift1 = norm_arr( old_wsp_fx, L_WSP_MEM ); Word16 shift2 = norm_arr( wsp_fx, L_WSP - L_WSP_MEM ); - maximum_abs_16_fx( old_wsp_fx, L_WSP_MEM, &shift ); - if ( !shift ) - { - shift1 = Q15; - move16(); - } - maximum_abs_16_fx( wsp_fx, L_WSP - L_WSP_MEM, &shift ); - if ( !shift ) - { - shift2 = Q15; - move16(); - } shift = s_min( add( *q_old_wsp, shift1 ), add( Q_wsp, shift2 ) ); shift = s_min( shift, add( norm_arr( st->mem_decim2_fx, 3 ), st->Q_old_wsp2 ) ); shift = s_min( shift, add( norm_arr( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM ), st->Q_old_wsp2 ) ); -- GitLab From 88431b0f147cfb4bfbad137be2793a3377861d09 Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Tue, 8 Apr 2025 22:09:30 +0530 Subject: [PATCH 331/358] ASAN fix for decoder --- lib_dec/ivas_jbm_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 93e8bb4eb..8c5a9e9af 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2548,8 +2548,8 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( Word16 n_slots_still_available; Word16 n_samples_to_render; DECODER_TC_BUFFER_HANDLE hTcBuffer; - Word32 output_fx[MAX_CICP_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 *p_output_fx[MAX_CICP_CHANNELS]; + Word32 output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; Word16 nchan_in, nchan_out; IF( !st_ivas->hDecoderConfig->Opt_tsm ) { -- GitLab From 279792cf491d2139bcef0105d5edf8b0bb4d4531 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 9 Apr 2025 08:11:24 +0200 Subject: [PATCH 332/358] Correct total_shift missing factor 2 for total/bb/hi energy scale region compensations. --- lib_rend/ivas_dirac_rend_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 7b4ec0a35..f67f3761b 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2072,9 +2072,9 @@ void protoSignalComputation2_fx( #ifdef FIX_867_CLDFB_NRG_SCALE Word16 total_shift[2], q_temp_total; - /* total_shift shift required to get common Q */ - total_shift[0] = s_max( 0, sub( min_q_shift[0], min_q_shift[1] ) ); - total_shift[1] = s_max( 0, sub( min_q_shift[1], min_q_shift[0] ) ); + /* 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 ); + total_shift[1] = shl( s_max( 0, sub( min_q_shift[1], min_q_shift[0] ) ), 1 ); min_q_shift[0] = sub( min_q_shift[0], idiv1616( find_guarded_bits_fx( num_freq_bands ), 2 ) ); 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 ); -- GitLab From 8846449ac87119876446cc3e50c2df97201a1f4a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 9 Apr 2025 20:40:32 +0200 Subject: [PATCH 333/358] [cleanup] remove FIX_867_CLDFB_NRG_SCALE_CLDFB --- lib_dec/ivas_dirac_dec_fx.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index d186de136..f6de75cfb 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2771,28 +2771,8 @@ void ivas_dirac_dec_render_sf_fx( { /* CLDFB Analysis*/ offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); -#ifdef FIX_867_CLDFB_NRG_SCALE_CLDFB - Word16 q_input; - Word32 sigTemp[MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - q_input = 4; - move16(); - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - q_input = s_min( q_input, L_norm_arr( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - hSpatParamRendCom->num_freq_bands ) ); - } FOR( ch = 0; ch < nchan_transport; ch++ ) { - Copy_Scale_sig32( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - sigTemp[ch], - hSpatParamRendCom->num_freq_bands, - q_input ); - } - q_input = add( Q11, q_input ); -#endif - FOR( ch = 0; ch < nchan_transport; ch++ ) - { -#ifndef FIX_867_CLDFB_NRG_SCALE_CLDFB q_temp_cldfb = Q11; move16(); cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], @@ -2800,15 +2780,6 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); -#else - q_temp_cldfb = q_input; - move16(); - cldfbAnalysis_ts_fx_var_q( sigTemp[ch], - Cldfb_RealBuffer_fx[ch][0], - Cldfb_ImagBuffer_fx[ch][0], - hSpatParamRendCom->num_freq_bands, - st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); -#endif } q_cldfb = q_temp_cldfb; move16(); -- GitLab From bb132b7c7db0ad2a5f0e380a68f9dc16671fc053 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 9 Apr 2025 20:44:06 +0200 Subject: [PATCH 334/358] [cleanup] remove code in #if 0 ... #endif --- lib_dec/ivas_dirac_dec_fx.c | 55 ------------------------------------- lib_rend/lib_rend.c | 18 ------------ 2 files changed, 73 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index f6de75cfb..38ad4ce04 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3283,60 +3283,6 @@ void ivas_dirac_dec_render_sf_fx( IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { #ifdef FIX_867_CLDFB_NRG_SCALE -#if 0 - IF( LT_16( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ) - { - Word32 temp; - FOR( i = 0; i < s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) - { - temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth[0], DirAC_mem.reference_power_q[0] ) ); - reference_power_fx[i] = L_max(temp, L_min(reference_power_fx[i], 1)); - move32(); - } - DirAC_mem.reference_power_q[0] = q_reference_power_smooth[0]; - move16(); - } - ELSE - { - Word32 temp; - FOR( i = 0; i < s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ); i++ ) - { - temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q[0], q_reference_power_smooth[0] ) ); - reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); - move32(); - } - q_reference_power_smooth[0] = DirAC_mem.reference_power_q[0]; - move16(); - } - - IF( LT_16( q_reference_power_smooth[1], DirAC_mem.reference_power_q[1] ) ) - { - Word32 temp; - FOR( i = CLDFB_NO_CHANNELS_HALF; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth[1], DirAC_mem.reference_power_q[1] ) ); - reference_power_fx[i] = L_max(temp, L_min(reference_power_fx[i], 1)); - move32(); - } - DirAC_mem.reference_power_q[1] = q_reference_power_smooth[1]; - move16(); - } - ELSE - { - Word32 temp; - FOR( i = CLDFB_NO_CHANNELS_HALF; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q[1], q_reference_power_smooth[1] ) ); - reference_power_smooth_fx[i] = L_max(temp, L_min(reference_power_smooth_fx[i], 1)); - move32(); - } - q_reference_power_smooth[1] = DirAC_mem.reference_power_q[1]; - move16(); - } - v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); - q_reference_power_smooth[0] = sub( q_reference_power_smooth[0], 1 ); - q_reference_power_smooth[1] = sub( q_reference_power_smooth[1], 1 ); -#else 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, @@ -3347,7 +3293,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 ); -#endif #else IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index a25037153..7e526ca77 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8444,14 +8444,6 @@ static void intermidiate_ext_dirac_render( IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx ) { #ifdef FIX_867_CLDFB_NRG_SCALE -#if 0 - /* Possible improvement: normalize both scale regions individually. */ - 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[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); - 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(); move16(); -#else 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 ) ) @@ -8476,7 +8468,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(); -#endif #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) */ @@ -8484,14 +8475,6 @@ static void intermidiate_ext_dirac_render( move16(); #endif #ifdef FIX_867_CLDFB_NRG_SCALE -#if 0 - /* Possible improvement: normalize both scale regions individually. */ - 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[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); - 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 = 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 ) ) { @@ -8513,7 +8496,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(); -#endif #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) */ -- GitLab From 8f88f93b45658e8f6c07f0034b4b3030c69b93d1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 9 Apr 2025 20:46:52 +0200 Subject: [PATCH 335/358] [cleanup] remove inactive code in FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE --- lib_com/options.h | 1 - lib_dec/ivas_dirac_dec_fx.c | 2 - lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 48 ------------------- 3 files changed, 51 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e5c7467a0..91ee90e2b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,7 +68,6 @@ #endif #define FIX_867_CLDFB_NRG_SCALE -//#define FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE #define FIX_1378_ACELP_OUT_OF_BOUNDS diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 38ad4ce04..bbd4641b1 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3656,7 +3656,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], exp ); move16(); -#ifndef FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ) ) { FOR( i = 0; proto_power_smooth_len > i; i = add( i, hSpatParamRendCom->num_freq_bands ) ) @@ -3693,7 +3692,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(); } -#endif #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) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 44ddf8609..7b446a80e 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2247,53 +2247,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; set16_fx( exp_arr, 0, i_mult( num_protos_dir, num_freq_bands ) ); -#ifdef FIX_867_CLDFB_NRG_SCALE_PROTO_NORESCALE - Word16 shift_prev0, shift_curr0, shift_prev1, shift_curr1; - shift_prev0 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0], h_dirac_output_synthesis_state->proto_power_smooth_q[0] ) ); - shift_curr0 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_q[0], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[0] ) ); - shift_prev1 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1], h_dirac_output_synthesis_state->proto_power_smooth_q[1] ) ); - shift_curr1 = s_max( 0, sub( h_dirac_output_synthesis_state->proto_power_smooth_q[1], h_dirac_output_synthesis_state->proto_power_smooth_prev_q[1] ) ); - - FOR( k = 0; k < num_protos_dir; k++ ) - { - FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ ) - { - g1 = alpha[l]; // Q31 - move32(); - g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 - *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev0 ) ) ); //(Q31, proto_power_smooth_q) -> proto_power_smooth_q - move32(); - *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), - L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr0 ) ); //(Q31, proto_power_smooth_q) -> min(proto_power_smooth_q, proto_power_smooth_prev_q) - move32(); - - L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ - exp_arr[k * num_freq_bands + l] = exp; - move16(); - - *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-min(proto_power_smooth_q, proto_power_smooth_prev_q)))*/ - move32(); - } - FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ ) - { - g1 = alpha[l]; // Q31 - move32(); - g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 - *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, L_shr( *p_power_smooth_prev, shift_prev1 ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth - move32(); - *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), - L_shr( Mpy_32_32( g1, ( *p_power_smooth ) ), shift_curr1 ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth - move32(); - - L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - exp_arr[k * num_freq_bands + l] = exp; - move16(); - - *( p_power_smooth++ ) = L_tmp; /*Q=31-(exp-(31-h_dirac_output_synthesis_state->proto_power_smooth_prev_q))*/ - move32(); - } - } -#else FOR( k = 0; k < num_protos_dir; k++ ) { FOR( l = 0; l < num_freq_bands; l++ ) @@ -2333,7 +2286,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( } } } -#endif // Move proto_power_smooth_fx to common Q-factor -- GitLab From 0d7b5ddcc64a15b6a1a769f3eb84f7be68d4720a Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 31 Mar 2025 21:08:44 +0530 Subject: [PATCH 336/358] Fix for 3GPP issue 1449: Complexity measurement crashes: OMASA encoder Link #1449 --- lib_enc/ivas_masa_enc_fx.c | 56 ++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 2f060f681..2b9ffef15 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -2297,7 +2297,9 @@ static void reduce_metadata_further_fx( UWord8 computeCoherence; Word32 onset_filter; Word16 onset_filter_e, exp; - Word32 bandEnergy; + Word64 bandEnergy; + Word32 bandEnergy32; + Word16 bandEnergy_exp, shift; UWord8 mergeOverFreqBands; Word32 meanRatio; Word16 tmp, tmp2; @@ -2437,13 +2439,16 @@ static void reduce_metadata_further_fx( move32(); bandEnergy = 0; - move32(); + move64(); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - bandEnergy = L_add( bandEnergy, energy[sf][band] ); + bandEnergy = W_mac_32_32( bandEnergy, energy[sf][band], 1 ); } + shift = W_norm( bandEnergy ); + bandEnergy32 = W_extract_h( W_shl( bandEnergy, shift ) ); + bandEnergy_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); - IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy, 2 ), bandRatio ), sub( 31 + 1, hMasa->data.q_energy ), threshold, exp ) > 0 ) + IF( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( L_shr( bandEnergy32, 2 ), bandRatio ), add( 1, bandEnergy_exp ), threshold, exp ) > 0 ) { selectedBand = band; move16(); @@ -4640,7 +4645,9 @@ static void ivas_encode_masaism_metadata_fx( UWord8 numCodingBands; UWord8 numSf; Word16 brange[2]; - Word32 eneBand; + Word64 eneBand; + Word32 eneBand32; + Word16 eneBand_exp, shift; Word16 bin; Word16 obj; Word16 bits_ism[MAX_NUM_OBJECTS]; @@ -4689,11 +4696,14 @@ static void ivas_encode_masaism_metadata_fx( eneBand = 0; move16(); move16(); - move32(); + move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { - eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy + eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } + shift = W_norm( eneBand ); + eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); + eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); energy_ism = 0; energy_ism_e = 0; @@ -4727,12 +4737,12 @@ static void ivas_encode_masaism_metadata_fx( hOmasaData->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30 move32(); } - L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); + L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); - tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); + tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][0], sub( tmp, 1 ) ); // Q30 move32(); @@ -4794,21 +4804,24 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; - move32(); + move64(); FOR( sf = 0; sf < omasa_nblocks; sf++ ) { FOR( bin = brange[0]; bin < brange[1]; bin++ ) { - eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy + eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } } + shift = W_norm( eneBand ); + eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); + eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); - L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), energy_ism, energy_ism_e, &L_tmp_e ); + L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); - tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); + tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[0][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[0][band], sub( tmp, 1 ) ); // Q30 move32(); @@ -4851,18 +4864,21 @@ static void ivas_encode_masaism_metadata_fx( move16(); eneBand = 0; - move32(); + move64(); FOR( bin = brange[0]; bin < brange[1]; bin++ ) { - eneBand = L_add( eneBand, hMasa->data.energy_fx[sf][bin] ); // hMasa->data.q_energy + eneBand = W_mac_32_32( eneBand, hMasa->data.energy_fx[sf][bin], 1 ); // hMasa->data.q_energy + 1 } + shift = W_norm( eneBand ); + eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); + eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); - L_tmp = BASOP_Util_Add_Mant32Exp( eneBand, sub( 31, hMasa->data.q_energy ), hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); + L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); move32(); - tmp = add( tmp, sub( sub( 31, hMasa->data.q_energy ), L_tmp_e ) ); + tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = L_shl( hOmasaData->masa_to_total_energy_ratio_fx[sf][band], sub( tmp, 1 ) ); // Q30 move32(); -- GitLab From 3ef8c26d6355b9709fac7a0609dcdf15a28c1afb Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 10 Apr 2025 16:20:22 +0530 Subject: [PATCH 337/358] Fix for decoder crash --- lib_dec/igf_dec_fx.c | 100 +++++++++++++------------------------------ 1 file changed, 30 insertions(+), 70 deletions(-) diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 60e649a08..0010b9466 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -123,8 +123,8 @@ return noise; } static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q0 | number of noise bands */ - const Word32 *in, /**< in: Q31 | MDCT spectrum */ - Word16 s_l, /**< in: Q0 | noise headroom */ + const Word32 *in, /**< in: in_exp | MDCT spectrum */ + Word16 in_exp, /**< in: Q0 | noise headroom */ const Word16 *TCXNoise, /**< in: Q0 | tcx noise indicator vector */ const Word16 start, /**< in: Q0 | start MDCT subband index */ const Word16 stop, /**< in: Q0 | stop MDCT subband index */ @@ -132,41 +132,44 @@ static Word16 ivas_IGF_replaceTCXNoise_1_fx( /**< out: Q Word16 *totalNoiseNrg_exp ) { Word16 sb; - Word16 tmp16; + Word16 tmp16, shift; Word16 noise; + Word32 tmp32; Word64 nE; - tmp16 = 0; + shift = 2; move16(); noise = 0; move16(); - s_l = sub( s_l, 5 ); nE = 0; move64(); + *totalNoiseNrg = 0; + move32(); + *totalNoiseNrg_exp = 0; + move16(); + FOR( sb = start; sb < stop; sb++ ) { IF( TCXNoise[sb] ) { - tmp16 = extract_h( L_shl( in[sb], s_l ) ); // Q31 + s_l - } - IF( TCXNoise[sb] ) - { - nE = W_mac_16_16( nE, tmp16, tmp16 ); // Q31 + s_l - } - IF( TCXNoise[sb] ) - { - noise = add( noise, 1 ); // Q0 + tmp32 = L_shr( in[sb], shift ); + nE = W_mac_32_32( nE, tmp32, tmp32 ); // 62 - (in_exp + shift + in_exp + shift + 1) + noise = add( noise, 1 ); } } - tmp16 = W_norm( nE ); - nE = W_shl( nE, tmp16 ); - *totalNoiseNrg = W_extract_h( nE ); - move32(); - *totalNoiseNrg_exp = sub( tmp16, 32 ); - move16(); + IF( nE ) + { + tmp16 = W_norm( nE ); + nE = W_shl( nE, tmp16 ); + *totalNoiseNrg = W_extract_h( nE ); + move32(); + *totalNoiseNrg_exp = sub( add( shl( shift, 1 ), shl( in_exp, 1 ) ), tmp16 ); + move16(); + } + return noise; } @@ -3533,14 +3536,8 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in specMed_e = igf_spec_e[i]; move16(); - /*14 seems to be precise enough*/ - hPrivateData->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( - hInstance->infoTCXNoise_ptr, - igf_spec + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); - move16(); hPrivateData->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_spec, - hPrivateData->headroom_TCX_noise_white, + igf_spec_e[i], hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, @@ -3548,9 +3545,6 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in &hPrivateData->totalNoiseNrg_exp ); move16(); - hPrivateData->totalNoiseNrg_exp = sub( shl( sub( igf_spec_e[i], sub( hPrivateData->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_exp ); - move16(); - BREAK; } } @@ -3560,22 +3554,15 @@ void IGFDecApplyMono_ivas( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in { IF( EQ_16( hPrivateData->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { - hPrivateData->headroom_TCX_noise = IGF_getScaleFactor32Cond( - hInstance->infoTCXNoise_ptr, - hPrivateData->pSpecFlat + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); - move16(); hPrivateData->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateData->pSpecFlat, - hPrivateData->headroom_TCX_noise, + hPrivateData->pSpecFlat_exp, hInstance->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateData->totalNoiseNrg_off, &hPrivateData->totalNoiseNrg_off_exp ); move16(); - hPrivateData->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateData->pSpecFlat_exp, sub( hPrivateData->headroom_TCX_noise, 5 ) ), 1 ), hPrivateData->totalNoiseNrg_off_exp ); - move16(); BREAK; } } @@ -3760,12 +3747,9 @@ void IGFDecApplyStereo( move16(); } - hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, - igf_specL_fx + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); - move16(); + hPrivateDataL->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specL_fx, - hPrivateDataL->headroom_TCX_noise_white, + specMedL_e, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, @@ -3773,9 +3757,6 @@ void IGFDecApplyStereo( &hPrivateDataL->totalNoiseNrg_exp ); move16(); - hPrivateDataL->totalNoiseNrg_exp = sub( shl( sub( specMedL_e, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_exp ); - move16(); - IF( !bfi ) { s_l = getScaleFactor32( hPrivateDataR->pSpecFlat + hGrid->minSrcSubband - whiteningLevel, @@ -3796,21 +3777,14 @@ void IGFDecApplyStereo( move16(); } - hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, - igf_specR_fx + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); - move16(); hPrivateDataR->n_noise_bands = ivas_IGF_replaceTCXNoise_1_fx( igf_specR_fx, - hPrivateDataR->headroom_TCX_noise_white, + specMedR_e, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg, &hPrivateDataR->totalNoiseNrg_exp ); move16(); - hPrivateDataR->totalNoiseNrg_exp = sub( shl( sub( specMedR_e, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_exp ); - move16(); - BREAK; } } @@ -3820,37 +3794,23 @@ void IGFDecApplyStereo( test(); IF( EQ_16( hPrivateDataL->currWhiteningLevel[i], IGF_WHITENING_OFF ) || EQ_16( hPrivateDataR->currWhiteningLevel[i], IGF_WHITENING_OFF ) ) { - hPrivateDataL->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecL->infoTCXNoise_ptr + hGrid->minSrcSubband, - hPrivateDataL->pSpecFlat + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataL->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataL->pSpecFlat, - hPrivateDataL->headroom_TCX_noise_white, + hPrivateDataL->pSpecFlat_exp, hIGFDecL->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataL->totalNoiseNrg_off, &hPrivateDataL->totalNoiseNrg_off_exp ); - hPrivateDataL->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataL->pSpecFlat_exp, sub( hPrivateDataL->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataL->totalNoiseNrg_off_exp ); - move16(); - move16(); move16(); - hPrivateDataR->headroom_TCX_noise_white = IGF_getScaleFactor32Cond( hIGFDecR->infoTCXNoise_ptr, - hPrivateDataR->pSpecFlat + hGrid->minSrcSubband, - sub( hGrid->startLine, hGrid->minSrcSubband ) ); hPrivateDataR->n_noise_bands_off = ivas_IGF_replaceTCXNoise_1_fx( hPrivateDataR->pSpecFlat, - hPrivateDataR->headroom_TCX_noise_white, + hPrivateDataR->pSpecFlat_exp, hIGFDecR->infoTCXNoise_ptr, hGrid->minSrcSubband, hGrid->startLine, &hPrivateDataR->totalNoiseNrg_off, &hPrivateDataR->totalNoiseNrg_off_exp ); - hPrivateDataR->totalNoiseNrg_off_exp = sub( shl( sub( hPrivateDataR->pSpecFlat_exp, sub( hPrivateDataR->headroom_TCX_noise_white, 5 ) ), 1 ), hPrivateDataR->totalNoiseNrg_off_exp ); - move16(); - move16(); move16(); - - BREAK; } } -- GitLab From b95a18c496b24a03377039ac466a9bd2bdc44f15 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 10 Apr 2025 14:13:22 +0200 Subject: [PATCH 338/358] remove FORCE_DIV32_OPT_NEWTON --- lib_com/basop_util.c | 5 ----- lib_com/options.h | 1 - 2 files changed, 6 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 32f5cc55f..ec15e9769 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1013,10 +1013,6 @@ Word32 div_w( Word32 L_num, Word32 L_den ) Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) { Word32 z; -#ifdef FORCE_DIV32_OPT_NEWTON - z = BASOP_Util_Divide3232_Scale_newton( x, y, s ); - return z; -#else Word16 sx; Word16 sy; Word32 sign; @@ -1064,7 +1060,6 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s ) } return z; -#endif } #ifdef DIV32_OPT_NEWTON diff --git a/lib_com/options.h b/lib_com/options.h index e1e4f53a7..90cd057d0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,6 +81,5 @@ #define HARM_ENC_INIT //#define HARM_SCE_INIT #define DIV32_OPT_NEWTON /* FhG: faster 32 by 32 bit division */ -#define FORCE_DIV32_OPT_NEWTON /* FhG: replace BASOP_Util_Divide3232_Scale_cadence() by BASOP_Util_Divide3232_Scale_newton() */ #endif -- GitLab From c25105a8f3c6d710462a10a80ab5aa563b5a00a4 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 7 Apr 2025 11:46:08 +0200 Subject: [PATCH 339/358] replacingthe basop_util_add_mant2exp() for cy_sum and cy_sum_imag in ivas_param_mc_param_est_enc_fx(). --- lib_enc/ivas_mc_param_enc_fx.c | 99 ++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 54fe249cd..67037e0ad 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -30,6 +30,7 @@ *******************************************************************************************************/ +#define MERGE_REQUEST_1462 #include #include #include "options.h" @@ -59,7 +60,7 @@ static void ivas_param_mc_range_encoder_fx( const Word16 *seq_in, const Word16 n #define ATTACKTHRESHOLD_E 4 -static void ivas_param_mc_quantize_ilds_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word32 Cx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 freq_idx, const Word16 nchan_input, const Word16 nchan_transport, Word16 *ILD_idx_out, Word16 ILD_q[PARAM_MC_SZ_ILD_MAP] ); +static void ivas_param_mc_quantize_ilds_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_e[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 freq_idx, const Word16 nchan_input, const Word16 nchan_transport, Word16 *ILD_idx_out, Word16 ILD_q[PARAM_MC_SZ_ILD_MAP] ); static void ivas_param_mc_parameter_quantizer_fx( const Word32 *x, const Word16 *x_e, const Word16 L, const Word16 sz_quantizer, const Word16 *quantizer_fx, const Word16 Q_quant, Word16 *quant_idx, Word16 *y ); @@ -655,8 +656,13 @@ static void ivas_param_mc_param_est_enc_fx( Word16 dmx_imag_e[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Imag Part */ Word32 a_fx, b_fx, c_fx, d_fx; /* Tmp complex values */ Word16 a_e, b_e, c_e, d_e; /* Tmp complex values */ +#ifdef MERGE_REQUEST_1462 + Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; + Word64 Cy_sum_imag_64[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; +#else Word32 Cy_sum_imag_fx[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; Word16 Cy_sum_imag_e[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; +#endif Word32 Cx_sum_imag_fx[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 Cx_sum_imag_e[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 real_part_fx, imag_part_fx; @@ -685,13 +691,26 @@ static void ivas_param_mc_param_est_enc_fx( move16(); band_step = 1; move16(); +#ifdef MERGE_REQUEST_1462 + FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) + { + FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) + { + set64_fx( Cy_sum_real_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); + } + } +#endif FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC; cur_param_band++ ) { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) { - set32_fx( Cy_sum_imag_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); - set16_fx( Cy_sum_imag_e[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); +#ifdef MERGE_REQUEST_1462 + set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); +#else + set32_fx( Cy_sum_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); + set16_fx( Cy_sum_e[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); +#endif } FOR( ch_idx1 = 0; ch_idx1 < PARAM_MC_MAX_TRANSPORT_CHANS; ch_idx1++ ) @@ -832,7 +851,33 @@ static void ivas_param_mc_param_est_enc_fx( move32(); } } - +#ifdef MERGE_REQUEST_1462 + FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) + { + 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(); + FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) + { + Word16 norm; + c_fx = slot_frame_f_real_fx[ch_idx2][cur_cldfb_band]; + d_fx = slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band]; + move32(); +// Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) + Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], + W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); + move64(); + Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], + W_sub( W_mult0_32_32( a_fx, d_fx ), W_mult0_32_32( b_fx, c_fx ) ) ); + move64(); + + // convert the 64 bit fixpoint back into the 48 bit float format + norm = W_norm( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); + Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = W_extract_h( W_shl( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); + Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] = sub( sub( 62, gb ), norm ); + } + } +#else /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { @@ -890,6 +935,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); } } +#endif } } @@ -1023,6 +1069,28 @@ static void ivas_param_mc_param_est_enc_fx( move16(); } #endif +#ifdef MERGE_REQUEST_1462 + 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(); + move32(); + FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) + { + Word16 norm; + c_fx = slot_frame_f_real_fx[ch_idx2][cur_cldfb_band]; + d_fx = slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band]; + move32(); + move32(); +// Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) + Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], + W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); + move64(); + // convert the 64 bit fixpoint back into the 48 bit float format + norm = W_norm( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); + Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = W_extract_h( W_shl( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); + Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] = sub( sub( 62, gb ), norm ); + } +#else FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { #ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE @@ -1054,6 +1122,7 @@ static void ivas_param_mc_param_est_enc_fx( &Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); move32(); } +#endif } } } @@ -1075,6 +1144,12 @@ static void ivas_param_mc_param_est_enc_fx( move32(); Cy_sum_e[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; move16(); +#ifdef MERGE_REQUEST_1462 + Cy_sum_imag_64[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; + move64(); + Cy_sum_imag_64[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; + move64(); +#else Cy_sum_imag_fx[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; move32(); Cy_sum_imag_e[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; @@ -1083,6 +1158,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); Cy_sum_imag_e[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; move16(); +#endif } } @@ -1208,10 +1284,16 @@ static void ivas_param_mc_param_est_enc_fx( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], &Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2] ); move32(); +#ifdef MERGE_REQUEST_1462 + Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); + move64(); + +#else Cy_sum_imag_fx[cur_param_band - 1][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_imag_fx[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_e[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_imag_e[cur_param_band][ch_idx1][ch_idx2], &Cy_sum_imag_e[cur_param_band - 1][ch_idx1][ch_idx2] ); move32(); +#endif } } } @@ -1284,15 +1366,22 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ch_idx2++ ) { + Word16 norm; real_part_fx = Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2]; move32(); real_part_e = Cy_sum_e[cur_param_band][ch_idx1][ch_idx2]; move16(); +#ifdef MERGE_REQUEST_1462 + // convert the 64 bit fixpoint back into the 48 bit float format + norm = W_norm( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); + imag_part_fx = W_extract_h( W_shl( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); + imag_part_e = sub( (62-gb ), norm ); +#else imag_part_fx = Cy_sum_imag_fx[cur_param_band][ch_idx1][ch_idx2]; move32(); imag_part_e = Cy_sum_imag_e[cur_param_band][ch_idx1][ch_idx2]; move16(); - +#endif real_part_fx = Mpy_32_32( real_part_fx, real_part_fx ); imag_part_fx = Mpy_32_32( imag_part_fx, imag_part_fx ); -- GitLab From 3f8794eb82a9c036fd20dd7451c00fd2166ccc5d Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 7 Apr 2025 11:52:36 +0200 Subject: [PATCH 340/358] applied the clang patch. --- lib_enc/ivas_mc_param_enc_fx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 67037e0ad..ef1e93405 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -30,7 +30,7 @@ *******************************************************************************************************/ -#define MERGE_REQUEST_1462 +#define MERGE_REQUEST_1462 #include #include #include "options.h" @@ -691,7 +691,7 @@ static void ivas_param_mc_param_est_enc_fx( move16(); band_step = 1; move16(); -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1462 FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) @@ -705,7 +705,7 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) { -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1462 set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); #else set32_fx( Cy_sum_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); @@ -863,12 +863,12 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = slot_frame_f_real_fx[ch_idx2][cur_cldfb_band]; d_fx = slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band]; move32(); -// Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) - Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], - W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); + // Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) + Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], + W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); move64(); - Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], - W_sub( W_mult0_32_32( a_fx, d_fx ), W_mult0_32_32( b_fx, c_fx ) ) ); + Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], + W_sub( W_mult0_32_32( a_fx, d_fx ), W_mult0_32_32( b_fx, c_fx ) ) ); move64(); // convert the 64 bit fixpoint back into the 48 bit float format @@ -1081,9 +1081,9 @@ static void ivas_param_mc_param_est_enc_fx( d_fx = slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band]; move32(); move32(); -// Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) - Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], - W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); + // Conjugated complex multiplication (a-ib)(c+id) = ac+bd + i(ad-bc) + Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], + W_add( W_mult0_32_32( a_fx, c_fx ), W_mult0_32_32( b_fx, d_fx ) ) ); move64(); // convert the 64 bit fixpoint back into the 48 bit float format norm = W_norm( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); @@ -1375,7 +1375,7 @@ static void ivas_param_mc_param_est_enc_fx( // convert the 64 bit fixpoint back into the 48 bit float format norm = W_norm( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); imag_part_fx = W_extract_h( W_shl( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); - imag_part_e = sub( (62-gb ), norm ); + imag_part_e = sub( sub( 62, gb ), norm ); #else imag_part_fx = Cy_sum_imag_fx[cur_param_band][ch_idx1][ch_idx2]; move32(); -- GitLab From f3f44d9fad0a858398c13400e72915b21f9ba559 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 9 Apr 2025 09:51:06 +0200 Subject: [PATCH 341/358] made the define name a bit more clearer --- lib_enc/ivas_mc_param_enc_fx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index ef1e93405..6ac7c3428 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -30,7 +30,7 @@ *******************************************************************************************************/ -#define MERGE_REQUEST_1462 +#define MERGE_REQUEST_1378_TO_ISSUE_1462 #include #include #include "options.h" @@ -656,7 +656,7 @@ static void ivas_param_mc_param_est_enc_fx( Word16 dmx_imag_e[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Imag Part */ Word32 a_fx, b_fx, c_fx, d_fx; /* Tmp complex values */ Word16 a_e, b_e, c_e, d_e; /* Tmp complex values */ -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; Word64 Cy_sum_imag_64[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; #else @@ -691,7 +691,7 @@ static void ivas_param_mc_param_est_enc_fx( move16(); band_step = 1; move16(); -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) @@ -705,7 +705,7 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) { -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); #else set32_fx( Cy_sum_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); @@ -851,7 +851,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); } } -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { a_fx = slot_frame_f_real_fx[ch_idx1][cur_cldfb_band]; @@ -1069,7 +1069,7 @@ static void ivas_param_mc_param_est_enc_fx( move16(); } #endif -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 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(); @@ -1144,7 +1144,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); Cy_sum_e[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; move16(); -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 Cy_sum_imag_64[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; move64(); Cy_sum_imag_64[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; @@ -1284,7 +1284,7 @@ static void ivas_param_mc_param_est_enc_fx( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], &Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2] ); move32(); -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); move64(); @@ -1371,7 +1371,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); real_part_e = Cy_sum_e[cur_param_band][ch_idx1][ch_idx2]; move16(); -#ifdef MERGE_REQUEST_1462 +#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 // convert the 64 bit fixpoint back into the 48 bit float format norm = W_norm( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); imag_part_fx = W_extract_h( W_shl( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); -- GitLab From 740f4864ad452d7ddab3eed1e00868aaef140e27 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 9 Apr 2025 12:20:36 +0200 Subject: [PATCH 342/358] Properly named the define in the options.h file. --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index eb0054c53..e8a44d873 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -78,10 +78,10 @@ #define FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, nonbe*/ /* 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_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +//#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_PUSH_BIT #define HARM_ENC_INIT //#define HARM_SCE_INIT #define DIV32_OPT_NEWTON /* FhG: faster 32 by 32 bit division */ - +#define MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of Cy calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Obsoletes IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE. */ #endif -- GitLab From e586b634bcd9608e2a73c7fb5dadb4938f4c4c59 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Thu, 10 Apr 2025 11:26:04 +0200 Subject: [PATCH 343/358] Updated the macro names in the ivas_mc_param_enc_fx.c file. --- lib_enc/ivas_mc_param_enc_fx.c | 76 ++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 6ac7c3428..d0316be0f 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -30,7 +30,6 @@ *******************************************************************************************************/ -#define MERGE_REQUEST_1378_TO_ISSUE_1462 #include #include #include "options.h" @@ -656,7 +655,7 @@ static void ivas_param_mc_param_est_enc_fx( Word16 dmx_imag_e[PARAM_MC_MAX_TRANSPORT_CHANS]; /* Downmix channel - Imag Part */ Word32 a_fx, b_fx, c_fx, d_fx; /* Tmp complex values */ Word16 a_e, b_e, c_e, d_e; /* Tmp complex values */ -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; Word64 Cy_sum_imag_64[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; #else @@ -691,7 +690,7 @@ static void ivas_param_mc_param_est_enc_fx( move16(); band_step = 1; move16(); -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) @@ -705,7 +704,7 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) { -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); #else set32_fx( Cy_sum_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); @@ -851,7 +850,7 @@ static void ivas_param_mc_param_est_enc_fx( move32(); } } -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { a_fx = slot_frame_f_real_fx[ch_idx1][cur_cldfb_band]; @@ -1069,7 +1068,7 @@ static void ivas_param_mc_param_est_enc_fx( move16(); } #endif -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE 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(); @@ -1144,7 +1143,11 @@ static void ivas_param_mc_param_est_enc_fx( move32(); Cy_sum_e[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; move16(); -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + Cy_sum_real_64[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; + move64(); + Cy_sum_real_64[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; + move64(); Cy_sum_imag_64[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; move64(); Cy_sum_imag_64[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; @@ -1166,6 +1169,12 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + Cy_sum_real_64[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; + move64(); + Cy_sum_real_64[cur_param_band][ch_idx1][hParamMC->lfe_index] = 0; + move64(); +#endif Cy_sum_fx[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; move32(); Cy_sum_e[cur_param_band][hParamMC->lfe_index][ch_idx1] = 0; @@ -1210,10 +1219,18 @@ static void ivas_param_mc_param_est_enc_fx( /* get ICLDs */ FOR( k = 0; k < nchan_input; ++k ) { +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + Word16 norm; + // convert the 64 bit fixpoint back into the 48 bit float format + norm = W_norm( Cy_sum_real_64[cur_param_band][k][k] ); + Nrg_fx[k] = W_extract_h( W_shl( Cy_sum_real_64[cur_param_band][k][k], norm ) ); + Nrg_e[k] = sub( sub( 62, gb ), norm ); +#else Nrg_fx[k] = Cy_sum_fx[cur_param_band][k][k]; move32(); Nrg_e[k] = Cy_sum_e[cur_param_band][k][k]; move16(); +#endif } FOR( k = 0; k < num_ilds_to_code; ++k ) { @@ -1280,15 +1297,17 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { - Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2], - Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], - &Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2] ); - move32(); -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + Cy_sum_real_64[cur_param_band - 1][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); + move64(); Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2] = W_add( Cy_sum_imag_64[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); move64(); #else + Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2], + Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], + &Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2] ); + move32(); Cy_sum_imag_fx[cur_param_band - 1][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_imag_fx[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_e[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_imag_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_imag_e[cur_param_band][ch_idx1][ch_idx2], &Cy_sum_imag_e[cur_param_band - 1][ch_idx1][ch_idx2] ); @@ -1317,10 +1336,14 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + Cy_sum_real_64[cur_param_band - 1][ch_idx1][ch_idx2] = W_add( Cy_sum_real_64[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); +#else Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2], Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], &Cy_sum_e[cur_param_band - 1][ch_idx1][ch_idx2] ); move32(); +#endif } } } @@ -1329,7 +1352,24 @@ static void ivas_param_mc_param_est_enc_fx( band_step = 2; move16(); } - +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE + { + // convert the 64 bit fixpoint back into the 48 bit float format + FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) + { + FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) + { + FOR( ch_idx2 = 0; ch_idx2 < MAX_CICP_CHANNELS; ch_idx2++ ) + { + Word16 norm; + norm = W_norm( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2] ); + Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = W_extract_h( W_shl( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); + Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] = sub( sub( 62, gb ), norm ); + } + } + } + } +#endif /* map complex covariances to real values */ FOR( cur_param_band = 0; cur_param_band < hParamMC->max_param_band_abs_cov; cur_param_band += band_step ) @@ -1366,12 +1406,8 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ch_idx2++ ) { +#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE Word16 norm; - real_part_fx = Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2]; - move32(); - real_part_e = Cy_sum_e[cur_param_band][ch_idx1][ch_idx2]; - move16(); -#ifdef MERGE_REQUEST_1378_TO_ISSUE_1462 // convert the 64 bit fixpoint back into the 48 bit float format norm = W_norm( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2] ); imag_part_fx = W_extract_h( W_shl( Cy_sum_imag_64[cur_param_band][ch_idx1][ch_idx2], norm ) ); @@ -1382,6 +1418,10 @@ static void ivas_param_mc_param_est_enc_fx( imag_part_e = Cy_sum_imag_e[cur_param_band][ch_idx1][ch_idx2]; move16(); #endif + real_part_fx = Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2]; + move32(); + real_part_e = Cy_sum_e[cur_param_band][ch_idx1][ch_idx2]; + move16(); real_part_fx = Mpy_32_32( real_part_fx, real_part_fx ); imag_part_fx = Mpy_32_32( imag_part_fx, imag_part_fx ); -- GitLab From 2b8875ee9b592244e1e3be965d13c40707d9cd56 Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Thu, 10 Apr 2025 16:33:10 +0530 Subject: [PATCH 344/358] Fix for 3GPP issue 1447: BASOP encoder: W channel sounds dull and distorted in OSBA at 48 kbps with the LTV --- lib_enc/analy_sp_fx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index bd4ad12ba..4f96ea2d4 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -494,9 +494,9 @@ void ivas_analy_sp_fx( } ELSE { - Word16 scale = 0; + Word16 scale = 0, shift; move16(); - + shift = s_min( norm_arr( speech + 3 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT ), norm_arr( speech + 7 * ( L_SUBFR / 2 ) - L_FFT / 2, L_FFT ) ); FOR( i_subfr = 0; i_subfr <= 1; i_subfr++ ) { /* set pointer to the beginning of the signal for spectral analysis */ @@ -507,27 +507,26 @@ void ivas_analy_sp_fx( /* set the pointer for second analysis window */ pt = speech + 7 * ( L_SUBFR / 2 ) - L_FFT / 2; } - /* Clear 1st value of 1st part, copy 1st value of 2nd part */ pt_fft[0] = 0; move16(); - pt_fft[L_FFT / 2] = pt[L_FFT / 2]; // Q_new - preemph_bits + pt_fft[L_FFT / 2] = shl( pt[L_FFT / 2], shift ); // (Q_new + shift) - preemph_bits move16(); FOR( i = 1; i < L_FFT / 2; i++ ) { /* 1st windowed part */ - pt_fft[i] = mult_r( pt[i], sqrt_han_window_fx[i] ); // Q_new - preemph_bits + pt_fft[i] = mult_r( shl( pt[i], shift ), sqrt_han_window_fx[i] ); // (Q_new + shift) - preemph_bits move16(); /* 2nd windowed part */ - pt_fft[L_FFT - i] = mult_r( pt[L_FFT - i], sqrt_han_window_fx[i] ); // Q_new - preemph_bits + pt_fft[L_FFT - i] = mult_r( shl( pt[L_FFT - i], shift ), sqrt_han_window_fx[i] ); // (Q_new + shift) - preemph_bits move16(); } /* compute the spectrum */ fft_rel_16_32fx( pt_fft, &scale, i_subfr, L_FFT, LOG2_L_FFT ); - *q_fft_buff = add( Q_new, scale ); // resultant q for fft_buff + *q_fft_buff = add( add( Q_new, shift ), scale ); // resultant q for fft_buff move16(); IF( EQ_16( i_subfr, 1 ) ) { -- GitLab From ce7f9468512dfe09e52deb093205900072031755 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Apr 2025 11:52:59 +0530 Subject: [PATCH 345/358] Fix for 3GPP issue 1410: Major Difference for Stereo input at noisy segments 13.2 kbps DTX 32kHz SWB - 2 Link #1410 --- lib_enc/fd_cng_enc_fx.c | 12 ++-- lib_enc/ivas_core_pre_proc_front_fx.c | 51 ++------------- lib_enc/ivas_front_vad_fx.c | 18 ++---- lib_enc/nois_est_fx.c | 93 +++++++++++++++++++++------ lib_enc/prot_fx_enc.h | 3 + 5 files changed, 95 insertions(+), 82 deletions(-) diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index d182e4a44..c773212db 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -2317,8 +2317,10 @@ void perform_noise_estimation_enc_ivas_fx( move32(); periodog_exp[i] = sub( Q31, add( add( sub( Q31, enerBuffer_exp ), 35 - 31 ), scale ) ); move16(); - max_exp = s_max( max_exp, periodog_exp[i] ); - + if ( *ptr_per_fx ) + { + max_exp = s_max( max_exp, periodog_exp[i] ); + } ptr_per_fx++; i++; } @@ -2350,8 +2352,8 @@ void perform_noise_estimation_enc_ivas_fx( &hFdCngEnc->msPeriodog_fx_exp_cldfb ); ///* find common exponent for fft part and cldfb part of msperiodog */ - s1 = getScaleFactor32( msPeriodog_fx, nFFTpart ); - s2 = getScaleFactor32( &msPeriodog_fx[nFFTpart], nCLDFBpart ); + s1 = L_norm_arr( msPeriodog_fx, nFFTpart ); + s2 = L_norm_arr( &msPeriodog_fx[nFFTpart], nCLDFBpart ); s = s_max( sub( hFdCngEnc->msPeriodog_fx_exp_fft, s1 ), sub( hFdCngEnc->msPeriodog_fx_exp_cldfb, s2 ) ); s1 = sub( s, hFdCngEnc->msPeriodog_fx_exp_fft ); @@ -2370,7 +2372,7 @@ void perform_noise_estimation_enc_ivas_fx( FOR( i = 0; i < nCLDFBpart; i++ ) { - msPeriodog_fx[nFFTpart + i] = L_shr( msPeriodog_fx[nFFTpart + i], s_min( 31, s2 ) ); /* hFdCngEnc->msPeriodog_fx_exp_fft */ + msPeriodog_fx[nFFTpart + i] = L_shr( msPeriodog_fx[nFFTpart + i], s2 ); /* hFdCngEnc->msPeriodog_fx_exp_fft */ move32(); } } diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 405d08301..b2fdcf821 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -775,14 +775,9 @@ ivas_error pre_proc_front_ivas_fx( move16(); } - Word16 scale = add( L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ), st->hNoiseEst->q_bckr ); - scale = s_min( scale, add( L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS ), st->hNoiseEst->q_enrO ) ); + Word16 scale = add( L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS ), st->hNoiseEst->q_enrO ); scale = s_min( scale, fr_bands_fx_q ); - scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) ); - st->hNoiseEst->q_bckr = scale; - move16(); - scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_enrO ) ); st->hNoiseEst->q_enrO = scale; move16(); @@ -917,44 +912,14 @@ ivas_error pre_proc_front_ivas_fx( * Correlation correction as a function of total noise level *----------------------------------------------------------------*/ - noise_est_down_ivas_fx( fr_bands_fx, fr_bands_fx_q, st->hNoiseEst->bckr_fx, tmpN_fx, tmpE_fx, st->min_band, st->max_band, + noise_est_down_ivas_fx( fr_bands_fx, fr_bands_fx_q, st->hNoiseEst->bckr_fx, &st->hNoiseEst->q_bckr, tmpN_fx, &q_tmpN, tmpE_fx, &q_tmpE, st->min_band, st->max_band, &st->hNoiseEst->totalNoise_fx, Etot_fx, &st->hNoiseEst->Etot_last_fx, &st->hNoiseEst->Etot_v_h2_fx ); - q_tmpN = fr_bands_fx_q; - q_tmpE = fr_bands_fx_q; - move16(); - move16(); test(); IF( lr_vad_enabled && st->idchan == 0 ) { - scale = add( L_norm_arr( hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, NB_BANDS ), hCPE->hFrontVad[0]->hNoiseEst->q_bckr ); - scale = s_min( scale, add( L_norm_arr( hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, NB_BANDS ), hCPE->hFrontVad[1]->hNoiseEst->q_bckr ) ); - scale = s_min( scale, add( L_norm_arr( fr_bands_LR_fx[0], 2 * NB_BANDS ), fr_bands_LR_fx_q[0] ) ); - scale = s_min( scale, add( L_norm_arr( fr_bands_LR_fx[1], 2 * NB_BANDS ), fr_bands_LR_fx_q[1] ) ); - - scale_sig32( fr_bands_LR_fx[0], 2 * NB_BANDS, sub( scale, fr_bands_LR_fx_q[0] ) ); - fr_bands_LR_fx_q[0] = scale; - move16(); - scale_sig32( fr_bands_LR_fx[1], 2 * NB_BANDS, sub( scale, fr_bands_LR_fx_q[1] ) ); - fr_bands_LR_fx_q[1] = scale; - move16(); - - scale_sig32( hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hCPE->hFrontVad[0]->hNoiseEst->q_bckr ) ); - hCPE->hFrontVad[0]->hNoiseEst->q_bckr = scale; - move16(); - scale_sig32( hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hCPE->hFrontVad[1]->hNoiseEst->q_bckr ) ); - hCPE->hFrontVad[1]->hNoiseEst->q_bckr = scale; - move16(); - - noise_est_down_ivas_fx( fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, tmpN_LR_fx[0], tmpE_LR_fx[0], st->min_band, st->max_band, &hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx, Etot_LR_fx[0], &hCPE->hFrontVad[0]->hNoiseEst->Etot_last_fx, &hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_fx ); - noise_est_down_ivas_fx( fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, tmpN_LR_fx[1], tmpE_LR_fx[1], st->min_band, st->max_band, &hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx, Etot_LR_fx[1], &hCPE->hFrontVad[1]->hNoiseEst->Etot_last_fx, &hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_fx ); - - q_tmpN_LR[0] = q_tmpE_LR[0] = scale; - move16(); - move16(); - q_tmpN_LR[1] = q_tmpE_LR[1] = scale; - move16(); - move16(); + noise_est_down_ivas_fx( fr_bands_LR_fx[0], fr_bands_LR_fx_q[0], hCPE->hFrontVad[0]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[0]->hNoiseEst->q_bckr, tmpN_LR_fx[0], &q_tmpN_LR[0], tmpE_LR_fx[0], &q_tmpE_LR[0], st->min_band, st->max_band, &hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx, Etot_LR_fx[0], &hCPE->hFrontVad[0]->hNoiseEst->Etot_last_fx, &hCPE->hFrontVad[0]->hNoiseEst->Etot_v_h2_fx ); + noise_est_down_ivas_fx( fr_bands_LR_fx[1], fr_bands_LR_fx_q[1], hCPE->hFrontVad[1]->hNoiseEst->bckr_fx, &hCPE->hFrontVad[1]->hNoiseEst->q_bckr, tmpN_LR_fx[1], &q_tmpN_LR[1], tmpE_LR_fx[1], &q_tmpE_LR[1], st->min_band, st->max_band, &hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx, Etot_LR_fx[1], &hCPE->hFrontVad[1]->hNoiseEst->Etot_last_fx, &hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_fx ); corr_shiftL_fx = correlation_shift_fx( hCPE->hFrontVad[0]->hNoiseEst->totalNoise_fx ); // Q15 corr_shiftR_fx = correlation_shift_fx( hCPE->hFrontVad[1]->hNoiseEst->totalNoise_fx ); // Q15 @@ -1310,14 +1275,6 @@ ivas_error pre_proc_front_ivas_fx( /*------------------------------------------------------------------* * Update estimated noise energy and voicing cut-off frequency *-----------------------------------------------------------------*/ - { - // TODO: this scalings to be checked - scale = s_min( Q30, add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ) ); - scale = s_min( scale, sub( add( fr_bands_fx_q, L_norm_arr( fr_bands_fx, 2 * NB_BANDS ) ), 4 ) ); - scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_bckr ) ); - scale_sig32( fr_bands_fx, 2 * NB_BANDS, sub( scale, fr_bands_fx_q ) ); - st->hNoiseEst->q_bckr = fr_bands_fx_q = scale; - } scale = s_min( Q31, s_min( add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ), add( st->hNoiseEst->q_bckr, L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS ) ) ) ); scale = sub( scale, 1 ); // guard bits diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 25a936566..b21a66952 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -609,14 +609,8 @@ ivas_error front_vad_spar_fx( Q_inp_12k8 = hFrontVad->q_buffer_12k8; move16(); - scale = s_min( add( q_fr_bands[0], L_norm_arr( fr_bands_fx[0], 2 * NB_BANDS ) ), add( hFrontVad->hNoiseEst->q_bckr, L_norm_arr( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS ) ) ); - scale_sig32( fr_bands_fx[0], 40, sub( scale, q_fr_bands[0] ) ); // scale - scale_sig32( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->q_bckr ) ); // scale - hFrontVad->hNoiseEst->q_bckr = q_fr_bands[0] = scale; - move16(); - move16(); - - noise_est_down_ivas_fx( fr_bands_fx[0], q_fr_bands[0], hFrontVad->hNoiseEst->bckr_fx, tmpN_fx, tmpE_fx, st->min_band, st->max_band, + Word16 q_tmpN, q_tmpE; + noise_est_down_ivas_fx( fr_bands_fx[0], q_fr_bands[0], hFrontVad->hNoiseEst->bckr_fx, &hFrontVad->hNoiseEst->q_bckr, tmpN_fx, &q_tmpN, tmpE_fx, &q_tmpE, st->min_band, st->max_band, &hFrontVad->hNoiseEst->totalNoise_fx, Etot_fx[0], &hFrontVad->hNoiseEst->Etot_last_fx, &hFrontVad->hNoiseEst->Etot_v_h2_fx ); corr_shift_fx = correlation_shift_fx( hFrontVad->hNoiseEst->totalNoise_fx ); /* Q15 */ @@ -727,18 +721,18 @@ ivas_error front_vad_spar_fx( Scale_sig32( epsP_fx, M + 1, scale ); // Q_esp scale = add( hFrontVad->hNoiseEst->ave_enr_q, s_min( L_norm_arr( hFrontVad->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( hFrontVad->hNoiseEst->ave_enr2_fx, NB_BANDS ) ) ); - scale = s_min( scale, add( hFrontVad->hNoiseEst->q_bckr, L_norm_arr( tmpE_fx, NB_BANDS ) ) ); + scale = s_min( scale, add( q_tmpE, L_norm_arr( tmpE_fx, NB_BANDS ) ) ); scale = sub( s_min( scale, Q31 ), 1 ); scale_sig32( hFrontVad->hNoiseEst->ave_enr_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->ave_enr_q ) ); scale_sig32( hFrontVad->hNoiseEst->ave_enr2_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->ave_enr_q ) ); - scale_sig32( tmpE_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->q_bckr ) ); + scale_sig32( tmpE_fx, NB_BANDS, sub( scale, q_tmpE ) ); hFrontVad->hNoiseEst->ave_enr_q = scale; move16(); - scale = add( hFrontVad->hNoiseEst->q_bckr, s_min( L_norm_arr( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS ), L_norm_arr( tmpN_fx, NB_BANDS ) ) ); + scale = s_min( add( hFrontVad->hNoiseEst->q_bckr, L_norm_arr( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS ) ), add( q_tmpN, L_norm_arr( tmpN_fx, NB_BANDS ) ) ); scale = sub( s_min( Q31, scale ), 1 ); // guard bits scale_sig32( hFrontVad->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->q_bckr ) ); - scale_sig32( tmpN_fx, NB_BANDS, sub( scale, hFrontVad->hNoiseEst->q_bckr ) ); + scale_sig32( tmpN_fx, NB_BANDS, sub( scale, q_tmpN ) ); hFrontVad->hNoiseEst->q_bckr = scale; move16(); diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index e59ef07d9..c8f698da9 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -740,14 +740,17 @@ void noise_est_down_ivas_fx( const Word32 fr_bands[], /* i : per band input energy (contains 2 vectors) q_fr_bands */ const Word16 q_fr_bands, /* i : Q of fr_bands */ Word32 bckr[], /* i/o: per band background noise energy estimate q_fr_bands */ - Word32 tmpN[], /* o : temporary noise update q_fr_bands */ - Word32 enr[], /* o : averaged energy over both subframes */ - const Word16 min_band, /* i : minimum critical band */ - const Word16 max_band, /* i : maximum critical band */ - Word16 *totalNoise, /* o : noise estimate over all critical bands */ - Word16 Etot, /* i : Energy of current frame */ - Word16 *Etot_last, /* i/o: Energy of last frame Q8 */ - Word16 *Etot_v_h2 /* i/o: Energy variations of noise frames Q8 */ + Word16 *q_bckr, + Word32 tmpN[], /* o : temporary noise update q_fr_bands */ + Word16 *q_tmpN, + Word32 enr[], /* o : averaged energy over both subframes */ + Word16 *q_enr, + const Word16 min_band, /* i : minimum critical band */ + const Word16 max_band, /* i : maximum critical band */ + Word16 *totalNoise, /* o : noise estimate over all critical bands */ + Word16 Etot, /* i : Energy of current frame */ + Word16 *Etot_last, /* i/o: Energy of last frame Q8 */ + Word16 *Etot_v_h2 /* i/o: Energy variations of noise frames Q8 */ ) { @@ -755,13 +758,17 @@ void noise_est_down_ivas_fx( const Word32 *pt1, *pt2; Word16 i; Word16 e_Noise, f_Noise; - Word32 e_min; Word32 totalNoise_temp; Word32 L_Etot, L_Etot_last, L_Etot_v_h2, L_Etot_v; Word64 sum; Word16 q_sum; + Word32 enr32[NB_BANDS], bckr32[NB_BANDS], tmpN32[NB_BANDS]; + Word16 enr_q[NB_BANDS], bckr_q[NB_BANDS], tmpN_q[NB_BANDS]; + Word16 shift, shift1, shift2, shift3; + Word64 tmpN64, tmp, enr64; - e_min = L_shl( E_MIN_FXQ31, sub( q_fr_bands, Q31 ) ); // q_fr_bands + Copy32( bckr, bckr32, NB_BANDS ); + set16_fx( bckr_q, *q_bckr, NB_BANDS ); L_Etot = L_shl( Etot, 16 ); /*Q24 for later AR1 computations*/ L_Etot_last = L_shl( *Etot_last, 16 ); @@ -778,7 +785,7 @@ void noise_est_down_ivas_fx( { sum = W_mac_32_16( sum, bckr[i], 1 ); // q_fr_bands+1 } - q_sum = add( q_fr_bands, 1 ); + q_sum = add( *q_bckr, 1 ); IF( sum == 0 ) { sum = W_mult0_32_32( E_MIN_FXQ31, add( sub( max_band, min_band ), 1 ) ); // Q31 @@ -808,8 +815,12 @@ void noise_est_down_ivas_fx( FOR( i = 0; i < NB_BANDS; i++ ) { /* enr[i] = 0.5f * ( *pt1++ + *pt2++ ); */ - enr[i] = W_extract_h( W_mac_32_32( W_mult_32_32( *pt1, ONE_IN_Q30 ), *pt2, ONE_IN_Q30 ) ); // q_fr_bands+30+1-32+1 = q_fr_bands + enr64 = W_mac_32_32( W_mult_32_32( *pt1, ONE_IN_Q29 ), *pt2, ONE_IN_Q29 ); // q_fr_bands + 1 + Q29 + 1 (0.5 handle here) + shift = W_norm( enr64 ); + enr32[i] = W_extract_h( W_shl( enr64, shift ) ); move32(); + enr_q[i] = sub( add( q_fr_bands, shift ), 1 ); + move16(); pt1++; pt2++; } @@ -817,20 +828,66 @@ void noise_est_down_ivas_fx( /*-----------------------------------------------------------------* * Background noise energy update *-----------------------------------------------------------------*/ - FOR( i = 0; i < NB_BANDS; i++ ) { /* tmpN[i] = (1-ALPHA) * bckr[i] + ALPHA * enr[i]; */ /* handle div by zero in find_tilt_fx */ - tmpN[i] = L_max( Madd_32_16( Mpy_32_16_1( bckr[i], ALPHAM1_FX ), enr[i], ALPHA_FX ), e_min ); // q_fr_bands - move32(); - /* if( tmpN[i] < bckr[i] ) { bckr[i] = tmpN[i]; }*/ - /* Defend to increase noise estimate: keep as it is or decrease */ - bckr[i] = L_max( L_min( bckr[i], tmpN[i] ), e_min ); // q_fr_bands + tmpN64 = W_mult_32_16( bckr32[i], ALPHAM1_FX ); + tmp = W_mult_32_16( enr32[i], ALPHA_FX ); + + shift = s_min( bckr_q[i], enr_q[i] ); + tmpN64 = W_add( W_shl( tmpN64, sub( shift, bckr_q[i] ) ), W_shl( tmp, sub( shift, enr_q[i] ) ) ); // shift + q16 + shift1 = W_norm( tmpN64 ); + tmpN32[i] = W_extract_h( W_shl( tmpN64, shift1 ) ); // shift + q16 + shift1 - 32 move32(); + tmpN_q[i] = sub( add( add( Q16, shift ), shift1 ), 32 ); + move16(); + + IF( GT_32( E_MIN_FXQ31, L_shl_sat( tmpN32[i], sub( 31, tmpN_q[i] ) ) ) ) + { + tmpN32[i] = E_MIN_FXQ31; + tmpN_q[i] = 31; + move32(); + move16(); + } + + IF( GT_32( bckr32[i], L_shl_sat( tmpN32[i], sub( bckr_q[i], tmpN_q[i] ) ) ) ) + { + bckr32[i] = tmpN32[i]; /* Defend to increase noise estimate: keep as it is or decrease */ + bckr_q[i] = tmpN_q[i]; + move32(); + move16(); + } } + /* Scaling to common Q*/ + shift1 = bckr_q[0], shift2 = enr_q[0], shift3 = tmpN_q[0]; + move16(); + move16(); + move16(); + + FOR( i = 1; i < NB_BANDS; i++ ) + { + shift1 = s_min( shift1, bckr_q[i] ); + shift2 = s_min( shift2, enr_q[i] ); + shift3 = s_min( shift3, tmpN_q[i] ); + } + FOR( i = 0; i < NB_BANDS; i++ ) + { + bckr[i] = L_shl( bckr32[i], sub( shift1, bckr_q[i] ) ); + enr[i] = L_shl( enr32[i], sub( shift2, enr_q[i] ) ); + tmpN[i] = L_shl( tmpN32[i], sub( shift3, tmpN_q[i] ) ); + move32(); + move32(); + move32(); + } + *q_bckr = shift1; + *q_enr = shift2; + *q_tmpN = shift3; + move16(); + move16(); + move16(); /*------------------------------------------------------------------* * Energy variation update *------------------------------------------------------------------*/ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 95bcb70d2..1319d2862 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -355,8 +355,11 @@ void noise_est_down_ivas_fx( const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) */ const Word16 q_fr_bands, /* i : Q of fr_bands */ Word32 bckr[], /* i/o: per band background noise energy estimate */ + Word16 *q_bckr, Word32 tmpN[], /* o : temporary noise update */ + Word16 *q_tmpN, Word32 enr[], /* o : averaged energy over both subframes */ + Word16 *q_enr, const Word16 min_band, /* i : minimum critical band */ const Word16 max_band, /* i : maximum critical band */ Word16 *totalNoise, /* o : noise estimate over all critical bands */ -- GitLab From 5ab1f5c22a35df4fed0295535be6cec0844a4151 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Apr 2025 11:58:57 +0530 Subject: [PATCH 346/358] Clang formatting changes --- lib_enc/ivas_core_pre_proc_front_fx.c | 2 +- lib_enc/prot_fx_enc.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index b2fdcf821..0d6a5901a 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -775,7 +775,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); } - Word16 scale = add( L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS ), st->hNoiseEst->q_enrO ); + Word16 scale = add( L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS ), st->hNoiseEst->q_enrO ); scale = s_min( scale, fr_bands_fx_q ); scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, sub( scale, st->hNoiseEst->q_enrO ) ); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 1319d2862..51e9849c7 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -356,16 +356,16 @@ void noise_est_down_ivas_fx( const Word16 q_fr_bands, /* i : Q of fr_bands */ Word32 bckr[], /* i/o: per band background noise energy estimate */ Word16 *q_bckr, - Word32 tmpN[], /* o : temporary noise update */ + Word32 tmpN[], /* o : temporary noise update */ Word16 *q_tmpN, - Word32 enr[], /* o : averaged energy over both subframes */ + Word32 enr[], /* o : averaged energy over both subframes */ Word16 *q_enr, - const Word16 min_band, /* i : minimum critical band */ - const Word16 max_band, /* i : maximum critical band */ - Word16 *totalNoise, /* o : noise estimate over all critical bands */ - Word16 Etot, /* i : Energy of current frame */ - Word16 *Etot_last, /* i/o: Energy of last frame Q8 */ - Word16 *Etot_v_h2 /* i/o: Energy variations of noise frames Q8 */ + const Word16 min_band, /* i : minimum critical band */ + const Word16 max_band, /* i : maximum critical band */ + Word16 *totalNoise, /* o : noise estimate over all critical bands */ + Word16 Etot, /* i : Energy of current frame */ + Word16 *Etot_last, /* i/o: Energy of last frame Q8 */ + Word16 *Etot_v_h2 /* i/o: Energy variations of noise frames Q8 */ ); void noise_est_fx( -- GitLab From a23e871dc20d37f820e832a9a5ac786bbca7ddca Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 11 Apr 2025 16:58:15 +0530 Subject: [PATCH 347/358] Fix for 3GPP issue 1466: Large deviations observed with the extrapolation of shifted channel by TD-ITD compensation in stereo Link #1466, #1463 --- lib_enc/ivas_cpe_enc_fx.c | 3 +++ lib_enc/ivas_stereo_dft_td_itd_fx.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index be0afc1a4..1bb31810d 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -785,6 +785,9 @@ ivas_error ivas_cpe_enc_fx( } stereo_td_itd_mdct_stereo_fx( hCPE, vad_flag_dtx, vad_hover_flag, input_frame ); + + Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx - input_frame, sts[0]->input32_fx - input_frame, shl( input_frame, 1 ), sub( sts[0]->q_inp32, sts[0]->q_inp ) ); + Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx - input_frame, sts[1]->input32_fx - input_frame, shl( input_frame, 1 ), sub( sts[1]->q_inp32, sts[1]->q_inp ) ); } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index 569a5690a..c457faa4f 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -575,9 +575,12 @@ void stereo_td_itd_mdct_stereo_fx( /*call ITD function*/ stereo_dft_enc_compute_itd_fx( hCPE, DFT_fx[0], DFT_tmp_e[0], DFT_fx[1], DFT_tmp_e[1], STEREO_DFT_OFFSET, input_frame, vad_flag_dtx, vad_hover_flag, bin_nrgL_fx, bin_nrgL_e, bin_nrgR_fx, bin_nrgR_e ); + q_com = MAX_16; + move16(); + FOR( n = 0; n < CPE_CHANNELS; n++ ) { - q_com = add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ); + q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->input_fx, input_frame ), hCPE->hCoreCoder[n]->q_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame ), hCPE->hCoreCoder[n]->q_old_inp ) ); q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hStereoMdct->hDft_ana->dft_ovl ), hCPE->q_input_mem[n] ) ); @@ -586,7 +589,10 @@ void stereo_td_itd_mdct_stereo_fx( q_com = 0; move16(); } + } + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( q_com, hCPE->hCoreCoder[n]->q_inp ) ); hCPE->hCoreCoder[n]->q_inp = q_com; move16(); -- GitLab From 2d7c39d471ad5d01b4bc893e8176e60ae38345ce Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Thu, 10 Apr 2025 16:39:51 +0530 Subject: [PATCH 348/358] Updates in stereo_mdct_core_enc_fx for precision improvement --- lib_com/fft_fx.c | 143 ----------------- lib_com/prot_fx.h | 7 + lib_com/tools_fx.c | 164 +++++++++++++++++++ lib_enc/ivas_stereo_mdct_core_enc_fx.c | 210 +++++++++++++++++-------- lib_enc/prot_fx_enc.h | 8 + lib_enc/tcx_utils_enc_fx.c | 111 +++++++++++++ 6 files changed, 438 insertions(+), 205 deletions(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 31b11a9ea..5ee509879 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -7555,146 +7555,3 @@ void rfft_fx( return; } - -Word16 find_guarded_bits_fx( Word32 n ) -{ - // return n <= 1 ? 0 : n <= 2 ? 1 - // : n <= 4 ? 2 - // : n <= 8 ? 3 - // : n <= 16 ? 4 - // : n <= 32 ? 5 - // : n <= 64 ? 6 - // : n <= 128 ? 7 - // : n <= 256 ? 8 - // : n <= 512 ? 9 - // : n <= 1024 ? 10 - // : n <= 2048 ? 11 - // : n <= 4096 ? 12 - // : n <= 8192 ? 13 - // : n <= 16384 ? 14 - // : 15; - /*Word16 val = 0; - move32(); - test(); - WHILE( GT_32( n, L_shl( 1, val ) ) && LT_32( val, 16 ) ) - { - val = add( val, 1 ); - }*/ - IF( LE_32( n, 1 ) ) - { - return 0; - } - ELSE - { - - return sub( 31, norm_l( L_sub( n, 1 ) ) ); - } -} - -Word16 L_norm_arr( const Word32 *arr, Word16 size ) -{ - Word16 q = 31; - move16(); - FOR( Word16 i = 0; i < size; i++ ) - { - Word16 q_tst; - - q_tst = norm_l( arr[i] ); - if ( arr[i] != 0 ) - { - q = s_min( q, q_tst ); - } - } - - return q; -} - -Word16 norm_arr( Word16 *arr, Word16 size ) -{ - Word16 q = 15; - Word16 exp = 0; - move16(); - move16(); - FOR( Word16 i = 0; i < size; i++ ) - { - if ( arr[i] != 0 ) - { - exp = norm_s( arr[i] ); - } - if ( arr[i] != 0 ) - { - q = s_min( q, exp ); - } - } - return q; -} - -Word16 W_norm_arr( Word64 *arr, Word16 size ) -{ - Word16 q = 63; - Word16 exp = 0; - move16(); - move16(); - FOR( Word16 i = 0; i < size; i++ ) - { - if ( arr[i] != 0 ) - { - exp = W_norm( arr[i] ); - } - if ( arr[i] != 0 ) - { - q = s_min( q, exp ); - } - } - return q; -} - -Word16 get_min_scalefactor( Word32 x, Word32 y ) -{ - Word16 scf_y; - Word16 scf = Q31; - move16(); - - test(); - if ( x == 0 && y == 0 ) - { - scf = 0; - move16(); - } - - if ( x != 0 ) - { - scf = norm_l( x ); - } - - scf_y = norm_l( y ); - if ( y != 0 ) - { - scf = s_min( scf_y, scf ); - } - - return scf; -} - - -Flag is_zero_arr( Word32 *arr, Word16 size ) -{ - FOR( Word16 i = 0; i < size; i++ ) - IF( arr[i] != 0 ) - { - return 0; - } - - return 1; -} - -Flag is_zero_arr16( Word16 *arr, Word16 size ) -{ - FOR( Word16 i = 0; i < size; i++ ) - IF( arr[i] != 0 ) - { - return 0; - } - - return 1; -} diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 1452d8e2e..e60b8ac92 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1444,6 +1444,13 @@ void scale_sig32( const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx xx exp */ ); + +void Scale_sig64( + Word64 x[], /* i/o: signal to scale Qx */ + Word16 len, /* i : size of x[] Q0 */ + Word16 exp /* i : exponent: x = round(x << exp) Qx exp */ +); + void scale_sig32_r( Word32 x[], /* i/o: signal to scale Qx */ const Word16 lg, /* i : size of x[] Q0 */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 9e5547c7d..5f0e172bf 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -4526,3 +4526,167 @@ void v_add_fixed_me( return; } + +Word16 find_guarded_bits_fx( Word32 n ) +{ + // return n <= 1 ? 0 : n <= 2 ? 1 + // : n <= 4 ? 2 + // : n <= 8 ? 3 + // : n <= 16 ? 4 + // : n <= 32 ? 5 + // : n <= 64 ? 6 + // : n <= 128 ? 7 + // : n <= 256 ? 8 + // : n <= 512 ? 9 + // : n <= 1024 ? 10 + // : n <= 2048 ? 11 + // : n <= 4096 ? 12 + // : n <= 8192 ? 13 + // : n <= 16384 ? 14 + // : 15; + /*Word16 val = 0; + move32(); + test(); + WHILE( GT_32( n, L_shl( 1, val ) ) && LT_32( val, 16 ) ) + { + val = add( val, 1 ); + }*/ + IF( LE_32( n, 1 ) ) + { + return 0; + } + ELSE + { + + return sub( 31, norm_l( L_sub( n, 1 ) ) ); + } +} + +Word16 L_norm_arr( const Word32 *arr, Word16 size ) +{ + Word16 q = 31; + move16(); + FOR( Word16 i = 0; i < size; i++ ) + { + Word16 q_tst; + + q_tst = norm_l( arr[i] ); + if ( arr[i] != 0 ) + { + q = s_min( q, q_tst ); + } + } + + return q; +} + +Word16 norm_arr( Word16 *arr, Word16 size ) +{ + Word16 q = 15; + Word16 exp = 0; + move16(); + move16(); + FOR( Word16 i = 0; i < size; i++ ) + { + if ( arr[i] != 0 ) + { + exp = norm_s( arr[i] ); + } + if ( arr[i] != 0 ) + { + q = s_min( q, exp ); + } + } + return q; +} + +Word16 W_norm_arr( Word64 *arr, Word16 size ) +{ + Word16 q = 63; + Word16 exp = 0; + move16(); + move16(); + FOR( Word16 i = 0; i < size; i++ ) + { + if ( arr[i] != 0 ) + { + exp = W_norm( arr[i] ); + } + if ( arr[i] != 0 ) + { + q = s_min( q, exp ); + } + } + return q; +} + +Word16 get_min_scalefactor( Word32 x, Word32 y ) +{ + Word16 scf_y; + Word16 scf = Q31; + move16(); + + test(); + if ( x == 0 && y == 0 ) + { + scf = 0; + move16(); + } + + if ( x != 0 ) + { + scf = norm_l( x ); + } + + scf_y = norm_l( y ); + if ( y != 0 ) + { + scf = s_min( scf_y, scf ); + } + + return scf; +} + + +Flag is_zero_arr( Word32 *arr, Word16 size ) +{ + FOR( Word16 i = 0; i < size; i++ ) + IF( arr[i] != 0 ) + { + return 0; + } + + return 1; +} + +Flag is_zero_arr16( Word16 *arr, Word16 size ) +{ + FOR( Word16 i = 0; i < size; i++ ) + IF( arr[i] != 0 ) + { + return 0; + } + + return 1; +} + +void Scale_sig64( + Word64 x[], /* i/o: signal to scale Qx */ + Word16 len, /* i : size of x[] Q0 */ + Word16 exp /* i : exponent: x = round(x << exp) Qx exp */ +) +{ + Word16 i; + assert( exp <= 63 && exp >= -63 ); + IF( exp == 0 ) + { + return; + } + + FOR( i = 0; i < len; i++ ) + { + /* saturation can occur here */ + x[i] = W_shl( x[i], exp ); + move64(); + } +} diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 1346d634b..91b8726f0 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -135,10 +135,8 @@ void stereo_mdct_core_enc_fx( { Word32 orig_spectrum_long_fx[CPE_CHANNELS][N_MAX]; /* MDCT output (L/R). */ Word32 *orig_spectrum_fx[CPE_CHANNELS][NB_DIV]; /* Pointers to MDCT output for a short block (L/R) */ - Word32 powerSpec_fx[CPE_CHANNELS][N_MAX]; - Word32 powerSpec_fx_tmp[CPE_CHANNELS][N_MAX]; /* This 32 bit buffer is created to preserve the precision for original separate Q calculation of powerSpec_fx buffer ( Related to 3gpp issue #1192 ) */ - Word32 *p_powerSpec_fx[CPE_CHANNELS]; - Word16 exp_powerSpec[CPE_CHANNELS][N_MAX + L_MDCT_OVLP_MAX]; + Word64 powerSpec64[CPE_CHANNELS][N_MAX]; + Word16 exp_powerSpec64[CPE_CHANNELS][NB_DIV]; Word32 powerSpecMsInv_long_fx[CPE_CHANNELS][N_MAX]; /* MS inv power spectrum, also inverse MDST spectrum */ Word32 *powerSpecMsInv_fx[CPE_CHANNELS][NB_DIV]; Word32 quantized_spectrum_long_fx[CPE_CHANNELS][N_MAX]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ @@ -153,7 +151,7 @@ void stereo_mdct_core_enc_fx( Word32 *p_mdst_spectrum_long_fx[CPE_CHANNELS]; Word32 mdst_spectrum_long_fx[CPE_CHANNELS][N_MAX]; Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; - Word16 q_powSpec[MCT_MAX_CHANNELS], q_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; + Word16 q_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; Word16 tmp_q_powSpec[N_MAX], tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word64 W_tmp; Encoder_State *st, **sts; @@ -184,12 +182,11 @@ void stereo_mdct_core_enc_fx( p_orig_spectrum_long_fx[ch] = orig_spectrum_long_fx[ch]; orig_spectrum_fx[ch][0] = orig_spectrum_long_fx[ch]; orig_spectrum_fx[ch][1] = orig_spectrum_long_fx[ch] + N_TCX10_MAX; - set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX ); + set16_fx( exp_powerSpec64[ch], 0, NB_DIV ); } set16_fx( tmp_q_powSpecInv, 63, N_MAX ); set16_fx( tmp_q_powSpec, 63, N_MAX ); - set16_fx( q_powSpec, 31, MCT_MAX_CHANNELS ); set16_fx( q_powSpecMsInv, 31, MCT_MAX_CHANNELS ); tmp_q_psi[0] = tmp_q_powSpecInv; @@ -264,11 +261,10 @@ void stereo_mdct_core_enc_fx( inv_spectrum_fx[ch][1] = quantized_spectrum_fx[ch][1]; mdst_spectrum_fx[ch][0] = mdst_spectrum_long_fx[ch]; mdst_spectrum_fx[ch][1] = mdst_spectrum_long_fx[ch] + N_TCX10_MAX; + set64_fx( powerSpec64[ch], 0, N_MAX ); set32_fx( powerSpecMsInv_long_fx[ch], 0, N_MAX ); set32_fx( quantized_spectrum_long_fx[ch], 0, N_MAX ); set32_fx( mdst_spectrum_long_fx[ch], 0, N_MAX ); - set32_fx( powerSpec_fx[ch], 0, N_MAX ); - set32_fx( powerSpec_fx_tmp[ch], 0, N_MAX ); set32_fx( powerSpecMsInv_long_fx[ch], 0, N_MAX ); sts[ch]->hTcxEnc->tns_ms_flag[0] = 0; move16(); @@ -383,7 +379,7 @@ void stereo_mdct_core_enc_fx( } } - q_spec = sub( add( hdrm_min, q_spec ), 2 ); /* 2 guard bits to avoid over-flows (1 for stereo_coder_tcx_fx and other for power spectrum calculation )*/ + q_spec = sub( add( hdrm_min, q_spec ), 1 ); /* 1 guard bit to avoid over-flows in stereo_coder_tcx_fx */ FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -407,7 +403,8 @@ void stereo_mdct_core_enc_fx( /*--------------------------------------------------------------* * Power spectrum calculation *---------------------------------------------------------------*/ - Word16 length; + Word16 length, exp, shift1, shift2, norm; + Word32 mdct, mdst; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -437,17 +434,13 @@ void stereo_mdct_core_enc_fx( IF( sts[ch]->hTcxEnc->tns_ms_flag[n] ) { + exp = add( s_max( mdst_spectrum_e[ch][n], sts[ch]->hTcxEnc->spectrum_e[n] ), 1 ); + shift1 = sub( mdst_spectrum_e[ch][n], exp ); + shift2 = sub( sts[ch]->hTcxEnc->spectrum_e[n], exp ); + /* power spectrum: MDCT^2 + MDST^2 */ FOR( i = 0; i < L_subframeTCX; i++ ) { - W_tmp = W_mac_32_32( W_mult_32_32( mdst_spectrum_fx[ch][n][i], mdst_spectrum_fx[ch][n][i] ), sts[ch]->hTcxEnc->spectrum_fx[n][i], sts[ch]->hTcxEnc->spectrum_fx[n][i] ); /* 2*q_spec+1 */ - tmp_s = W_norm( W_tmp ); - W_tmp = W_shl( W_tmp, tmp_s ); /* 2*q_spec+1+tmp_s */ - powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )] = W_extract_h( W_tmp ); /* 2*q_spec+1+tmp_s-32 */ - tmp_q_powSpec[( i + ( n * L_subframeTCX ) )] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 - move32(); - move16(); - W_tmp = W_mac_32_32( W_mult_32_32( inv_mdst_spectrum_fx[ch][n][i], inv_mdst_spectrum_fx[ch][n][i] ), inv_spectrum_fx[ch][n][i], inv_spectrum_fx[ch][n][i] ); /* 2*q_spec+1 */ tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); /* 2*q_spec+1+tmp_s */ @@ -455,7 +448,14 @@ void stereo_mdct_core_enc_fx( tmp_q_psi[n][i] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 move32(); move16(); + + mdst = L_shl( mdst_spectrum_fx[ch][n][i], shift1 ); // exp: exp + mdct = L_shl( sts[ch]->hTcxEnc->spectrum_fx[n][i], shift2 ); // exp: exp + powerSpec64[ch][i + n * L_subframeTCX] = W_mac_32_32( W_mult_32_32( mdct, mdct ), mdst, mdst ); // exp: 2*exp + move64(); } + exp_powerSpec64[ch][n] = shl( exp, 1 ); + move16(); } ELSE { @@ -493,53 +493,31 @@ void stereo_mdct_core_enc_fx( } /* power spectrum: MDCT^2 + MDST^2 */ - W_tmp = W_mult_32_32( sts[ch]->hTcxEnc->spectrum_fx[n][0], sts[ch]->hTcxEnc->spectrum_fx[n][0] ); /* 2*q_spec+1 */ - tmp_s = W_norm( W_tmp ); - W_tmp = W_shl( W_tmp, tmp_s ); /* 2*q_spec+1+tmp_s */ - powerSpec_fx[ch][n * L_subframeTCX] = W_extract_h( W_tmp ); /* 2*q_spec+1+tmp_s-32 */ - tmp_q_powSpec[n * L_subframeTCX] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 - move32(); - move16(); + mdct = L_shr( sts[ch]->hTcxEnc->spectrum_fx[n][0], 1 ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1 + powerSpec64[ch][n * L_subframeTCX] = W_mult_32_32( mdct, mdct ); // exp: 2(sts[ch]->hTcxEnc->spectrum_e[n]+1) + move64(); FOR( i = 1; i < L_subframeTCX - 1; i++ ) { - Word32 mdst_fx = L_sub( sts[ch]->hTcxEnc->spectrum_fx[n][i + 1], sts[ch]->hTcxEnc->spectrum_fx[n][i - 1] ); /* An MDST estimate q_spec*/ - - W_tmp = W_mac_32_32( W_mult_32_32( mdst_fx, mdst_fx ), sts[ch]->hTcxEnc->spectrum_fx[n][i], sts[ch]->hTcxEnc->spectrum_fx[n][i] ); /* 2*q_spec+1 */ - tmp_s = W_norm( W_tmp ); - W_tmp = W_shl( W_tmp, tmp_s ); /* 2*q_spec+1+tmp_s */ - powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )] = W_extract_h( W_tmp ); /* 2*q_spec+1+tmp_s-32 */ - tmp_q_powSpec[( i + ( n * L_subframeTCX ) )] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 - move32(); - move16(); + mdct = L_shr( sts[ch]->hTcxEnc->spectrum_fx[n][i], 1 ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1 + mdst = L_sub( L_shr( sts[ch]->hTcxEnc->spectrum_fx[n][i + 1], 1 ), L_shr( sts[ch]->hTcxEnc->spectrum_fx[n][i - 1], 1 ) ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1 + powerSpec64[ch][i + n * L_subframeTCX] = W_mac_32_32( W_mult_32_32( mdct, mdct ), mdst, mdst ); // exp: 2(sts[ch]->hTcxEnc->spectrum_e[n]+1) + move64(); } - W_tmp = W_mult_32_32( sts[ch]->hTcxEnc->spectrum_fx[n][L_subframeTCX - 1], sts[ch]->hTcxEnc->spectrum_fx[n][L_subframeTCX - 1] ); /* 2*q_spec+1 */ - tmp_s = W_norm( W_tmp ); - W_tmp = W_shl( W_tmp, tmp_s ); /* 2*q_spec+1+tmp_s */ - powerSpec_fx[ch][( ( L_subframeTCX - 1 ) + ( n * L_subframeTCX ) )] = W_extract_h( W_tmp ); /* 2*q_spec+1+tmp_s-32 */ - tmp_q_powSpec[( ( L_subframeTCX - 1 ) + ( n * L_subframeTCX ) )] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 - move32(); + mdct = L_shr( sts[ch]->hTcxEnc->spectrum_fx[n][L_subframeTCX - 1], 1 ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1 + powerSpec64[ch][L_subframeTCX - 1 + n * L_subframeTCX] = W_mult_32_32( mdct, mdct ); // exp: 2(sts[ch]->hTcxEnc->spectrum_e[n]+1) + move64(); + + exp_powerSpec64[ch][n] = shl( add( sts[ch]->hTcxEnc->spectrum_e[n], 1 ), 1 ); move16(); } } /* Aligning the Q-factors */ { - q_powSpec[ch] = Q31; q_powSpecMsInv[ch] = Q31; move16(); - move16(); - FOR( i = 0; i < N_MAX; i++ ) - { - IF( powerSpec_fx[ch][i] != 0 ) - { - q_powSpec[ch] = s_min( q_powSpec[ch], tmp_q_powSpec[i] ); - move16(); - exp_powerSpec[ch][i] = sub( Q31, tmp_q_powSpec[i] ); - move16(); - } - } FOR( n = 0; n < nSubframes; n++ ) { FOR( i = 0; i < L_subframeTCX; i++ ) @@ -551,16 +529,11 @@ void stereo_mdct_core_enc_fx( } } } - FOR( n = 0; n < nSubframes; n++ ) { FOR( i = 0; i < L_subframeTCX; i++ ) { powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powSpecMsInv[ch] ) ); - /* Here precision is preserved for powerSpec_fx buffer by storing the fixed Q copy of same buffer in powerSpec_fx_tmp buffer */ - /* powerSpec_fx implementation has separate Q for each index, powerSpec_fx_tmp has all indices in same Q beyond this point */ - powerSpec_fx_tmp[ch][( i + ( n * L_subframeTCX ) )] = L_shr( powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )], sub( tmp_q_powSpec[i + ( n * L_subframeTCX )], q_powSpec[ch] ) ); /* q_powSpec */ - move32(); move32(); } } @@ -596,8 +569,9 @@ void stereo_mdct_core_enc_fx( * and quantization (0: tonal, 1: noise-like). * * Detect low pass if present. * *-----------------------------------------------------------*/ - ComputeSpectrumNoiseMeasure_fx( powerSpec_fx_tmp[ch], L_subframeTCX, i_mult( st->hTcxEnc->nmStartLine, idiv1616( L_subframeTCX, st->hTcxEnc->L_frameTCX ) ), - NE_32( imult3216( st->last_sr_core, st->L_frame ), imult3216( st->sr_core, st->L_frame_past ) ) || NE_16( st->last_core, TCX_20_CORE ), st->hTcxEnc->memQuantZeros, L_subframeTCX ); + ComputeSpectrumNoiseMeasure_ivas_fx( powerSpec64[ch], L_subframeTCX, i_mult( st->hTcxEnc->nmStartLine, idiv1616( L_subframeTCX, st->hTcxEnc->L_frameTCX ) ), + NE_32( imult3216( st->last_sr_core, st->L_frame ), imult3216( st->sr_core, st->L_frame_past ) ) || NE_16( st->last_core, TCX_20_CORE ), + st->hTcxEnc->memQuantZeros, L_subframeTCX ); } st->hTcxEnc->measuredBwRatio = ONE_IN_Q14; /* No bandwidth limit for the noise filling Q14*/ @@ -630,8 +604,48 @@ void stereo_mdct_core_enc_fx( IF( ( NE_16( hStereoMdct->mdct_stereo_mode[n], hStereoMdct->IGFStereoMode[n] ) || EQ_16( hStereoMdct->mdct_stereo_mode[n], SMDCT_BW_MS ) ) && !hStereoMdct->isSBAStereoMode ) { IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS]; - p_powerSpec_fx[0] = powerSpec_fx_tmp[0]; - p_powerSpec_fx[1] = powerSpec_fx_tmp[1]; + Word32 powerSpec_fx[CPE_CHANNELS][N_MAX], *p_powerSpec_fx[CPE_CHANNELS]; + Word16 q_powSpec[CPE_CHANNELS]; + p_powerSpec_fx[0] = powerSpec_fx[0]; + p_powerSpec_fx[1] = powerSpec_fx[1]; + { + /* Copy powerSpec values from 64 bit buffer to 32 bit buffer */ + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + Word16 n1, nsub = 1; + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + move16(); + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + { + length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + nsub = NB_DIV; + move16(); + } + IF( EQ_16( sts[ch]->last_core, ACELP_CORE ) ) + { + length = add( length, shr( length, 2 ) ); + } + exp = sub( exp_powerSpec64[ch][0], W_norm_arr( powerSpec64[ch], length ) ); + IF( EQ_16( nsub, 2 ) ) + { + exp = s_max( exp, sub( exp_powerSpec64[ch][1], W_norm_arr( powerSpec64[ch] + length, length ) ) ); + } + FOR( n1 = 0; n1 < nsub; n1++ ) + { + shift1 = sub( sub( exp_powerSpec64[ch][n1], exp ), 32 ); + FOR( i = 0; i < length; i++ ) + { + /* This doesn't result in saturation */ + powerSpec_fx[ch][i + n1 * length] = W_shl_sat_l( powerSpec64[ch][i + n1 * length], shift1 ); // exp: exp + move32(); + } + } + set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); + q_powSpec[ch] = sub( 31, exp ); // exp: exp + move16(); + } + } hIGFEnc[0] = sts[0]->hIGFEnc; hIGFEnc[1] = sts[1]->hIGFEnc; @@ -677,6 +691,42 @@ void stereo_mdct_core_enc_fx( } ELSE { + Word32 powerSpec_fx[CPE_CHANNELS][N_MAX]; // each value has a different exponent + Word16 exp_powerSpec[CPE_CHANNELS][N_MAX + L_MDCT_OVLP_MAX]; + { + /* Copy powerSpec values from 64 bit buffer to 32 bit buffer */ + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + Word16 n1, nsub; + nsub = 1; + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + move16(); + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + { + length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + nsub = NB_DIV; + move16(); + } + IF( EQ_16( sts[ch]->last_core, ACELP_CORE ) ) + { + length = add( length, shr( length, 2 ) ); + } + FOR( n1 = 0; n1 < nsub; n1++ ) + { + FOR( i = 0; i < length; i++ ) + { + norm = W_norm( powerSpec64[ch][i + n1 * length] ); + powerSpec_fx[ch][i + n1 * length] = W_extract_h( W_shl( powerSpec64[ch][i + n1 * length], norm ) ); // exp = exp_powerSpec64[ch][n1]-norm + exp_powerSpec[ch][i + n1 * length] = sub( exp_powerSpec64[ch][n1], norm ); + move32(); + move16(); + } + } + set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); + set16_fx( exp_powerSpec[ch] + length, 0, sub( N_MAX + L_MDCT_OVLP_MAX, length ) ); + } + } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; @@ -703,6 +753,42 @@ void stereo_mdct_core_enc_fx( } ELSE { + Word32 powerSpec_fx[CPE_CHANNELS][N_MAX]; // each value has a different exponent + Word16 exp_powerSpec[CPE_CHANNELS][N_MAX + L_MDCT_OVLP_MAX]; + { + /* Copy powerSpec values from 64 bit buffer to 32 bit buffer */ + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + Word16 n1, nsub; + nsub = 1; + length = sts[ch]->hTcxEnc->L_frameTCX; + move16(); + move16(); + IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) + { + length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); + nsub = NB_DIV; + move16(); + } + IF( EQ_16( sts[ch]->last_core, ACELP_CORE ) ) + { + length = add( length, shr( length, 2 ) ); + } + FOR( n1 = 0; n1 < nsub; n1++ ) + { + FOR( i = 0; i < length; i++ ) + { + norm = W_norm( powerSpec64[ch][i + n1 * length] ); + powerSpec_fx[ch][i + n1 * length] = W_extract_h( W_shl( powerSpec64[ch][i + n1 * length], norm ) ); // exp = exp_powerSpec64[ch][n1]-norm + exp_powerSpec[ch][i + n1 * length] = sub( exp_powerSpec64[ch][n1], norm ); + move32(); + move16(); + } + } + set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); + set16_fx( exp_powerSpec[ch] + length, 0, sub( N_MAX + L_MDCT_OVLP_MAX, length ) ); + } + } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 51e9849c7..d6532b207 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1498,6 +1498,14 @@ void ComputeSpectrumNoiseMeasure_fx( const Word32 *powerSpec, Word8 *noiseFlags, Word16 lowpassLine ); +void ComputeSpectrumNoiseMeasure_ivas_fx( Word64 *powerSpec, /* Qx */ + Word16 L_frame, /* Q0 */ + Word16 startLine, /* Q0 */ + Word8 resetMemory, /* Q0 */ + Word8 *noiseFlags, /* Q0 */ + Word16 lowpassLine /* Q0 */ +); + void lpc_quantization_fx( Encoder_State *st, const Word16 lsp[], /* Q15 */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index ad1720665..46f83c094 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -172,6 +172,117 @@ void ComputeSpectrumNoiseMeasure_fx( const Word32 *powerSpec, } } +void ComputeSpectrumNoiseMeasure_ivas_fx( Word64 *powerSpec, /* Qx */ + Word16 L_frame, /* Q0 */ + Word16 startLine, /* Q0 */ + Word8 resetMemory, /* Q0 */ + Word8 *noiseFlags, /* Q0 */ + Word16 lowpassLine /* Q0 */ +) +{ + Word16 i, lastTone, j, exp; + Word32 c; + Word64 s, temp; + + IF( resetMemory != 0 ) + { + FOR( i = 0; i < lowpassLine; i++ ) + { + noiseFlags[i] = 0; + move16(); + } + } + + FOR( i = lowpassLine; i < L_frame; i++ ) + { + noiseFlags[i] = 1; + move16(); + } + + test(); + IF( powerSpec != NULL && LT_16( add( startLine, 6 ), L_frame ) ) + { + lastTone = 0; + move16(); + + /* noise-measure flags for spectrum filling and quantization (0: tonal, 1: noise-like) */ + i = sub( startLine, 1 ); + /* s = powerSpec[i - 7] + powerSpec[i - 6] + powerSpec[i - 5] + + powerSpec[i - 4] + powerSpec[i - 3] + powerSpec[i - 2] + + powerSpec[i - 1] + powerSpec[i] + powerSpec[i + 1] + + powerSpec[i + 2] + powerSpec[i + 3] + powerSpec[i + 4] + + powerSpec[i + 5] + powerSpec[i + 6] + powerSpec[i + 7]; */ + + s = powerSpec[i - 7]; // Qx + move64(); + FOR( j = -6; j < 8; j++ ) + { + s = W_add( s, powerSpec[i + j] ); // Qx + } + + FOR( i = i + 1; i < lowpassLine - 7; i++ ) + { + /* c = powerSpec[i - 1] + powerSpec[i] + powerSpec[i + 1]; */ + temp = W_add( W_add( powerSpec[i - 1], powerSpec[i] ), powerSpec[i + 1] ); + exp = W_norm( temp ); + c = W_extract_h( W_shl( temp, exp ) ); // Qx+exp-32 + + /* s += powerSpec[i + 7] - powerSpec[i - 8]; */ + s = W_sub( s, powerSpec[i - 8] ); // Qx + s = W_add( s, powerSpec[i + 7] ); // Qx + + /* ( 1.75f - 0.5f * noiseFlags[i] ) * c */ + temp = W_mult_32_32( c, L_msu0( 28672 /* 1.75 in Q14*/, 8192 /* 0.5 in Q14 */, noiseFlags[i] ) ); // Qx+exp-32+14+1 = Qx+exp-17 + + IF( GE_64( W_shl( s, sub( exp, Q17 ) ), temp ) /* s >= ( 1.75f - 0.5f * noiseFlags[i] ) * c */ ) // Qx+exp-17 + { + noiseFlags[i] = 1; + move16(); + } + ELSE + { + noiseFlags[i] = 0; + lastTone = i; + move16(); + move16(); + } + } + + /* lower L_frame*startRatio lines are tonal (0), upper 7 lines are processed separately */ + FOR( ; i < lowpassLine - 1; i++ ) + { + /* c = powerSpec[i - 1] + powerSpec[i] + powerSpec[i + 1]; */ + temp = W_add( W_add( powerSpec[i - 1], powerSpec[i] ), powerSpec[i + 1] ); + exp = W_norm( temp ); + c = W_extract_h( W_shl( temp, exp ) ); // Qx+exp-32 + + /* ( 1.75f - 0.5f * noiseFlags[i] ) * c */ + temp = W_mult_32_32( c, L_msu0( 28672 /* 1.75 in Q14*/, 8192 /* 0.5 in Q14 */, noiseFlags[i] ) ); // Qx+exp-32+14+1 = Qx+exp-17 + + IF( GE_64( W_shl( s, sub( exp, Q17 ) ), temp ) /* s >= ( 1.75f - 0.5f * noiseFlags[i] ) * c */ ) // Qx+exp-17 + { + noiseFlags[i] = 1; + move16(); + } + ELSE + { + noiseFlags[i] = 0; + lastTone = i; + move16(); + move16(); + } + } + noiseFlags[i] = 1; /* uppermost line is defined as noise-like (1) */ + move16(); + + if ( lastTone > 0 ) /* spread uppermost tonal line one line upward */ + { + noiseFlags[lastTone + 1] = 0; + move16(); + } + } +} + static void detectLowpassFac( const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_frame, Word8 rectWin, Word16 *pLpFac, Word16 lowpassLine ) { Word16 i, tmp; -- GitLab From 27e6f62214ad81b3fb1faef009456681844bc57e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 11 Apr 2025 18:10:32 +0530 Subject: [PATCH 349/358] Removed scalings before ProcessStereoIGF_fx in stereo_mdct_core_enc_fx and decoder MSAN fix --- lib_com/prot_fx.h | 6 +++ lib_dec/ivas_osba_dec_fx.c | 5 ++ lib_enc/igf_enc.c | 11 +++-- lib_enc/ivas_mct_enc_mct_fx.c | 12 +++-- lib_enc/ivas_stereo_mdct_core_enc_fx.c | 68 ++++++++------------------ lib_enc/tcx_utils_enc_fx.c | 6 ++- 6 files changed, 51 insertions(+), 57 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e60b8ac92..4257b7e79 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -10859,8 +10859,11 @@ void ProcessStereoIGF_fx( Word16 q_pITFMDCTSpectrum_1, Word16 q_pITFMDCTSpectrum_2, Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ + Word16 exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */ Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i : inverse power spectrum */ + Word16 exp_pPowerSpectrumMsInv_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrumMsInv_fx */ Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ + Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i/o: exp of inv_spectrum_fx */ const Word16 frameno, /* i : flag indicating index of current subfr. */ const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */ const Word32 element_brate, /* i : element bitrate */ @@ -10873,8 +10876,11 @@ void IGFEncApplyStereo_fx( const Word16 igfGridIdx, /* i : IGF grid index */ Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ + Word16 exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */ Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse power spectrum */ + Word16 exp_pPowerSpectrumMsInv_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrumMsInv_fx */ Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ + Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i : exp of inverse spectrum */ const Word16 frameno, /* i : flag indicating index of current subfr. */ const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */ const Word32 element_brate, /* i : element bitrate */ diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 80413b21a..d12bf12e9 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -138,6 +138,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( Word32 *p_sepobj_fx[BINAURAL_CHANNELS]; Word16 channel_offset; + FOR( Word16 i = 0; i < BINAURAL_CHANNELS; i++ ) + { + set32_fx( output_separated_objects_fx[i], 0, L_FRAME48k ); + } + FOR( n = 0; n < BINAURAL_CHANNELS; n++ ) { p_sepobj_fx[n] = &output_separated_objects_fx[n][0]; diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index c8e8974c2..bfb4a7423 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2626,8 +2626,11 @@ void IGFEncApplyStereo_fx( const Word16 igfGridIdx, /* i : IGF grid index */ Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ + Word16 exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */ Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse power spectrum */ + Word16 exp_pPowerSpectrumMsInv_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrumMsInv_fx */ Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ + Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i : exp of inverse spectrum */ const Word16 frameno, /* i : flag indicating index of current subfr. */ const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */ const Word32 element_brate, /* i : element bitrate */ @@ -2691,7 +2694,9 @@ void IGFEncApplyStereo_fx( last_core_acelp = extract_l( EQ_16( sts[ch]->last_core, ACELP_CORE ) ); IGF_UpdateInfo( hIGFEnc[ch], igfGridIdx ); - IGF_CalculateStereoEnvelope_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], sts[ch]->hTcxEnc->spectrum_e[frameno], inv_spectrum_fx[ch][frameno], sts[ch]->hTcxEnc->spectrum_e[frameno], pPowerSpectrumParameter_fx[ch], sts[ch]->hTcxEnc->spectrum_e[frameno], pPowerSpectrumParameterMsInv_fx[ch], sts[ch]->hTcxEnc->spectrum_e[frameno], igfGridIdx, coreMsMask, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp ); + IGF_CalculateStereoEnvelope_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], sts[ch]->hTcxEnc->spectrum_e[frameno], inv_spectrum_fx[ch][frameno], + exp_inv_spectrum_fx[ch], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrum_fx[ch], pPowerSpectrumParameterMsInv_fx[ch], + exp_pPowerSpectrumMsInv_fx[ch], igfGridIdx, coreMsMask, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp ); IF( EQ_16( sts[ch]->core, TCX_20_CORE ) ) { @@ -2702,11 +2707,11 @@ void IGFEncApplyStereo_fx( pPowerSpectrumParameter_fx[ch] = NULL; } - set16_fx( exp_pPowerSpectrum, sts[ch]->hTcxEnc->spectrum_e[frameno], L_FRAME48k ); + set16_fx( exp_pPowerSpectrum, exp_pPowerSpectrum_fx[ch], L_FRAME48k ); IGF_Whitening_ivas_fx( hIGFEnc[ch], pPowerSpectrumParameter_fx[ch], &exp_pPowerSpectrum[0], igfGridIdx, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, ( sts[0]->hTcxEnc->fUseTns[frameno] || sts[1]->hTcxEnc->fUseTns[frameno] ), sp_aud_decision0, element_brate, sts[ch]->element_mode ); - IGF_ErodeSpectrum_ivas_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], pPowerSpectrumParameter_fx[ch], sts[ch]->hTcxEnc->spectrum_e[frameno], igfGridIdx, mct_on ); + IGF_ErodeSpectrum_ivas_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrum_fx[ch], igfGridIdx, mct_on ); } return; } diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 78bf976d1..66bdb1235 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -1072,7 +1072,7 @@ void mctStereoIGF_enc_fx( IF( NE_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[n], hMCT->hBlockData[b]->hStereoMdct->IGFStereoMode[n] ) || EQ_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[n], SMDCT_BW_MS ) ) { - + Word16 exp_powerSpec_tmp[CPE_CHANNELS]; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { s = s_min( s, sub( 31, p_st[ch]->hTcxEnc->spectrum_e[n] ) ); @@ -1095,10 +1095,12 @@ void mctStereoIGF_enc_fx( move16(); move16(); } - - ProcessStereoIGF_fx( hMCT->hBlockData[b]->hStereoMdct, p_st, hMCT->hBlockData[b]->mask, - p_orig_spectrum_fx, q_origSpec, q_origSpec, - p_powerSpec_fx, p_powerSpecMsInv_fx, p_inv_spectrum_fx, n, sp_aud_decision0[ch1], p_st[0]->total_brate, 1 ); + exp_powerSpec_tmp[0] = p_st[0]->hTcxEnc->spectrum_e[0]; + exp_powerSpec_tmp[1] = p_st[1]->hTcxEnc->spectrum_e[0]; + move16(); + move16(); + ProcessStereoIGF_fx( hMCT->hBlockData[b]->hStereoMdct, p_st, hMCT->hBlockData[b]->mask, p_orig_spectrum_fx, q_origSpec, q_origSpec, p_powerSpec_fx, exp_powerSpec_tmp, + p_powerSpecMsInv_fx, exp_powerSpec_tmp, p_inv_spectrum_fx, exp_powerSpec_tmp, n, sp_aud_decision0[ch1], p_st[0]->total_brate, 1 ); } ELSE { diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 91b8726f0..46134a270 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -143,6 +143,7 @@ void stereo_mdct_core_enc_fx( Word32 *quantized_spectrum_fx[CPE_CHANNELS][NB_DIV]; Word32 *inv_mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV]; + Word16 exp_inv_spectrum[CPE_CHANNELS]; Word16 i, ch, nSubframes, L_subframeTCX; Word16 n, nAvailBits; Word16 tnsSize[CPE_CHANNELS][NB_DIV]; /* number of tns parameters put into prm */ @@ -151,8 +152,8 @@ void stereo_mdct_core_enc_fx( Word32 *p_mdst_spectrum_long_fx[CPE_CHANNELS]; Word32 mdst_spectrum_long_fx[CPE_CHANNELS][N_MAX]; Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; - Word16 q_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; - Word16 tmp_q_powSpec[N_MAX], tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; + Word16 exp_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; + Word16 tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word64 W_tmp; Encoder_State *st, **sts; STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct; @@ -186,8 +187,6 @@ void stereo_mdct_core_enc_fx( } set16_fx( tmp_q_powSpecInv, 63, N_MAX ); - set16_fx( tmp_q_powSpec, 63, N_MAX ); - set16_fx( q_powSpecMsInv, 31, MCT_MAX_CHANNELS ); tmp_q_psi[0] = tmp_q_powSpecInv; tmp_q_psi[1] = &tmp_q_powSpecInv[N_TCX10_MAX]; @@ -398,6 +397,9 @@ void stereo_mdct_core_enc_fx( } } stereo_coder_tcx_fx( hStereoMdct, sts, ms_mask, mdst_spectrum_fx, inv_spectrum_fx, inv_mdst_spectrum_fx, 0, q_spec ); + exp_inv_spectrum[0] = exp_inv_spectrum[1] = sub( Q31, q_spec ); + move16(); + move16(); } /*--------------------------------------------------------------* @@ -516,16 +518,15 @@ void stereo_mdct_core_enc_fx( /* Aligning the Q-factors */ { - q_powSpecMsInv[ch] = Q31; + Word16 q_temp = Q31; move16(); FOR( n = 0; n < nSubframes; n++ ) { FOR( i = 0; i < L_subframeTCX; i++ ) { - IF( powerSpecMsInv_fx[ch][n][i] != 0 ) + if ( powerSpecMsInv_fx[ch][n][i] != 0 ) { - q_powSpecMsInv[ch] = s_min( q_powSpecMsInv[ch], tmp_q_psi[n][i] ); - move16(); + q_temp = s_min( q_temp, tmp_q_psi[n][i] ); } } } @@ -533,10 +534,12 @@ void stereo_mdct_core_enc_fx( { FOR( i = 0; i < L_subframeTCX; i++ ) { - powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powSpecMsInv[ch] ) ); + powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_temp ) ); move32(); } } + exp_powSpecMsInv[ch] = sub( Q31, q_temp ); + move16(); } } @@ -605,7 +608,7 @@ void stereo_mdct_core_enc_fx( { IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS]; Word32 powerSpec_fx[CPE_CHANNELS][N_MAX], *p_powerSpec_fx[CPE_CHANNELS]; - Word16 q_powSpec[CPE_CHANNELS]; + Word16 exp_powSpec[CPE_CHANNELS]; p_powerSpec_fx[0] = powerSpec_fx[0]; p_powerSpec_fx[1] = powerSpec_fx[1]; { @@ -642,52 +645,21 @@ void stereo_mdct_core_enc_fx( } } set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); - q_powSpec[ch] = sub( 31, exp ); // exp: exp + exp_powSpec[ch] = exp; // exp: exp move16(); } } + hIGFEnc[0] = sts[0]->hIGFEnc; hIGFEnc[1] = sts[1]->hIGFEnc; - - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - q_spec = sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ); - Word16 q_comm = s_min( sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ), s_min( q_powSpec[ch], q_powSpecMsInv[ch] ) ); - Word16 n_sb = NB_DIV; - move16(); - if ( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) - { - n_sb = 1; - move16(); - } - length = idiv1616( sts[ch]->hTcxEnc->L_frameTCX, n_sb ); /* Q0 */ - IF( NE_16( q_spec, q_comm ) ) - { - Scale_sig32( sts[ch]->hTcxEnc->spectrum_fx[n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ - Scale_sig32( inv_spectrum_fx[ch][n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ - sts[ch]->hTcxEnc->spectrum_e[n] = sub( Q31, q_comm ); - move16(); - } - IF( NE_16( q_powSpec[ch], q_comm ) ) - { - Scale_sig32( &p_powerSpec_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpec[ch] ) ); /* q_spec */ - q_powSpec[ch] = q_comm; - move16(); - } - IF( NE_16( q_powSpecMsInv[ch], q_comm ) ) - { - Scale_sig32( powerSpecMsInv_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpecMsInv[ch] ) ); /* q_spec */ - q_powSpecMsInv[ch] = q_comm; - move16(); - } - } hIGFEnc[0]->spec_be_igf_e = p_orig_spectrum_e[0]; - move16(); hIGFEnc[1]->spec_be_igf_e = p_orig_spectrum_e[1]; move16(); - ProcessStereoIGF_fx( hStereoMdct, sts, ms_mask, - orig_spectrum_fx, sub( Q31, p_orig_spectrum_e[0] ), sub( Q31, p_orig_spectrum_e[1] ), - p_powerSpec_fx, powerSpecMsInv_fx, inv_spectrum_fx, n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 ); + move16(); + + ProcessStereoIGF_fx( hStereoMdct, sts, ms_mask, orig_spectrum_fx, sub( Q31, p_orig_spectrum_e[0] ), sub( Q31, p_orig_spectrum_e[1] ), + p_powerSpec_fx, exp_powSpec, powerSpecMsInv_fx, exp_powSpecMsInv, inv_spectrum_fx, exp_inv_spectrum, + n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 ); } ELSE { diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 46f83c094..2abe538e4 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -4029,8 +4029,11 @@ void ProcessStereoIGF_fx( Word16 q_pITFMDCTSpectrum_1, Word16 q_pITFMDCTSpectrum_2, Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ + Word16 exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */ Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i : inverse power spectrum */ + Word16 exp_pPowerSpectrumMsInv_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrumMsInv_fx */ Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */ + Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i/o: exp of inv_spectrum_fx */ const Word16 frameno, /* i : flag indicating index of current subfr. */ const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */ const Word32 element_brate, /* i : element bitrate */ @@ -4074,7 +4077,8 @@ void ProcessStereoIGF_fx( IGFSaveSpectrumForITF_ivas_fx( hIGFEnc[1], igfGridIdx, pITFMDCTSpectrum_fx[1][frameno], sub( Q31, q_pITFMDCTSpectrum_2 ) ); - IGFEncApplyStereo_fx( hStereoMdct, ms_mask, hIGFEnc, igfGridIdx, sts, pPowerSpectrum_fx, pPowerSpectrumMsInv_fx, inv_spectrum_fx, frameno, sp_aud_decision0, element_brate, mct_on ); + IGFEncApplyStereo_fx( hStereoMdct, ms_mask, hIGFEnc, igfGridIdx, sts, pPowerSpectrum_fx, exp_pPowerSpectrum_fx, pPowerSpectrumMsInv_fx, exp_pPowerSpectrumMsInv_fx, + inv_spectrum_fx, exp_inv_spectrum_fx, frameno, sp_aud_decision0, element_brate, mct_on ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { -- GitLab From e021386806c1746fb7bfb9b9ab0e8aaf02ca0ee8 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 11 Apr 2025 19:17:12 +0530 Subject: [PATCH 350/358] Precision improvements in SQ_gain_estimate_stereo_fx --- lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 65 ++++++++++++++---------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index a61b2b010..9a1198e20 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -836,52 +836,67 @@ void convertToMS_fx( /*! r: SQ gain */ static Word32 SQ_gain_estimate_stereo_fx( // e_res - Word32 xL_fx[], /* i : L vector to quantize Q31-e_xL*/ - Word16 e_xL, - Word32 xR_fx[], /* i : R vector to quantize Q31-e_xR*/ - Word16 e_xR, + const Word32 xL_fx[], /* i : L vector to quantize Q31-e_xL*/ + const Word16 e_xL, + const Word32 xR_fx[], /* i : R vector to quantize Q31-e_xR*/ + const Word16 e_xR, const Word16 nbitsSQ, /* i : number of bits targeted Q0*/ const Word16 lg, /* i : vector size (2048 max) Q0*/ Word16 *e_res ) { - Word16 i, q, iter, e_ener, e_tmp; + Word16 i, q, iter, e_ener, e_xL_2, e_xR_2, s; Word32 ener_fx, tmp_32, target_fx, fac_fx, offset_fx; - Word32 en_fx[N_MAX / 2]; // Q(26) + Word32 en_fx[N_MAX / 2]; // Q25 Word16 lg2, lg_4, lg2_4; + Word64 W_tmp, _0_01; lg_4 = shr( lg, 2 ); /* Q0 */ lg2_4 = shl( lg_4, 1 ); /* Q0 */ lg2 = shl( lg2_4, 2 ); /* Q0 */ i = 0; move16(); + e_xL_2 = shl( e_xL, 1 ); + e_xR_2 = shl( e_xR, 1 ); + _0_01 = W_shr( 21474836 /* 0.01 in Q31 */, sub( e_xL_2, 32 ) ); // 0.01 in 2*(Q of specL/R) + 1 - set32_fx( en_fx, 21474836 /* 0.01 in Q31 */, idiv1616( N_MAX, 2 ) ); + set32_fx( en_fx, 335544 /* 0.01 in Q25 */, ( N_MAX / 2 ) ); /* energy of quadruples with 9dB offset */ /* ignore that we may take no all lines into account, max. 3 lines at the upper end of the spectrum can be missed (if lg is not a multiple of 4, happens also in SQGain()*/ FOR( q = 0; q < lg_4; q++ ) { - ener_fx = BASOP_Util_Add_Mant32Exp( 21474836 /*0.01 in Q15*/, 0, Mpy_32_32( xL_fx[i], xL_fx[i] ), e_xL * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xL_fx[i + 1], xL_fx[i + 1] ), e_xL * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xL_fx[i + 2], xL_fx[i + 2] ), e_xL * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xL_fx[i + 3], xL_fx[i + 3] ), e_xL * 2, &e_ener ); /* Q31-e_ener */ - en_fx[q] = BASOP_Util_Log2( ener_fx ); /* saves a MAC */ + W_tmp = W_mac_32_32( _0_01, xL_fx[i], xL_fx[i] ); // 2 * e_xL + W_tmp = W_mac_32_32( W_tmp, xL_fx[i + 1], xL_fx[i + 1] ); // 2 * e_xL + W_tmp = W_mac_32_32( W_tmp, xL_fx[i + 2], xL_fx[i + 2] ); // 2 * e_xL + W_tmp = W_mac_32_32( W_tmp, xL_fx[i + 3], xL_fx[i + 3] ); // 2 * e_xL + + s = W_norm( W_tmp ); + ener_fx = W_extract_h( W_shl( W_tmp, s ) ); + e_ener = sub( e_xL_2, s ); + + en_fx[q] = BASOP_Util_Log2( ener_fx ); /* saves a MAC */ move32(); - en_fx[q] = Mpy_32_16_1( L_add( e_ener * ONE_IN_Q25, en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25) + en_fx[q] = Mpy_32_16_1( L_add( L_shl( e_ener, Q25 ), en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25) move32(); i = add( i, 4 ); } i = 0; + move16(); FOR( ; q < lg2_4; q++ ) { - ener_fx = BASOP_Util_Add_Mant32Exp( 21474836 /*0.01 Q15*/, 0, Mpy_32_32( xR_fx[i], xR_fx[i] ), e_xR * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xR_fx[i + 1], xR_fx[i + 1] ), e_xR * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xR_fx[i + 2], xR_fx[i + 2] ), e_xR * 2, &e_ener ); /* Q31-e_ener */ - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, Mpy_32_32( xR_fx[i + 3], xR_fx[i + 3] ), e_xR * 2, &e_ener ); /* Q31-e_ener */ - en_fx[q] = BASOP_Util_Log2( ener_fx ); /* saves a MAC */ + W_tmp = W_mac_32_32( _0_01, xR_fx[i], xR_fx[i] ); // 2 * e_xR + W_tmp = W_mac_32_32( W_tmp, xR_fx[i + 1], xR_fx[i + 1] ); // 2 * e_xR + W_tmp = W_mac_32_32( W_tmp, xR_fx[i + 2], xR_fx[i + 2] ); // 2 * e_xR + W_tmp = W_mac_32_32( W_tmp, xR_fx[i + 3], xR_fx[i + 3] ); // 2 * e_xR + + s = W_norm( W_tmp ); + ener_fx = W_extract_h( W_shl( W_tmp, s ) ); + e_ener = sub( e_xR_2, s ); + + en_fx[q] = BASOP_Util_Log2( ener_fx ); /* saves a MAC */ move32(); - en_fx[q] = Mpy_32_16_1( L_add( e_ener * ONE_IN_Q25, en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25) + en_fx[q] = Mpy_32_16_1( L_add( L_shl( e_ener, Q25 ), en_fx[q] ), 9864 /* log10(2) in Q15 */ ); // Q(25) move32(); i = add( i, 4 ); } @@ -898,24 +913,20 @@ static Word32 SQ_gain_estimate_stereo_fx( // e_res { fac_fx = L_shr( fac_fx, 1 ); /* Q25 */ offset_fx = L_sub( offset_fx, fac_fx ); /* Q25 */ - ener_fx = 0; - move32(); - e_ener = 0; - move16(); + W_tmp = 0; + move64(); FOR( i = 0; i < lg2_4; i++ ) { tmp_32 = L_sub( en_fx[i], offset_fx ); /* Q25 */ - e_tmp = 6; - move16(); /* avoid SV with 1 bin of amp < 0.5f */ IF( GT_32( tmp_32, 10066329 /*0.3 Q25*/ ) ) { - ener_fx = BASOP_Util_Add_Mant32Exp( ener_fx, e_ener, tmp_32, e_tmp, &e_ener ); /* Q31-e_ener */ + W_tmp = W_add( W_tmp, W_deposit32_l( tmp_32 ) ); /* Q25 */ /* if ener is above target -> break and increase offset */ - IF( L_shl_sat( ener_fx, sub( e_ener, Q13 ) ) > target_fx ) + IF( GT_64( W_tmp, W_shl( W_deposit32_l( target_fx ), 7 ) ) ) { offset_fx = L_add( offset_fx, fac_fx ); /* Q25 */ BREAK; -- GitLab From c946016412f3d3e53707309e5635f10c5a714d50 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 13 Apr 2025 21:12:19 +0200 Subject: [PATCH 351/358] replace BASOP_Util_Divide3232_Scale_cadence() by BASOP_Util_Divide3232_Scale_newton() --- lib_dec/ivas_dirac_dec_fx.c | 2 +- lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 12 ++++++------ lib_dec/ivas_lfe_plc_fx.c | 4 ++-- lib_dec/ivas_mct_dec_fx.c | 6 +++--- lib_dec/ivas_stereo_cng_dec.c | 6 +++--- lib_dec/ivas_stereo_dft_dec.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_switching_dec_fx.c | 2 +- lib_dec/ivas_svd_dec_fx.c | 18 +++++++++--------- lib_dec/jbm_jb4sb.c | 2 +- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index bbd4641b1..064185e47 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2614,7 +2614,7 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner_fx ); // Q29 move32(); - surCohRatio_fx[i] = BASOP_Util_Divide3232_Scale_cadence( surCohEner_fx, ( L_add( EPSILLON_FX, L_add( dirEne_fx, surCohEner_fx ) ) ), &temp_q ); + surCohRatio_fx[i] = BASOP_Util_Divide3232_Scale_newton( surCohEner_fx, ( L_add( EPSILLON_FX, L_add( dirEne_fx, surCohEner_fx ) ) ), &temp_q ); move32(); surCohRatio_fx[i] = L_shl( surCohRatio_fx[i], sub( temp_q, 16 ) ); // Q15 move32(); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 114083fad..6d367538d 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -1751,7 +1751,7 @@ Word16 computeMixingMatricesISM_fx( IF( svd_s_buffer_fx[i] ) { Word32 reg_fac; - reg_fac = BASOP_Util_Divide3232_Scale_cadence( MAX_32, svd_s_buffer_fx[i], &temp_e[i] ); + reg_fac = BASOP_Util_Divide3232_Scale_newton( MAX_32, svd_s_buffer_fx[i], &temp_e[i] ); Kx_reg_inv_fx[i] = reg_fac; move32(); temp_e[i] = sub( temp_e[i], svd_s_buffer_fx_e ); @@ -1760,7 +1760,7 @@ Word16 computeMixingMatricesISM_fx( ELSE { Word32 reg_fac; - reg_fac = BASOP_Util_Divide3232_Scale_cadence( MAX_32, EPSILON_FX_M, &temp_e[i] ); + reg_fac = BASOP_Util_Divide3232_Scale_newton( MAX_32, EPSILON_FX_M, &temp_e[i] ); Kx_reg_inv_fx[i] = reg_fac; move32(); temp_e[i] = sub( temp_e[i], EPSILON_FX_E ); @@ -1837,7 +1837,7 @@ Word16 computeMixingMatricesISM_fx( { IF( Cy_hat_diag_fx[i] ) { - G_hat_fx[i] = BASOP_Util_Divide3232_Scale_cadence( Cy_diag_fx[i], Cy_hat_diag_fx[i], &temp_e[i] ); + G_hat_fx[i] = BASOP_Util_Divide3232_Scale_newton( Cy_diag_fx[i], Cy_hat_diag_fx[i], &temp_e[i] ); move32(); temp_e[i] = add( temp_e[i], sub( Cy_diag_e, Cy_hat_diag_e ) ); move16(); @@ -1846,7 +1846,7 @@ Word16 computeMixingMatricesISM_fx( } ELSE { - G_hat_fx[i] = BASOP_Util_Divide3232_Scale_cadence( Cy_diag_fx[i], EPSILON_FX_M, &temp_e[i] ); + G_hat_fx[i] = BASOP_Util_Divide3232_Scale_newton( Cy_diag_fx[i], EPSILON_FX_M, &temp_e[i] ); move32(); temp_e[i] = add( temp_e[i], sub( Cy_diag_e, EPSILON_FX_E ) ); move16(); @@ -1949,7 +1949,7 @@ Word16 computeMixingMatricesISM_fx( { IF( Cy_tilde_p_fx[i + ( i * lengthCy )] ) { - adj_fx[i] = BASOP_Util_Divide3232_Scale_cadence( Cy_diag_fx[i], Cy_tilde_p_fx[i + ( i * lengthCy )], &temp_e[i] ); + adj_fx[i] = BASOP_Util_Divide3232_Scale_newton( Cy_diag_fx[i], Cy_tilde_p_fx[i + ( i * lengthCy )], &temp_e[i] ); move32(); temp_e[i] = add( temp_e[i], sub( Cy_diag_e, mat_mult_buffer2_e ) ); move16(); @@ -1958,7 +1958,7 @@ Word16 computeMixingMatricesISM_fx( } ELSE { - adj_fx[i] = BASOP_Util_Divide3232_Scale_cadence( Cy_diag_fx[i], EPSILON_FX_M, &temp_e[i] ); + adj_fx[i] = BASOP_Util_Divide3232_Scale_newton( Cy_diag_fx[i], EPSILON_FX_M, &temp_e[i] ); move32(); temp_e[i] = add( temp_e[i], sub( Cy_diag_e, EPSILON_FX_E ) ); move16(); diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index d98603d2a..a480ce7be 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -225,7 +225,7 @@ static Word16 lfeplc_lev_dur_fx( a_out_q_fx[0] = 30; move16(); - rc_fx[0] = BASOP_Util_Divide3232_Scale_cadence( -r_fx[1], r_fx[0], &temp_q2 ); + rc_fx[0] = BASOP_Util_Divide3232_Scale_newton( -r_fx[1], r_fx[0], &temp_q2 ); move32(); rc_q_fx[0] = add( sub( r_q_fx[1], r_q_fx[0] ), sub( 31, temp_q2 ) ); move16(); @@ -387,7 +387,7 @@ static Word16 lfeplc_lev_dur_fx( s = W_extract_h( W_shl( s_fx, exp1 ) ); s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( L_negate( s ), err_fx, &temp_q2 ), 1 ); + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_newton( L_negate( s ), err_fx, &temp_q2 ), 1 ); move32(); rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); move16(); diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 7e1597749..32403b11a 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -1330,7 +1330,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( new_brate_SCE = 0; move32(); Word16 temp_e; - Word32 L_temp = BASOP_Util_Divide3232_Scale_cadence( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &temp_e ); + Word32 L_temp = BASOP_Util_Divide3232_Scale_newton( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &temp_e ); L_temp = L_shr( L_temp, sub( 31, temp_e ) ); new_brate_CPE = L_shl( L_temp, 1 ) /*CPE_CHANNELS*/; } @@ -1339,7 +1339,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( new_brate_SCE = 0; move32(); Word16 temp_e; - Word32 L_temp = BASOP_Util_Divide3232_Scale_cadence( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &temp_e ); + Word32 L_temp = BASOP_Util_Divide3232_Scale_newton( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &temp_e ); L_temp = L_shr( L_temp, sub( 31, temp_e ) ); new_brate_CPE = L_shl( L_temp, 1 ) /*CPE_CHANNELS*/; } @@ -1348,7 +1348,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/ move32(); Word16 temp_e; - Word32 L_temp = BASOP_Util_Divide3232_Scale_cadence( ivas_total_brate, st_ivas->nchan_transport, &temp_e ); + Word32 L_temp = BASOP_Util_Divide3232_Scale_newton( ivas_total_brate, st_ivas->nchan_transport, &temp_e ); L_temp = L_shr( L_temp, sub( 31, temp_e ) ); new_brate_CPE = L_shl( L_temp, 1 ) /*CPE_CHANNELS*/; } diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 478f96dc1..6b8a8f949 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -316,7 +316,7 @@ static void stereo_dft_generate_comfort_noise_fx( // lp_ener_fx will be in Q6 at this point. // So applying appropriate left shift on the denominator. - factor = L_shr( BASOP_Util_Divide3232_Scale_cadence( st->lp_ener_fx, L_shl( st->L_frame, Q6 ), &q_div ), 1 ); /* fixed factor in the loop below */ /* q_div */ + factor = L_shr( BASOP_Util_Divide3232_Scale_newton( st->lp_ener_fx, L_shl( st->L_frame, Q6 ), &q_div ), 1 ); /* fixed factor in the loop below */ /* q_div */ factor = Sqrt32( factor, &q_div ); q_div = add( q_div, 1 ); @@ -399,7 +399,7 @@ static void stereo_dft_generate_comfort_noise_fx( assert( ftmp > 0 ); q_div = 0; move16(); - ftmp = BASOP_Util_Divide3232_Scale_cadence( L_shl( 1, q_tmp ), ftmp, &q_div ); /* q_div */ + ftmp = BASOP_Util_Divide3232_Scale_newton( L_shl( 1, q_tmp ), ftmp, &q_div ); /* q_div */ /* in float: both a = "div"=(1/(x^2+y^2) and sqrt(a) is used and summed up in the same loop. @@ -672,7 +672,7 @@ static void stereo_dft_generate_comfort_noise_fx( move16(); FOR( k = 0; k < ( hFdCngCom->nFFTpart - 2 ); k++ ) { - factor = BASOP_Util_Divide3232_Scale_cadence( L_add( hFdCngCom->sidNoiseEstLp[k], DELTA_FX ), L_add( st->hFdCngDec->partNoiseShape[k], DELTA_FX ), &q_div ); /* q_div */ + factor = BASOP_Util_Divide3232_Scale_newton( L_add( hFdCngCom->sidNoiseEstLp[k], DELTA_FX ), L_add( st->hFdCngDec->partNoiseShape[k], DELTA_FX ), &q_div ); /* q_div */ q_div = add( q_div, sub( hFdCngCom->sidNoiseEstExp, st->hFdCngDec->partNoiseShape_exp ) ); IF( q_div < 0 ) { diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index f0fd1978b..92ae9159c 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -281,7 +281,7 @@ void stereo_dft_dec_analyze_fx( move16(); NFFT = NS2SA_FX2( inputFs, STEREO_DFT32MS_N_NS ); Word16 qfac_fx; - fac_fx = BASOP_Util_Divide3232_Scale_cadence( hStereoDft->NFFT, NFFT, &qfac_fx ); /* qfac_fx */ + fac_fx = BASOP_Util_Divide3232_Scale_newton( hStereoDft->NFFT, NFFT, &qfac_fx ); /* qfac_fx */ qfac_fx = sub( 31, qfac_fx ); ovl2 = NS2SA_FX2( inputFs, STEREO_DFT32MS_OVL2_NS ); move16(); diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 5248839f5..8842a6792 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -433,7 +433,7 @@ void stereo_decoder_tcx_fx( IF( !mct_on ) { - tmp_32 = BASOP_Util_Divide3232_Scale_cadence( SMDCT_ILD_RANGE << 16, L_deposit_h( hStereoMdct->global_ild[k] ), &tmp_e ); + tmp_32 = BASOP_Util_Divide3232_Scale_newton( SMDCT_ILD_RANGE << 16, L_deposit_h( hStereoMdct->global_ild[k] ), &tmp_e ); tmp_32 = L_shr( tmp_32, sub( 5, tmp_e ) ); /* nrgRatio = nrg[1]/nrg[0] */ // Q26 nrgRatio = L_sub( tmp_32, ONE_IN_Q26 ); // Q26 @@ -488,7 +488,7 @@ void stereo_decoder_tcx_fx( } ELSE IF( ( LT_32( nrgRatio, ONE_IN_Q26 ) ) && ( LT_16( k, tmp2 ) ) ) { - inv_nrgRatio = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q26, nrgRatio, &tmp_e ); + inv_nrgRatio = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q26, nrgRatio, &tmp_e ); 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 */ diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 1a6ea257b..bcf714352 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -2361,7 +2361,7 @@ static Word32 ncross_corr_self_fx( Word16 q_cc = W_norm( c_c_fx ); Word32 num = W_extract_h( W_shl( c_c_fx, q_cc ) ); // Q(23 + q_cc - 32) -> e(40 - q_cc) Word16 quo_e; - num = BASOP_Util_Divide3232_Scale_cadence( num, energy, &quo_e ); + num = BASOP_Util_Divide3232_Scale_newton( num, energy, &quo_e ); quo_e = add( sub( sub( 40, q_cc ), q_prod ), quo_e ); c_c_fx_return = L_shl_sat( num, quo_e ); // Q31 } diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 8a9224ffa..014597972 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -628,7 +628,7 @@ static void ApplyQRTransform_fx( L_temp1 = BASOP_Util_Add_Mant32Exp( r, r_e, r, r_e, &L_temp1_e ); /* exp(L_temp1_e) */ L_temp1 = maxWithSign_fx( Mpy_32_32( L_temp1, x_split ) ); /* exp(L_temp1_e + x_split_e) */ L_temp1_e = add( L_temp1_e, x_split_e ); - d = BASOP_Util_Divide3232_Scale_cadence( d, L_temp1, &temp_exp ); /* temp_exp + d_e - L_temp1_e */ + d = BASOP_Util_Divide3232_Scale_newton( d, L_temp1, &temp_exp ); /* temp_exp + d_e - L_temp1_e */ d_e = add( temp_exp, sub( d_e, L_temp1_e ) ); g = GivensRotation_fx( MAX_32, 0, d, d_e, &g_e ); @@ -646,7 +646,7 @@ static void ApplyQRTransform_fx( L_temp1_e = g_e; move16(); L_temp2 = maxWithSign_fx( BASOP_Util_Add_Mant32Exp( d, d_e, L_temp1, L_temp1_e, &L_temp2_e ) ); /* exp(L_temp2_e) */ - mu = BASOP_Util_Divide3232_Scale_cadence( x_split, L_temp2, &mu_e ); /* exp(mu_e + (x-plit_e - L_temp2_e)) */ + mu = BASOP_Util_Divide3232_Scale_newton( x_split, L_temp2, &mu_e ); /* exp(mu_e + (x-plit_e - L_temp2_e)) */ mu_e = add( mu_e, sub( x_split_e, L_temp2_e ) ); mu = BASOP_Util_Add_Mant32Exp( mu, mu_e, L_negate( r ), r_e, &mu_e ); /* exp(mu_e) */ @@ -654,7 +654,7 @@ static void ApplyQRTransform_fx( L_temp1 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, x_kk, x_kk_e, &L_temp1_e ); /* exp(L_temp1_e) */ L_temp2 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, L_negate( x_kk ), x_kk_e, &L_temp2_e ); /* exp(L_temp2_e) */ d = BASOP_Util_Add_Mant32Exp( Mpy_32_32( L_temp1, L_temp2 ), add( L_temp1_e, L_temp2_e ), Mpy_32_32( r, mu ), add( r_e, mu_e ), &d_e ); /* exp(d_e) */ - d = BASOP_Util_Divide3232_Scale_cadence( d, maxWithSign_fx( x_ii ), &temp_exp ); /* exp(temp_exp + (d_e - x_ii_e) */ + d = BASOP_Util_Divide3232_Scale_newton( d, maxWithSign_fx( x_ii ), &temp_exp ); /* exp(temp_exp + (d_e - x_ii_e) */ d_e = add( temp_exp, sub( d_e, x_ii_e ) ); /*QR transformation*/ @@ -917,7 +917,7 @@ static void biDiagonalReductionLeft_fx( { Word16 invVal_e; Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); norm_x = 0; move32(); norm_x_e = 0; @@ -954,7 +954,7 @@ static void biDiagonalReductionLeft_fx( singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ move32(); - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { @@ -1046,7 +1046,7 @@ static void biDiagonalReductionRight_fx( Word16 invVal_e, temp_e; Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */ { temp_e = norm_l( singularVectors[currChannel][jCh] ); @@ -1082,7 +1082,7 @@ static void biDiagonalReductionRight_fx( singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */ move32(); - invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); + invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { @@ -1162,10 +1162,10 @@ static void singularVectorsAccumulationLeft_fx( IF( t_ii ) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/ { - t_ii = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( t_ii ), &temp_exp ); + t_ii = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( t_ii ), &temp_exp ); t_ii_e = sub( temp_exp, t_ii_e ); Word16 tempe; - Word32 temp = BASOP_Util_Divide3232_Scale_cadence( t_ii, maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &tempe ); + Word32 temp = BASOP_Util_Divide3232_Scale_newton( t_ii, maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &tempe ); tempe = add( tempe, sub( t_ii_e, singularVectors_Left_e[nCh][nCh] ) ); // fprintf( fp, "%e\n", me2f( t_ii, t_ii_e ) ); FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 002b4bc10..d1f782b55 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -911,7 +911,7 @@ static void JB4_adaptActivePlayout( ELSE { Word16 exp; - Word32 temp = BASOP_Util_Divide3232_Scale_cadence( W_extract_l( W_sub( dropRateMax, dropRateMin ) ), W_extract_l( dropGapMax ), &exp ); + Word32 temp = BASOP_Util_Divide3232_Scale_newton( W_extract_l( W_sub( dropRateMax, dropRateMin ) ), W_extract_l( dropGapMax ), &exp ); /* limit gap to [gapMin,gapMax] and calculate current drop rate from gap */ Word64 temp2 = W_mult0_32_32( W_extract_l( JB4_MIN( gap, dropGapMax ) ), temp ); Word64 temp3 = W_shr( temp2, sub( 31, exp ) ); -- GitLab From 87cd131a980ed945d2cf71621fc9bfa7ab6a2029 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 13 Apr 2025 21:15:21 +0200 Subject: [PATCH 352/358] fix formatting --- lib_dec/ivas_svd_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 014597972..4b0522884 100644 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -646,7 +646,7 @@ static void ApplyQRTransform_fx( L_temp1_e = g_e; move16(); L_temp2 = maxWithSign_fx( BASOP_Util_Add_Mant32Exp( d, d_e, L_temp1, L_temp1_e, &L_temp2_e ) ); /* exp(L_temp2_e) */ - mu = BASOP_Util_Divide3232_Scale_newton( x_split, L_temp2, &mu_e ); /* exp(mu_e + (x-plit_e - L_temp2_e)) */ + mu = BASOP_Util_Divide3232_Scale_newton( x_split, L_temp2, &mu_e ); /* exp(mu_e + (x-plit_e - L_temp2_e)) */ mu_e = add( mu_e, sub( x_split_e, L_temp2_e ) ); mu = BASOP_Util_Add_Mant32Exp( mu, mu_e, L_negate( r ), r_e, &mu_e ); /* exp(mu_e) */ @@ -654,7 +654,7 @@ static void ApplyQRTransform_fx( L_temp1 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, x_kk, x_kk_e, &L_temp1_e ); /* exp(L_temp1_e) */ L_temp2 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, L_negate( x_kk ), x_kk_e, &L_temp2_e ); /* exp(L_temp2_e) */ d = BASOP_Util_Add_Mant32Exp( Mpy_32_32( L_temp1, L_temp2 ), add( L_temp1_e, L_temp2_e ), Mpy_32_32( r, mu ), add( r_e, mu_e ), &d_e ); /* exp(d_e) */ - d = BASOP_Util_Divide3232_Scale_newton( d, maxWithSign_fx( x_ii ), &temp_exp ); /* exp(temp_exp + (d_e - x_ii_e) */ + d = BASOP_Util_Divide3232_Scale_newton( d, maxWithSign_fx( x_ii ), &temp_exp ); /* exp(temp_exp + (d_e - x_ii_e) */ d_e = add( temp_exp, sub( d_e, x_ii_e ) ); /*QR transformation*/ -- GitLab From 94b8dca70e8b364f4dc6e75852111d1876ff84f3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 14 Apr 2025 11:53:43 +0200 Subject: [PATCH 353/358] supress output from all make cmds in non-biuld tests if build test is fine, we don't need this info here and all the printouts from make reall clutter the job log --- .gitlab-ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3fa4217b..412f11044 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -171,7 +171,7 @@ stages: - git pull origin $FLOAT_REF_BRANCH - *activate-debug-mode-info-if-set - make clean - - make -j + - make -j >> /dev/null - mv ./IVAS_cod ./$REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_dec ./$REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_rend ./IVAS_rend_ref @@ -187,7 +187,7 @@ stages: - git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - *activate-debug-mode-info-if-set - make clean - - make -j + - make -j >> /dev/null - mv ./IVAS_cod ./$MERGE_TARGET_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_dec ./$MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_rend ./IVAS_rend_merge_target @@ -202,7 +202,7 @@ stages: ### build dut binaries - *activate-debug-mode-info-if-set - make clean - - make -j + - make -j >> /dev/null .build-and-create-float-ref-outputs: &build-and-create-float-ref-outputs - *build-float-ref-and-dut-binaries @@ -509,7 +509,7 @@ stages: - *build-float-ref-binaries - *build-merge-target-binaries - make clean - - make -j + - make -j >> /dev/null - *check-up-to-date-in-comparison-jobs - exit_code_target=0 @@ -660,7 +660,7 @@ stages: - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - make clean - - make -j + - make -j >> /dev/null # need to restore cache again - *overwrite-pytest-cache-with-artifact - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN $comp_args --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true @@ -759,7 +759,7 @@ stages: - make_args="$make_args IGNORELIST=1" - fi - make clean - - make -j $make_args + - make -j $make_args >> /dev/null - testcase_timeout_arg="--testcase_timeout $TESTCASE_TIMEOUT_LTV_SANITIZERS" # disable per-testcase timeout for msan to evaluate what is going on that it takes so long - if [[ $CLANG_NUM = 1 ]]; then @@ -1536,7 +1536,7 @@ coverage-test-on-main-scheduled: - *copy-ltv-files-to-testv-dir - *build-float-ref-binaries # Build DuT binaries with GCOV - - make clean + - make clean >> /dev/null - make GCOV=1 -j - cp IVAS_rend IVAS_rend_ref # Copy to ensure instrumented renderer is run in the first pytest call @@ -1594,7 +1594,7 @@ be-2-evs-26444: - *print-common-info - *update-scripts-repo - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h - - make -j + - make -j >> /dev/null # copy over to never change the testvector dir - cp -r $EVS_BE_TEST_DIR_BASOP ./evs_be_test @@ -1658,7 +1658,7 @@ voip-be-on-merge-request: script: - *print-common-info - make clean - - make -j + - make -j >> /dev/null - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py -- GitLab From 279ddadeaa7cb7c303ee1330e0027430dcba809d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 14 Apr 2025 15:56:57 +0200 Subject: [PATCH 354/358] make the commit number files textfiles so one can view them in gitlab ui --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 412f11044..d3f7ba999 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,9 +48,9 @@ variables: FAILED_TESTCASES_LIST: "failed-testcases.txt" ERRORS_TESTCASES_LIST: "errors-testcases.txt" PYTEST_CACHE_ARTIFACT: "pytest_cache.zip" - FLOAT_REF_COMMIT_FILE: "float-ref-git-sha" - CUT_COMMIT_FILE: "CuT-git-sha" - MERGE_TARGET_COMMIT_FILE: "merge-target-git-sha" + FLOAT_REF_COMMIT_FILE: "float-ref-git-sha.txt" + CUT_COMMIT_FILE: "CuT-git-sha.txt" + MERGE_TARGET_COMMIT_FILE: "merge-target-git-sha.txt" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' -- GitLab From 2e632e49a5815a567fab9a62f11264cfabec8ab4 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 15 Apr 2025 09:13:12 +0200 Subject: [PATCH 355/358] fix conflicts --- lib_dec/ivas_binRenderer_internal_fx.c | 164 +++++----------- lib_dec/ivas_mc_paramupmix_dec_fx.c | 4 - lib_enc/init_enc_fx.c | 1 - lib_isar/isar_splitRendererPost.c | 12 +- lib_isar/lib_isar_post_rend.c | 8 +- lib_isar/lib_isar_pre_rend.c | 12 +- .../ivas_dirac_dec_binaural_functions_fx.c | 14 +- lib_rend/ivas_stat_rend.h | 1 + lib_rend/lib_rend.c | 185 +++++++++--------- 9 files changed, 169 insertions(+), 232 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index ff40d2f70..0709c6b75 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -75,15 +75,11 @@ static void ivas_binRenderer_filterModule_fx( const Word32 *filterTapsLeftRealPtr_fx, *filterTapsLeftImagPtr_fx, *filterTapsRightRealPtr_fx, *filterTapsRightImagPtr_fx; Word16 shift_q; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef OPT_BASOP_ADD_v1 Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx]; move16(); -#endif /* OPT_BASOP_ADD_v1 */ #else -#ifdef OPT_BASOP_ADD_v1 Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStatesLeft; move16(); -#endif /* OPT_BASOP_ADD_v1 */ #endif FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) @@ -93,15 +89,9 @@ static void ivas_binRenderer_filterModule_fx( #ifdef SPLIT_REND_WITH_HEAD_ROT filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] ); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates = (Word16 *) &( hBinRenderer->hBinRenConvModule->Q_filterStatesLeft[pos_idx][bandIdx][chIdx][0] ); -#endif #else filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] ); filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] ); -#ifndef OPT_BASOP_ADD_v1 - Q_filterStates = (Word16 *) &( hBinRenderer->hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx][0] ); -#endif /* OPT_BASOP_ADD_v1 */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29 @@ -146,7 +136,6 @@ static void ivas_binRenderer_filterModule_fx( outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); // Q_curr outRealRight_fx = W_shr( outRealRight_fx, shift_q ); // Q_curr outImagRight_fx = W_shr( outImagRight_fx, shift_q ); // Q_curr -#ifdef OPT_BASOP_ADD_v1 #ifdef SPLIT_REND_WITH_HEAD_ROT hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx] = Q_curr; #else @@ -353,17 +342,10 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifdef OPT_BASOP_ADD_v1 IF( ( hBinRenConvModule->Q_filterStates = (Word16 *) malloc( num_poses * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#else - IF( ( hBinRenConvModule->Q_filterStatesLeft = (Word16 ****) malloc( num_poses * sizeof( Word16 *** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { @@ -377,12 +359,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[pos_idx] = (Word16 ***) malloc( hBinRenderer->conv_band * sizeof( Word16 ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -396,12 +372,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[pos_idx][bandIdx] = (Word16 **) malloc( hBinRenderer->nInChannels * sizeof( Word16 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { @@ -414,13 +384,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - -#ifndef OPT_BASOP_ADD_v1 - IF( ( hBinRenConvModule->Q_filterStatesLeft[pos_idx][bandIdx][chIdx] = (Word16 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#endif /* OPT_BASOP_ADD_v1 */ } } } @@ -509,9 +472,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); -#endif /* OPT_BASOP_ADD_v1 */ #endif /* !SPLIT_REND_WITH_HEAD_ROT */ IF( isLoudspeaker ) { @@ -529,9 +489,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); hBinRenConvModule->Q_filterStatesLeft = 31; move16(); -#else /* OPT_BASOP_ADD_v1 */ - set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); -#endif /* OPT_BASOP_ADD_v1 */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ IF( isLoudspeaker ) { @@ -580,10 +537,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); -#endif for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) @@ -591,9 +546,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); -#ifndef OPT_BASOP_ADD_v1 - set16_fx( hBinRenConvModule->Q_filterStatesLeft[pos_idx][bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); -#endif /* OPT_BASOP_ADD_v1 */ } } } @@ -602,10 +554,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( { for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { -#ifdef OPT_BASOP_ADD_v1 hBinRenConvModule->Q_filterStates[pos_idx] = 31; move16(); -#endif for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) @@ -613,9 +563,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( /* set the memories to zero */ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); -#ifndef OPT_BASOP_ADD_v1 - set16_fx( hBinRenConvModule->Q_filterStatesLeft[pos_idx][bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); -#endif /* OPT_BASOP_ADD_v1 */ } } } @@ -1391,10 +1338,10 @@ ivas_error ivas_binRenderer_open_fx( return error; } #else - IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, IVAS_AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv ) ), IVAS_ERR_OK ) ) - { - return error; - } + IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, IVAS_AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv ) ), IVAS_ERR_OK ) ) + { + return error; + } #endif ivas_output_init( &out_setup, IVAS_AUDIO_CONFIG_7_1_4 ); @@ -1419,10 +1366,10 @@ ivas_error ivas_binRenderer_open_fx( return error; } #else - IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv ) ), IVAS_ERR_OK ) ) - { - return error; - } + IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv ) ), IVAS_ERR_OK ) ) + { + return error; + } #endif IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) @@ -1486,14 +1433,14 @@ ivas_error ivas_binRenderer_open_fx( } } #else - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + FOR( k = 0; k < hBinRenderer->nInChannels; k++ ) { - FOR( k = 0; k < hBinRenderer->nInChannels; k++ ) - { - hBinRenderer->hReverb->dmxmtx_fx[chIdx][k] = dmxmtx_table_fx[chIdx][k]; - move32(); - } + hBinRenderer->hReverb->dmxmtx_fx[chIdx][k] = dmxmtx_table_fx[chIdx][k]; + move32(); } + } #endif } ELSE @@ -1506,7 +1453,7 @@ ivas_error ivas_binRenderer_open_fx( #ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM IF( hBinRenderer->hReverb != NULL && NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) #else - IF( hBinRenderer->hReverb != NULL ) + IF( hBinRenderer->hReverb != NULL ) #endif { test(); @@ -1548,7 +1495,7 @@ static void ivas_binRenderer_convModuleClose_fx( BINAURAL_RENDERER_HANDLE *hBinRenderer, /* i/o: fastconv binaural renderer handle */ const Word16 num_poses /* i : number of poses */ #else - BINAURAL_RENDERER_HANDLE * hBinRenderer /* i/o: fastconv binaural renderer handle */ + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ #endif ) { @@ -1605,11 +1552,6 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[posIdx][bandIdx][chIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[posIdx][bandIdx][chIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - - free( hBinRenConvModule->Q_filterStatesLeft[posIdx][bandIdx][chIdx] ); - hBinRenConvModule->Q_filterStatesLeft[posIdx][bandIdx][chIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx[posIdx][bandIdx] ); @@ -1617,41 +1559,31 @@ static void ivas_binRenderer_convModuleClose_fx( free( hBinRenConvModule->filterStatesLeftImag_fx[posIdx][bandIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[posIdx][bandIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - - free( hBinRenConvModule->Q_filterStatesLeft[posIdx][bandIdx] ); - hBinRenConvModule->Q_filterStatesLeft[posIdx][bandIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } free( hBinRenConvModule->filterStatesLeftReal_fx[posIdx] ); hBinRenConvModule->filterStatesLeftReal_fx[posIdx] = NULL; free( hBinRenConvModule->filterStatesLeftImag_fx[posIdx] ); hBinRenConvModule->filterStatesLeftImag_fx[posIdx] = NULL; -#ifndef OPT_BASOP_ADD_v1 - - free( hBinRenConvModule->Q_filterStatesLeft[posIdx] ); - hBinRenConvModule->Q_filterStatesLeft[posIdx] = NULL; -#endif /* OPT_BASOP_ADD_v1 */ } #else - FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) + FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) + { + FOR( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) { - FOR( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) - { - free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx] = NULL; + free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx] = NULL; - free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; - } + free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx] = NULL; + } - free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); - hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] = NULL; + free( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] ); + hBinRenConvModule->filterStatesLeftReal_fx[bandIdx] = NULL; - free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); - hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; - } + free( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] ); + hBinRenConvModule->filterStatesLeftImag_fx[bandIdx] = NULL; + } #endif free( hBinRenConvModule->filterStatesLeftReal_fx ); hBinRenConvModule->filterStatesLeftReal_fx = NULL; @@ -1686,7 +1618,7 @@ void ivas_binRenderer_close_fx( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_binRenderer_convModuleClose_fx( hBinRenderer, ( *hBinRenderer )->numPoses ); #else - ivas_binRenderer_convModuleClose_fx( hBinRenderer ); + ivas_binRenderer_convModuleClose_fx( hBinRenderer ); #endif } @@ -1867,8 +1799,8 @@ void ivas_binRenderer_fx( Word32 Cldfb_RealBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ Word32 Cldfb_ImagBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ #else - Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals Q_in*/ - Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals Q_in*/ + Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals Q_in*/ + Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals Q_in*/ #endif Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals Q_in*/ Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals Q_in*/ @@ -1925,16 +1857,16 @@ void ivas_binRenderer_fx( } } #else - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + FOR( k = 0; k < numTimeSlots; k++ ) { - FOR( k = 0; k < numTimeSlots; k++ ) - { - set32_fx( Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); - set32_fx( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); - set64_fx( Cldfb_RealBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); - set64_fx( Cldfb_ImagBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); - } + set32_fx( Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); + set32_fx( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); + set64_fx( Cldfb_RealBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); + set64_fx( Cldfb_ImagBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX ); } + } #endif /* Head rotation in HOA3 or CICPx */ @@ -1977,7 +1909,7 @@ void ivas_binRenderer_fx( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, 0, *Q_in ); #else - ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in ); + ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in ); #endif FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) @@ -1992,10 +1924,10 @@ void ivas_binRenderer_fx( Cldfb_ImagBuffer_Binaural_fx[0][i][j][k] = W_extract_l( W_shr( Cldfb_ImagBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 move32(); #else - Cldfb_RealBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_RealBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 - move32(); - Cldfb_ImagBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_ImagBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 - move32(); + Cldfb_RealBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_RealBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 + move32(); + Cldfb_ImagBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_ImagBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 + move32(); #endif } } @@ -2142,9 +2074,9 @@ void ivas_binRenderer_fx( v_add_32( Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[pos_idx][chIdx][k], hBinRenderer->conv_band ); // Q_in } #else - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add_32( Cldfb_RealBuffer_Binaural_fx[chIdx][k], reverbRe_fx[chIdx][k], Cldfb_RealBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band ); // Q_in - v_add_32( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band ); // Q_in + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add_32( Cldfb_RealBuffer_Binaural_fx[chIdx][k], reverbRe_fx[chIdx][k], Cldfb_RealBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band ); // Q_in + v_add_32( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band ); // Q_in #endif } } diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 87f580cab..b8a84089f 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -718,10 +718,6 @@ static void ivas_mc_paramupmix_dec_sf( Word16 subframeIdx, idx_in, maxBand; Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; -#else - Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif // MSAN_FIX #ifdef SPLIT_REND_WITH_HEAD_ROT Word32 Cldfb_RealBuffer_Binaural_fx[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 93878325e..21a99add7 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -2100,7 +2100,6 @@ ivas_error init_encoder_ivas_fx( st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); /* Initialize ACELP */ -#endif init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); IF( st->hLPDmem != NULL ) diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index 92f5b8dea..306b47d71 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -2023,10 +2023,10 @@ static void isar_rend_CldfbSplitPostRendProcessTdIn( Q_cldfb = add( scaleFactor, Q_in ); #endif Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #else - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #endif Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) ); Q_out[ch_idx] = sub( Q_cldfb, 1 ); @@ -2091,10 +2091,10 @@ void isar_rend_CldfbSplitPostRendProcess( } Q_cldfb = scaleFactor + Q_cldfb_in; Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #else - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #endif Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) ); Q_out[ch_idx] = sub( Q_cldfb, 1 ); diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index c4c551bc0..039a106a7 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1160,7 +1160,7 @@ ivas_error ISAR_POST_REND_InitConfig( hIvasRend->splitRenderConfig.codec_delay_ms = 0; hIvasRend->splitRenderConfig.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - hIvasRend->splitRenderConfig.isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ + hIvasRend->splitRenderConfig.isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #endif hIvasRend->splitRenderConfig.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hIvasRend->splitRenderConfig.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; @@ -1195,7 +1195,7 @@ Word16 ISAR_POST_REND_GetRenderConfig( splitRenderConfig->codec_delay_ms = 0; splitRenderConfig->codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - splitRenderConfig->isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ + splitRenderConfig->isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #endif splitRenderConfig->codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRenderConfig->poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; @@ -1624,18 +1624,20 @@ static ivas_error renderSplitBinauralWithPostRot( } Q_cldfb = scaleFactor + Q_cldfb_final[sf_idx]; Scale_sig32( hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE +#ifdef OPT_AVOID_STATE_BUF_RESCALE cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( tmpCrendBuffer_fx[ch_idx][sf_idx * outBufNumSamplesPerChannel] ), hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, + 0, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #else cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( tmpCrendBuffer_fx[ch_idx][sf_idx * outBufNumSamplesPerChannel] ), hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + 0, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 #endif Scale_sig32( hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) ); diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index ae7c28b0f..fa3462fdc 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -520,10 +520,10 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( Q_cldfb = q_final; move16(); Scale_sig32( hSplitBin->hCldfbHandles->cldfbSyn[ch]->cldfb_state_fx, hSplitBin->hCldfbHandles->cldfbSyn[ch]->p_filter_length, sub( sub( Q_cldfb, 1 ), hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE - cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, 0, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 #else - cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 + cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 #endif Q_out[ch] = sub( Q_cldfb, 1 ); move16(); @@ -581,10 +581,10 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( Q_cldfb = q_final; move16(); Scale_sig32( hSplitBin->hCldfbHandles->cldfbSyn[ch]->cldfb_state_fx, hSplitBin->hCldfbHandles->cldfbSyn[ch]->p_filter_length, sub( sub( Q_cldfb, 1 ), hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE - cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, 0, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 #else - cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 + cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1 #endif Q_out[ch] = sub( Q_cldfb, 1 ); move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 8cd149868..32bcb732e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3668,18 +3668,20 @@ static void ivas_dirac_dec_binaural_process_output_fx( if ( recompute == 1 ) { /* Inverse filter bank */ -#ifdef OPT_SBA_AVOID_SPAR_RESCALE +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, 0, cldfbSynDec[chA] ); +#else cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] ); -#else /* OPT_SBA_AVOID_SPAR_RESCALE */ - cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); -#endif /* OPT_SBA_AVOID_SPAR_RESCALE */ +#endif cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); move16(); } #else -#ifdef OPT_SBA_AVOID_SPAR_RESCALE +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, 0, cldfbSynDec[chA] ); +#else cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] ); -#endif /* OPT_AVOID_STATE_BUF_RESCALE */ +#endif cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); move16(); #endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d5244e267..31547b5cf 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -692,6 +692,7 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx #else Word32 ***filterStatesLeftReal_fx; Word32 ***filterStatesLeftImag_fx; +#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStatesLeft; #else /* OPT_BASOP_ADD_v1 */ Word16 ***Q_filterStatesLeft; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 92ea6bada..ea6dc54a7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -646,34 +646,36 @@ IVAS_REND_AudioConfigType getAudioConfigType( static ivas_error validateOutputSampleRate( const Word32 sampleRate, - const AUDIO_CONFIG outConfig ){ + const AUDIO_CONFIG outConfig ) +{ - IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ){ + IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) + { /* If no binaural rendering, any sampling rate is supported */ return IVAS_ERR_OK; -} + } #ifdef SPLIT_REND_WITH_HEAD_ROT -ELSE IF( ( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( sampleRate, 48000 ) ) -{ - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); -} -ELSE -{ -#endif - - /* Otherwise rendering to binaural, support the same set as IVAS decoder */ - SWITCH( sampleRate ) + ELSE IF( ( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( sampleRate, 48000 ) ) { - case 8000: - case 16000: - case 32000: - case 48000: - return IVAS_ERR_OK; + return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); } + ELSE + { +#endif + + /* Otherwise rendering to binaural, support the same set as IVAS decoder */ + SWITCH( sampleRate ) + { + case 8000: + case 16000: + case 32000: + case 48000: + return IVAS_ERR_OK; + } - return IVAS_ERR_INVALID_SAMPLING_RATE; + return IVAS_ERR_INVALID_SAMPLING_RATE; #ifdef SPLIT_REND_WITH_HEAD_ROT -} + } #endif } /*-------------------------------------------------------------------* @@ -1487,84 +1489,59 @@ static ivas_error setRendInputActiveIsm( move32(); test(); - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ){ + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) + { #ifdef SPLIT_REND_WITH_HEAD_ROT - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ){ + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) + { return error; -} + } #else - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ){ + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { return error; -} + } #endif -} -ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) -{ - IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) - { - return error; } -} -ELSE -{ - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - Word16 ivas_format; - IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - ivas_format = MC_FORMAT; + IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } } ELSE { - ivas_format = ISM_FORMAT; - } - - move16(); - IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) - { - return error; - } - - - Word16 nchan_rend = num_src; - move16(); - - test(); - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format; + IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { - IF( Src_p->SrcSpatial_p != NULL ) - { - Src_p->SrcSpatial_p->q_Pos_p = Q31; - move16(); - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - SrcSpatial_p->q_Pos_p = Q31; - move16(); + ivas_format = MC_FORMAT; + } + ELSE + { + ivas_format = ISM_FORMAT; } - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* Open TD renderer wrappers */ - FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) - { - if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + move16(); + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) { return error; } - /* Assert same delay as main TD renderer */ - assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); + Word16 nchan_rend = num_src; + move16(); + + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ + } FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { - TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p != NULL ) { IF( Src_p->SrcSpatial_p != NULL ) @@ -1572,25 +1549,53 @@ ELSE Src_p->SrcSpatial_p->q_Pos_p = Q31; move16(); } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; SrcSpatial_p->q_Pos_p = Q31; move16(); } } - } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* Open TD renderer wrappers */ + FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Assert same delay as main TD renderer */ + assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); + + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + } + } #endif - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - return error; + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } } } -} -return IVAS_ERR_OK; + return IVAS_ERR_OK; } static void clearInputIsm( @@ -9079,7 +9084,7 @@ static ivas_error getSamplesInternal( hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, #endif hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } @@ -9388,10 +9393,10 @@ void IVAS_REND_cldfbSynthesis_wrapper( { Scale_sig32( h_cldfb->cldfb_state_fx, h_cldfb->p_filter_length, sub( sub( Q_cldfb, 1 ), h_cldfb->Q_cldfb_state ) ); -#ifdef OPT_SBA_AVOID_SPAR_RESCALE - cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, timeOut, samplesToProcess, 0, h_cldfb ); // Q_cldfb - 1 +#ifdef OPT_AVOID_STATE_BUF_RESCALE + cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, timeOut, samplesToProcess, 0, 0, h_cldfb ); // Q_cldfb - 1 #else - cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, timeOut, samplesToProcess, h_cldfb ); // Q_cldfb - 1 + cldfbSynthesis_ivas_fx( realBuffer, imagBuffer, timeOut, samplesToProcess, 0, h_cldfb ); // Q_cldfb - 1 #endif *Q_out = sub( Q_cldfb, 1 ); move16(); -- GitLab From 9cac43217af5c88836c25e84812d79a35488c3f5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 15 Apr 2025 09:48:15 +0200 Subject: [PATCH 356/358] remove switches that are gone on main --- lib_com/options.h | 35 ----------------------------------- lib_rend/ivas_stat_rend.h | 13 +------------ 2 files changed, 1 insertion(+), 47 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 13d45b067..6fb9e5c94 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,41 +71,6 @@ #define FIX_1378_ACELP_OUT_OF_BOUNDS -/* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS /* FhG: Defines 1.0f-weight variables, uses Madd operation instead of L_add_sat */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS /* FhG: Splits single loop with IF-statements into two low-complex loops */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS /* FhG: IMPROVE PRECISION: Uses 1/6 and 1/20 in full-precise Q31 constants instead of Q15 */ -#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL /* FhG: Uses unique shift amount in each loop iteration */ -#define FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS /* FhG ivas_spar_com.c: Zeroes very small negative coeffs via L_shr_r (was L_shr) */ -#define FIX_ISSUE_1237 /* VA: replacement of Copy_Scale_sig_16_32_DEPREC() that are doing 16 bits left shift by Copy_Scale_sig_16_32_no_sat() */ -#define FIX_ISSUE_1237_KEEP_EVS_BE /* VA: Fix to keep EVS bitexactness to 26.444 */ -#define FIX_ISSUE_1214 /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/ -#define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ -#define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ -#define FIX_ISSUE_1291 /* Ittiam: Wrong use of imult1616() in ACELP rescaling */ -#define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ -#define FIX_USAN_ISSUES /* Ittiam: Fix issues reported by USAN */ -#define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ -#define FIX_ISSUE_1247 -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define FIX_1285_DECODER_CRASH -#define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1320_LOWRATE_ACELP -#define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ -#define FIX_1298 /* VA: fix possible assert in gaus_enc */ -#define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ -#define FIX_1301_CORRECT_TD_CNST /* VA: Fix 1301, correct wrong constant in TD stereo */ -#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ -//#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ -#define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ -#define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ -#define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ -#define NONBE_FIX_1402_WAVEADJUST /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */ -#define FIX_ISSUE_1376 /* VA: Fix for issue 1376 (issue with GSC excitation) */ -#define OPT_SBA_AVOID_SPAR_RESCALE /* Optimization made to spar decoder and IGF */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ #define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 31547b5cf..4ebbfc0f9 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -684,22 +684,11 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx #ifdef SPLIT_REND_WITH_HEAD_ROT Word32 ****filterStatesLeftReal_fx; Word32 ****filterStatesLeftImag_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 *Q_filterStates; -#else - Word16 ****Q_filterStatesLeft; -#endif #else Word32 ***filterStatesLeftReal_fx; Word32 ***filterStatesLeftImag_fx; -#ifdef OPT_BASOP_ADD_v1 Word16 Q_filterStatesLeft; -#else /* OPT_BASOP_ADD_v1 */ - Word16 ***Q_filterStatesLeft; -#endif /* OPT_BASOP_ADD_v1 */ -#endif /* SPLIT_REND_WITH_HEAD_ROT */ - - Word16 numTapsArray[BINAURAL_CONVBANDS]; Word16 numTaps; } BINRENDERER_CONV_MODULE_FX, *BINRENDERER_CONV_MODULE_HANDLE_FX; @@ -857,7 +846,7 @@ typedef struct ivas_combined_orientation_struct Word32 Rmat_prev_fx[MAX_HEAD_ROT_POSES][3][3]; #else Word32 Rmat_prev_fx[3][3]; -#endif /* Q30 */ +#endif /* Q30 */ Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ /* Q(q_chEneIIR) */ Word16 q_chEneIIR; Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* Q(q_procChEneIIR) */ -- GitLab From 70e78f3e6f6368165e63448a27250298f7297fe6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 15 Apr 2025 10:29:58 +0200 Subject: [PATCH 357/358] apply clang-format --- lib_dec/ivas_mc_paramupmix_dec_fx.c | 4 +- lib_isar/lib_isar_post_rend.c | 4 +- lib_rend/lib_rend.c | 179 ++++++++++++++-------------- 3 files changed, 91 insertions(+), 96 deletions(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index b8a84089f..a8995d8e9 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -936,8 +936,8 @@ static void ivas_mc_paramupmix_dec_sf( RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[0][ch][slot_idx]; // Q6 ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[0][ch][slot_idx]; // Q6 #else - RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[ch][slot_idx]; // Q6 - ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch][slot_idx]; // Q6 + RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[ch][slot_idx]; // Q6 + ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch][slot_idx]; // Q6 #endif } #ifndef OPT_AVOID_STATE_BUF_RESCALE diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 039a106a7..82c01004e 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1160,7 +1160,7 @@ ivas_error ISAR_POST_REND_InitConfig( hIvasRend->splitRenderConfig.codec_delay_ms = 0; hIvasRend->splitRenderConfig.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - hIvasRend->splitRenderConfig.isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ + hIvasRend->splitRenderConfig.isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #endif hIvasRend->splitRenderConfig.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hIvasRend->splitRenderConfig.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; @@ -1195,7 +1195,7 @@ Word16 ISAR_POST_REND_GetRenderConfig( splitRenderConfig->codec_delay_ms = 0; splitRenderConfig->codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - splitRenderConfig->isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ + splitRenderConfig->isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ #endif splitRenderConfig->codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRenderConfig->poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ea6dc54a7..62bee3a6b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -646,36 +646,34 @@ IVAS_REND_AudioConfigType getAudioConfigType( static ivas_error validateOutputSampleRate( const Word32 sampleRate, - const AUDIO_CONFIG outConfig ) -{ + const AUDIO_CONFIG outConfig ){ - IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) - { + IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ){ /* If no binaural rendering, any sampling rate is supported */ return IVAS_ERR_OK; - } +} #ifdef SPLIT_REND_WITH_HEAD_ROT - ELSE IF( ( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( sampleRate, 48000 ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); - } - ELSE - { +ELSE IF( ( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( sampleRate, 48000 ) ) +{ + return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); +} +ELSE +{ #endif - /* Otherwise rendering to binaural, support the same set as IVAS decoder */ - SWITCH( sampleRate ) - { - case 8000: - case 16000: - case 32000: - case 48000: - return IVAS_ERR_OK; - } + /* Otherwise rendering to binaural, support the same set as IVAS decoder */ + SWITCH( sampleRate ) + { + case 8000: + case 16000: + case 32000: + case 48000: + return IVAS_ERR_OK; + } - return IVAS_ERR_INVALID_SAMPLING_RATE; + return IVAS_ERR_INVALID_SAMPLING_RATE; #ifdef SPLIT_REND_WITH_HEAD_ROT - } +} #endif } /*-------------------------------------------------------------------* @@ -1489,59 +1487,84 @@ static ivas_error setRendInputActiveIsm( move32(); test(); - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) - { + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ){ #ifdef SPLIT_REND_WITH_HEAD_ROT - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) - { + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ){ return error; - } +} #else - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) - { + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ){ return error; - } +} #endif +} +ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) +{ + IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; } - ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) +} +ELSE +{ + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format; + IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { - IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) - { - return error; - } + ivas_format = MC_FORMAT; } ELSE { - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - Word16 ivas_format; - IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) - { - ivas_format = MC_FORMAT; - } - ELSE + ivas_format = ISM_FORMAT; + } + + move16(); + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) + { + return error; + } + + + Word16 nchan_rend = num_src; + move16(); + + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) { - ivas_format = ISM_FORMAT; + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; + move16(); } + } - move16(); - IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* Open TD renderer wrappers */ + FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) { return error; } + /* Assert same delay as main TD renderer */ + assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); - Word16 nchan_rend = num_src; - move16(); - - test(); - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ - } FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { - TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p != NULL ) { IF( Src_p->SrcSpatial_p != NULL ) @@ -1549,53 +1572,25 @@ static ivas_error setRendInputActiveIsm( Src_p->SrcSpatial_p->q_Pos_p = Q31; move16(); } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; SrcSpatial_p->q_Pos_p = Q31; move16(); } } - -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* Open TD renderer wrappers */ - FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) - { - if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Assert same delay as main TD renderer */ - assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); - - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) - { - IF( Src_p->SrcSpatial_p != NULL ) - { - Src_p->SrcSpatial_p->q_Pos_p = Q31; - move16(); - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; - SrcSpatial_p->q_Pos_p = Q31; - move16(); - } - } - } + } #endif - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { - IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) - { - return error; - } + return error; } } +} - return IVAS_ERR_OK; +return IVAS_ERR_OK; } static void clearInputIsm( @@ -9084,7 +9079,7 @@ static ivas_error getSamplesInternal( hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, #endif hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 789d0619a79e8b2e3eb78a3566b5898f7ee6e62d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 15 Apr 2025 11:04:53 +0200 Subject: [PATCH 358/358] fix build error due to missing field in struct --- lib_rend/ivas_stat_rend.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 4ebbfc0f9..fc434df90 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -689,6 +689,8 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx Word32 ***filterStatesLeftReal_fx; Word32 ***filterStatesLeftImag_fx; Word16 Q_filterStatesLeft; +#endif + Word16 numTapsArray[BINAURAL_CONVBANDS]; Word16 numTaps; } BINRENDERER_CONV_MODULE_FX, *BINRENDERER_CONV_MODULE_HANDLE_FX; @@ -845,8 +847,8 @@ typedef struct ivas_combined_orientation_struct #ifdef SPLIT_REND_WITH_HEAD_ROT Word32 Rmat_prev_fx[MAX_HEAD_ROT_POSES][3][3]; #else - Word32 Rmat_prev_fx[3][3]; -#endif /* Q30 */ + Word32 Rmat_prev_fx[3][3]; /* Q30 */ +#endif Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ /* Q(q_chEneIIR) */ Word16 q_chEneIIR; Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* Q(q_procChEneIIR) */ -- GitLab