From da879d57a46dc8aeadb556cf12ff9236f23d2517 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Sun, 6 Apr 2025 14:59:05 +0200 Subject: [PATCH 1/2] Add NONBE_1300_TDREND_JBM_SHORT_FRAMES to address short JBM frames in TD renderer --- lib_com/options.h | 1 + lib_rend/ivas_objectRenderer.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 92a2e7a0f8..e23aa77962 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */ #define NONBE_1303_GRANULARITY_OSBA_REND /* VA: issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output */ +#define NONBE_1300_TDREND_JBM_SHORT_FRAMES /* Eri: issue 1300: The JBM operates on 1.25 ms granularity, compatible with CLDFB. The TD renderer needs adaptations to handle such short frames. */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 4be6fda156..aa0f59c134 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -437,6 +437,9 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; +#ifdef NONBE_1300_TDREND_JBM_SHORT_FRAMES + int16_t currShift, prevShift, transition_len, length_in2; +#endif error = IVAS_ERR_OK; @@ -462,6 +465,19 @@ ivas_error TDREND_GetMix( { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p ); +#ifdef NONBE_1300_TDREND_JBM_SHORT_FRAMES + /* For short subframes triggered by JBM, ensure interpolation and ITD transition fits within subframe */ + intp_count = min( intp_count, subframe_length ); + currShift = abs( Src_p->itd ); + prevShift = abs( Src_p->previtd ); + transition_len = subframe_length - max( 0, SFX_SPAT_BIN_SINC_M - currShift ); + length_in2 = transition_len - (int16_t) ( ( (float) ( transition_len * prevShift ) / ( (float) ( prevShift + currShift ) ) ) + 0.5f ) - currShift; + if ( Src_p->itd * Src_p->previtd < 0 && length_in2 <= 0 ) + { + /* Subframe too short for ITD transition -- change to ITD=0 and push the rest of the transition to next subframe */ + Src_p->itd = 0; + } +#endif } /* Render source if needed */ -- GitLab From d8d8952b1c822211802813315b328a36e73bcf6f Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 7 Apr 2025 06:46:33 +0200 Subject: [PATCH 2/2] Small fix for NONBE_1300_TDREND_JBM_SHORT_FRAMES --- lib_rend/ivas_objectRenderer.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index aa0f59c134..b3e38f5baa 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -467,15 +467,17 @@ ivas_error TDREND_GetMix( Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p ); #ifdef NONBE_1300_TDREND_JBM_SHORT_FRAMES /* For short subframes triggered by JBM, ensure interpolation and ITD transition fits within subframe */ - intp_count = min( intp_count, subframe_length ); - currShift = abs( Src_p->itd ); - prevShift = abs( Src_p->previtd ); - transition_len = subframe_length - max( 0, SFX_SPAT_BIN_SINC_M - currShift ); - length_in2 = transition_len - (int16_t) ( ( (float) ( transition_len * prevShift ) / ( (float) ( prevShift + currShift ) ) ) + 0.5f ) - currShift; - if ( Src_p->itd * Src_p->previtd < 0 && length_in2 <= 0 ) + if ( Src_p->itd * Src_p->previtd < 0 ) { - /* Subframe too short for ITD transition -- change to ITD=0 and push the rest of the transition to next subframe */ - Src_p->itd = 0; + currShift = (int16_t) abs( Src_p->itd ); + prevShift = (int16_t) abs( Src_p->previtd ); + transition_len = subframe_length - max( 0, SFX_SPAT_BIN_SINC_M - currShift ); + length_in2 = transition_len - (int16_t) ( ( (float) ( transition_len * prevShift ) / ( (float) ( prevShift + currShift ) ) ) + 0.5f ) - currShift; + if ( length_in2 <= 0 ) + { + /* Subframe too short for ITD transition -- change to ITD=0 and push the rest of the transition to next subframe */ + Src_p->itd = 0; + } } #endif } -- GitLab