diff --git a/lib_com/options.h b/lib_com/options.h index e5caa032cef9a3ab478e4285d1df5cabbc16ff51..b6700bd69ae14d6e64ac880559ae1a9e9b262a20 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -186,6 +186,7 @@ #define FIX_1385_INIT_IGF_STOP_FREQ /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */ #define FIX_1387_INIT_PRM_SQQ /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */ #define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */ +#define NONBE_1300_TDREND_LARGE_ITD /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/ #define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */ #define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */ #define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 5248c5d092dd3469c93a0ab8b0d38bb52a0df6fe..ff978a09ef51419062cb0682237fe3daea9ac5eb 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_LARGE_ITD + int16_t currShift, prevShift, transition_len, length_in2; +#endif error = IVAS_ERR_OK; @@ -462,6 +465,21 @@ 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_LARGE_ITD + /* For large ITD values at lower sampling rate, check if the transition can be done */ + if ( Src_p->itd * Src_p->previtd < 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 } /* Render source if needed */