diff --git a/lib_com/options.h b/lib_com/options.h index b2727be5ac198886445ef794e1411432b5daf421..7826959d1272ccc3cb4c54be8c431391088e206c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,7 @@ #define FIX_2448_RENDERER_MSAN_ERROR /* FhG: basop issue 2448: fix MSAN error with MSA rendering */ #define FIX_2283_ISM_MD_DELAY /* Dolby: Fix ISM metadata delay round-off */ +#define FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION /* Nokia: float issue 1528: Fixes incorrect compensation for ISM metadata delay in 5ms TD rendering */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 49836f2d1f52703881b171cb6e99193d238d0320..a447eeaf1416ecc68e3e4cb5ba296d231327ef21 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -351,6 +351,10 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis Q11 */ const Word16 output_frame, /* i : output frame length */ const Word16 num_subframes /* i : number of subframes to render */ +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + , + Word16 *metaSfCounter /* i/o: subframe counter for metadata update */ +#endif ) { Word16 subframe_length; @@ -400,7 +404,8 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { - IF( EQ_16( subframe_idx, ism_md_subframe_update ) ) +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + IF( EQ_16( *metaSfCounter, ism_md_subframe_update ) ) { /* Update object position(s) */ IF( NE_32( ( error = TDREND_Update_object_positions_fx( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ), IVAS_ERR_OK ) ) @@ -408,7 +413,24 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( return error; } } +#else + IF( EQ_16( subframe_idx, ism_md_subframe_update ) ){ + /* Update object position(s) */ + IF( NE_32( ( error = TDREND_Update_object_positions_fx( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ), IVAS_ERR_OK ) ){ + return error; + } +} +#endif + +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + *metaSfCounter = add( *metaSfCounter, 1 ); + IF( EQ_16( *metaSfCounter, 4 ) ) + { + *metaSfCounter = 0; + move16(); + } +#endif /* Update the listener's location/orientation */ Word16 tmp_headRotEnabled; tmp_headRotEnabled = 0; @@ -427,7 +449,7 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( #ifdef FIX_2458_USAN_NULLPTR_WITH_ZERO_OFFSET IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, ( Quaternions != NULL ) ? &Quaternions[tmp_CombinedOrient_subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[tmp_CombinedOrient_subframe_idx] : NULL ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[tmp_CombinedOrient_subframe_idx], &Pos[tmp_CombinedOrient_subframe_idx] ) ), IVAS_ERR_OK ) ) +IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[tmp_CombinedOrient_subframe_idx], &Pos[tmp_CombinedOrient_subframe_idx] ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -884,7 +906,11 @@ ivas_error ivas_td_binaural_open_ext_fx( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_ext_fx( - const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + TDREND_WRAPPER *pTDRend, /* i/o: TD Renderer wrapper structure */ +#else + const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ +#endif const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_HANDLE customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ @@ -1005,9 +1031,15 @@ ivas_error ivas_td_binaural_renderer_ext_fx( } } +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output_fx, output_frame, num_subframes, &pTDRend->metaSfCounter ) ), + IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, ism_md_subframe_update_ext, p_output_fx, output_frame, num_subframes ) ), IVAS_ERR_OK ) ) +#endif { return error; } diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 83704923afc4ec3dd526786d2fa347f03fee0684..7206a2093c075f84e6a2d824e2119f966aa4df98 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -671,10 +671,18 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis Q11 */ const Word16 output_frame, /* i : output frame length */ const Word16 num_subframes /* i : number of subframes to render */ +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + , + Word16 *metaSfCounter /* i/o: subframe counter for metadata update */ +#endif ); ivas_error ivas_td_binaural_renderer_ext_fx( +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + TDREND_WRAPPER *pTDRend, /* i/o: TD Renderer wrapper structure */ +#else const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ +#endif const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_HANDLE customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index bf25e92f80349088d41312b92b5fb43bf8869971..7684dff68a1bb3046024fefc7740280b3a4c64fc 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1278,6 +1278,9 @@ typedef struct Word32 binaural_latency_ns; BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; TDREND_HRFILT_FiltSet_t **hHrtfTD; +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + Word16 metaSfCounter; +#endif } TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index e121b5929257e8ae2db2fd89e1173426d8ee610e..423442f94344ec3b019f0fc0745b4af647f205d5 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -1425,6 +1425,10 @@ static TDREND_WRAPPER defaultTdRendWrapper( move32(); w.hBinRendererTd = NULL; w.hHrtfTD = NULL; +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + w.metaSfCounter = 0; + move16(); +#endif return w; } @@ -6523,7 +6527,11 @@ static ivas_error rotateFrameSba_fx( static ivas_error renderIsmToBinaural( +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION input_ism *ismInput, +#else + const input_ism *ismInput, +#endif IVAS_REND_AudioBuffer outAudio ) { Word32 tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];