From fec0f74d8937e347c2aa35faf1daee2ea24b443f Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 7 Jul 2023 07:54:02 +0200 Subject: [PATCH] fix tc offset for some cases --- lib_com/options.h | 2 +- lib_dec/ivas_jbm_dec.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..88daf4de64 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - +#define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ff28af051a..dd06e265b8 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -701,8 +701,13 @@ ivas_error ivas_jbm_dec_render( *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; pan_right = 1.f - pan_left; +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + v_multc( p_tc[0], pan_right, output[1], *nSamplesRendered ); + v_multc( p_tc[0], pan_left, output[0], *nSamplesRendered ); +#else v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); +#endif } else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { @@ -729,8 +734,13 @@ ivas_error ivas_jbm_dec_render( { pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; pan_right = 1.f - pan_left; +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + v_multc( p_tc[0], pan_right, output[1], *nSamplesRendered ); + v_multc( p_tc[0], pan_left, output[0], *nSamplesRendered ); +#else v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); +#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -816,8 +826,11 @@ ivas_error ivas_jbm_dec_render( { return error; } - +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); +#else ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -834,8 +847,11 @@ ivas_error ivas_jbm_dec_render( { return error; } - +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); +#else ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); +#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) -- GitLab