From 740814d0beb09f76faba233c3c1c84a2344d1ad5 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Mon, 15 May 2023 16:34:06 +0200 Subject: [PATCH] fix for JBM EVS BE --- lib_dec/jbm_pcmdsp_apa.c | 45 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 713c2327a0..c224b4cfbf 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -1237,22 +1237,27 @@ static bool shrink_frm( energy = -65; quality = 5; #ifdef JBM_TSM_ON_TCS - xtract = maxScaling; - /* take samples already in the renderer buf into account */ - xtract += ps->l_r_buf; - /* snap to renderer time slot borders */ - xtract -= ( ps->l_ts - ( l_frm - xtract + ps->l_r_buf ) % ps->l_ts ); - while ( xtract < 0 ) + if ( ps->evs_compat_mode == false ) { - xtract += ps->l_ts; - } - while ( xtract > ( s_end - ps->num_channels ) ) - { - /* exceeded the possible shrinking, go back one renderer ts*/ - xtract -= ps->l_ts; + + xtract = maxScaling; + /* take samples already in the renderer buf into account */ + xtract += ps->l_r_buf; + /* snap to renderer time slot borders */ + xtract -= ( ps->l_ts - ( l_frm - xtract + ps->l_r_buf ) % ps->l_ts ); + while ( xtract < 0 ) + { + xtract += ps->l_ts; + } + while ( xtract > ( s_end - ps->num_channels ) ) + { + /* exceeded the possible shrinking, go back one renderer ts*/ + xtract -= ps->l_ts; + } } -#else - if ( maxScaling != 0U && s_end > maxScaling + 1 ) + else +#endif + if ( maxScaling != 0U && s_end > maxScaling + 1 ) { xtract = maxScaling; } @@ -1261,7 +1266,6 @@ static bool shrink_frm( /* set to last valid element (i.e. element[len - 1] but note for stereo last element is last pair of samples) */ xtract = s_end - ps->num_channels; } -#endif } else { @@ -1485,10 +1489,13 @@ static bool extend_frm( quality = 5; xtract[n] = s_start + ps->num_channels; #ifdef JBM_TSM_ON_TCS - /* take renderer buffer samples into accout */ - xtract[n] += ps->l_r_buf; - /* snap to next renderer time slot border to resynchronize */ - xtract[n] -= ( ( N - 1 ) * l_seg - xtract[n] + ps->l_r_buf ) % ps->l_ts; + if ( ps->evs_compat_mode == false ) + { + /* take renderer buffer samples into accout */ + xtract[n] += ps->l_r_buf; + /* snap to next renderer time slot border to resynchronize */ + xtract[n] -= ( ( N - 1 ) * l_seg - xtract[n] + ps->l_r_buf ) % ps->l_ts; + } #endif } else -- GitLab