diff --git a/lib_com/options.h b/lib_com/options.h index 38bbbc7a5474e70066d94f156692f96152f0702c..8dd94bcd6ab7c4a6d186e5b7670be0ea46f8ab30 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,6 +113,7 @@ #define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ #define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ +#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 FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ #define FIX_1388_MSAN_ivas_init_decoder /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */ #define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 773c8ac0168272b2c85561544e5aadeebb3b1fe9..641af4624c3128e173060ae301a437d15eed9590 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -509,6 +509,11 @@ ivas_error TDREND_GetMix_fx( Word32 hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word16 intp_count; +#ifdef NONBE_1300_TDREND_LARGE_ITD + Word16 currShift, prevShift, transition_len, length_in2; + Word16 tmp1, tmp2, tmp_e, tmp3, tmp4, tmp_e2, tlen1, tlen2; +#endif + Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; move16(); move16(); @@ -544,6 +549,29 @@ ivas_error TDREND_GetMix_fx( &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain_fx, Src_p ); +#ifdef NONBE_1300_TDREND_LARGE_ITD + /* For large ITD values at lower sampling rate, check if the transition can be done */ + IF( LT_16( i_mult( Src_p->previtd, Src_p->itd ), 0 ) ) + { + currShift = abs_s( Src_p->itd ); // Q0 + prevShift = abs_s( Src_p->previtd ); + transition_len = sub( subframe_length, s_max( 0, sub( SFX_SPAT_BIN_SINC_M, currShift ) ) ); + tmp1 = imult1616( transition_len, prevShift ); // Q0 + tmp2 = add( prevShift, currShift ); // Q0 + tmp3 = BASOP_Util_Divide1616_Scale( tmp1, tmp2, &tmp_e ); // exp(tmp_e) + tmp_e2 = BASOP_Util_Add_MantExp( tmp3, tmp_e, ONE_IN_Q14, 0, &tmp4 ); // exp(tmp_e2) + tlen1 = shr( tmp4, sub( 15, tmp_e2 ) ); // Q0 + tlen2 = sub( transition_len, tlen1 ); // Q0 + length_in2 = sub( tlen2, currShift ); // Q0 + + IF( LE_16( 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; + move16(); + } + } +#endif } /* Render source if needed */