From 567b85c3402bed6180fbdbe44d2faf9770fb6e15 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 4 Jul 2024 11:34:47 +0530 Subject: [PATCH] Fix for LTV crash issues observed with OMASA format after BASOP changes [x] Fix for ltv-OMASA 1Dir2TC 3ISM at br sw techs 13.2 to 512 kbps start 24.4 kbps, 32kHz in, 48kHz out, 5.1.4 out crash. --- lib_dec/ivas_stereo_td_dec.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 129857e0d..83b6d67a4 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -151,13 +151,22 @@ void tdm_configure_dec( Word16 mod_ct, core, bits_offset; Word16 idx_LRTD_pri_side, tdm_inst_ratio_idx; Word32 element_brate_adapt; - Word16 bstr_last_pos; + Word16 bstr_last_pos, temp; hStereoTD = hCPE->hStereoTD; sts = hCPE->hCoreCoder; element_brate_adapt = L_add( hCPE->element_brate, hCPE->brate_surplus ); - bstr_last_pos = add( sub( div_l( hCPE->element_brate, FRAMES_PER_SEC / 2 ), nb_bits_metadata ), div_l( hCPE->brate_surplus, FRAMES_PER_SEC / 2 ) ); + + IF( hCPE->brate_surplus < 0 ) + { + temp = extract_l( L_negate( Mpy_32_32( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) ); + } + ELSE + { + temp = extract_l( Mpy_32_32( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + } + bstr_last_pos = add( sub( div_l( hCPE->element_brate, FRAMES_PER_SEC / 2 ), nb_bits_metadata ), temp ); /*----------------------------------------------------------------* * Decode CoreCoder signaling -- GitLab