diff --git a/lib_com/options.h b/lib_com/options.h index 13a0c786d3b9024c0eab4248878420b63eb996ce..3da1b39ce59738a1cf9adc6d4c02a3d978315e6b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.258 V3.0 */ #define FIX_FLOAT_1493_MASA_ENCODE_STABILITY_IMPROVE /* Nokia: float issue 1493: Improves float decision stability in MASA encoding by adjusting reduction code */ +#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.c b/lib_rend/ivas_objectRenderer.c index 5aed6c33355032534ac8cc34c588aad81e77717a..7353b2ce654dd52c4f644492e1f8a73c381c2a45 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -318,6 +318,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame, /* i : output frame length */ const int16_t num_subframes /* i : number of subframes to render */ +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + , + int16_t *metaSfCounter /* i/o: subframe counter for metadata update */ +#endif ) { int16_t subframe_length; @@ -361,7 +365,11 @@ ivas_error ivas_td_binaural_renderer_unwrap( for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + if ( *metaSfCounter == ism_md_subframe_update ) +#else if ( subframe_idx == ism_md_subframe_update ) +#endif { /* Update object position(s) */ if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) @@ -370,6 +378,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( } } +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + *metaSfCounter = ( *metaSfCounter + 1 ) % 4; + +#endif /* Update the listener's location/orientation */ if ( ( error = TDREND_Update_listener_orientation( hBinRendererTd, ( enableCombinedOrientation != NULL ) ? enableCombinedOrientation[hCombinedOrientationData->subframe_idx] : 0, ( Quaternions != NULL ) ? &Quaternions[hCombinedOrientationData->subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[hCombinedOrientationData->subframe_idx] : NULL ) ) != IVAS_ERR_OK ) { @@ -722,7 +734,11 @@ ivas_error ivas_td_binaural_open_ext( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_ext( - 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 */ @@ -790,8 +806,13 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output, output_frame, (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ), &( pTDRend->metaSfCounter ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, ism_md_subframe_update_ext, p_output, output_frame, (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 15469e0aa784539b18cc95dbeb3b21ae85ae7c2f..d33b372b9c7758a455f1d5179c0c305535262f74 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -641,10 +641,18 @@ ivas_error ivas_td_binaural_renderer_unwrap( float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame, /* i : output frame length */ const int16_t num_subframes /* i : number of subframes to render */ +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + , + int16_t *metaSfCounter /* i/o: subframe counter for metadata update */ +#endif ); ivas_error ivas_td_binaural_renderer_ext( +#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 ef082716f96f737acb2c266c9af571bf6e113977..815355d021fe95fd4aa3241212502c678d02fe58 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1141,6 +1141,9 @@ typedef struct int32_t binaural_latency_ns; BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; TDREND_HRFILT_FiltSet_t **hHrtfTD; +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + int16_t metaSfCounter; +#endif } TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3d9609359b4f4421c7275f10c57f97f886e463fe..ece820a9ec4cd862c53f7e1090c508a6ce219b2d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1253,6 +1253,9 @@ static TDREND_WRAPPER defaultTdRendWrapper( w.binaural_latency_ns = 0; w.hBinRendererTd = NULL; w.hHrtfTD = NULL; +#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION + w.metaSfCounter = 0; +#endif return w; } @@ -5679,7 +5682,11 @@ static ivas_error rotateFrameSba( 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 ) { float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];