From 9b06a6d0b33339f02fff37c5b4f5db1a0b07ad5e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 4 Nov 2024 10:31:15 +0530 Subject: [PATCH] Fix for 3gpp issue 974: OSBA 160 kbps (pre-rendering): Discrepancy for SPAR part for several components --- lib_rend/ivas_dirac_output_synthesis_dec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index f30bb1237..0fa4511fd 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1537,7 +1537,15 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } ELSE { - b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], L_add( reference_power[k + ( ch_idx + 1 ) * num_freq_bands], EPSILON_FX ), &b_exp ); /*Q(15-b_exp)*/ + IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) + { + b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); + b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); + } + 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)*/ + } } c = L_add( ONE_IN_Q29 /*1 Q29*/, Mpy_32_16_1( L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29 /*1 Q29*/ ), 5461 /*1.0 / 6.0 Q15*/ ) ); /*Diffuseness modellling nrg compensation*/ /*Q29*/ @@ -1611,10 +1619,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) { - b = MAXVAL_WORD16; /*Q(-9)*/ - move16(); - b_exp = 40; - move16(); + b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); + b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); } ELSE { -- GitLab