From 30acb8787ed053fdb43503b773896b91ee343f74 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 12 Jun 2025 15:18:30 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 950: High MLD for ParamMC 5.1 at 48/64/80kbps or 7.1+4 at 128kbps Link #950, #1023, #1024 --- lib_dec/ivas_jbm_dec_fx.c | 7 +++++++ lib_dec/ivas_mc_param_dec_fx.c | 13 ++++++++----- lib_dec/ivas_stat_dec.h | 2 +- lib_rend/ivas_dirac_decorr_dec_fx.c | 6 ++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 3f67962dc..6b5023a70 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -4032,6 +4032,13 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( &cldfb_real_buffer_fx[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], &cldfb_imag_buffer_fx[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch], &Q_tc ); + IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) MC_FORMAT ) ) + { + st_ivas->hParamMC->Cldfb_RealBuffer_tc_e = sub( 31, Q_tc ); + st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e = sub( 31, Q_tc ); + move16(); + move16(); + } } } } diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 0e2de6c01..f1bbec638 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -106,7 +106,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 Word16 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 Cldfb_Real_Imag_exp, Word16 *proto_frame_f_fx_q /* Word16 ImagBuffer_fx_e, Word16 *common_e*/ ); /*------------------------------------------------------------------------- * ivas_param_mc_dec_open() @@ -1983,7 +1983,7 @@ void ivas_param_mc_dec_render_fx( param_mc_protoSignalComputation_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, - hParamMC->num_freq_bands ); + hParamMC->num_freq_bands, hParamMC->Cldfb_RealBuffer_tc_e, &hParamMC->proto_frame_f_fx_q ); /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ @@ -1995,7 +1995,7 @@ void ivas_param_mc_dec_render_fx( DIRAC_SYNTHESIS_COV_MC_LS, nchan_transport, hParamMC->proto_frame_f_fx, - Q5, + hParamMC->proto_frame_f_fx_q, hParamMC->diff_proto_info->num_protos_diff, hParamMC->diff_proto_info->proto_index_diff, hParamMC->proto_frame_dec_f_fx, // output @@ -2321,8 +2321,9 @@ 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 Word16 num_freq_bands /* i : number of frequency bands for the prototypes */ -) + const Word16 num_freq_bands, /* i : number of frequency bands for the prototypes */ + const Word16 Cldfb_Real_Imag_exp, /*i: Exponent of real and imag buffers */ + Word16 *proto_frame_f_fx_q ) { Word16 band; Word16 proto_ch_idx, source_ch_cnt; @@ -2367,6 +2368,8 @@ static void param_mc_protoSignalComputation_fx( move32(); p_proto_frame_fx++; } + *proto_frame_f_fx_q = sub( 30, Cldfb_Real_Imag_exp ); + move16(); } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 891be05be..4eb40f337 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -573,7 +573,7 @@ typedef struct ivas_param_mc_dec_data_structure Word32 *proto_matrix_int_fx; Word16 proto_matrix_int_len; Word16 proto_matrix_int_e; - + Word16 proto_frame_f_fx_q; /*sub-modules*/ HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; diff --git a/lib_rend/ivas_dirac_decorr_dec_fx.c b/lib_rend/ivas_dirac_decorr_dec_fx.c index 9b2bf02d7..aa4aed84c 100644 --- a/lib_rend/ivas_dirac_decorr_dec_fx.c +++ b/lib_rend/ivas_dirac_decorr_dec_fx.c @@ -482,6 +482,7 @@ void ivas_dirac_dec_decorr_process_fx( q_shift = 0; move16(); } + set32_fx( aux_buffer_fx, 0, 2 * MAX_OUTPUT_CHANNELS * CLDFB_NO_CHANNELS_MAX ); FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { v_shr( &input_frame_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], negate( q_shift ), &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], imult1616( 2, num_freq_bands ) ); // Q - q_shift @@ -496,6 +497,11 @@ void ivas_dirac_dec_decorr_process_fx( { v_add_inc_fx( &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) )], 2, &aux_buffer_fx[add( imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) ), 1 )], 2, &aux_buffer_fx[imult1616( ch_idx, max_band_decorr_temp )], 1, max_band_decorr_temp ); // q_aux_buffer } + if ( is_zero_arr( aux_buffer_fx, 2 * MAX_OUTPUT_CHANNELS * CLDFB_NO_CHANNELS_MAX ) ) + { + q_aux_buffer = 31; + move16(); + } /* compute onset filter */ max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr; move16(); -- GitLab From a1a5235b6e35314ad21b6d9cbce4370e60b56e26 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 12 Jun 2025 17:28:11 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_dec/ivas_mc_param_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index f1bbec638..b6868dbb1 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -2322,7 +2322,7 @@ static void param_mc_protoSignalComputation_fx( 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 Word16 num_freq_bands, /* i : number of frequency bands for the prototypes */ - const Word16 Cldfb_Real_Imag_exp, /*i: Exponent of real and imag buffers */ + const Word16 Cldfb_Real_Imag_exp, /*i: Exponent of real and imag buffers */ Word16 *proto_frame_f_fx_q ) { Word16 band; -- GitLab