From b6713df4b0464b91ab83960d450ec18a6873784d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 4 Apr 2024 13:10:50 +0200 Subject: [PATCH 1/7] skip initialization of EFAP when IntSetup is HOA3 (has 16 channels) --- lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 34c6f7410a..682ef28198 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ +#define FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 21db31e81a..22cb2a8aae 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1275,10 +1275,17 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hEFAPdata = NULL; - +#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM + if ( hBinRenderer->hReverb != NULL && hBinRenderer->nInChannels != 16 ) +#else if ( hBinRenderer->hReverb != NULL ) +#endif { +#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) +#else if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) +#endif { for ( k = 0; k < 11; k++ ) { -- GitLab From cd88473af0abe7a640d48e293f659be47244fbad Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 5 Apr 2024 12:24:49 +0200 Subject: [PATCH 2/7] skip initialization of lib_dec/ivas_binRenderer_internal.c for rendering from ambisonics --- lib_dec/ivas_binRenderer_internal.c | 33 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 22cb2a8aae..8e0081881f 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1036,7 +1036,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->rotInCldfb = 1; hBinRenderer->ivas_format = SBA_FORMAT; - hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + hBinRenderer->max_band = ( int16_t )( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); convBand = hBinRenderer->max_band; hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ @@ -1082,7 +1082,7 @@ ivas_error ivas_rend_openCldfbRend( return error; } - pCldfbRend->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); + pCldfbRend->binaural_latency_ns = ( int32_t )( FASTCONV_HOA3_latency_s * 1000000000.f ); hBinRenderer->hReverb = NULL; hBinRenderer->hEFAPdata = NULL; @@ -1152,7 +1152,7 @@ ivas_error ivas_binRenderer_open( { hBinRenderer->ivas_format = SBA_FORMAT; } - hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + hBinRenderer->max_band = ( int16_t )( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); convBand = hBinRenderer->max_band; hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ @@ -1205,7 +1205,7 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); } else { @@ -1223,21 +1223,21 @@ ivas_error ivas_binRenderer_open( { if ( hBinRenderer->ivas_format == MC_FORMAT ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); } else { if ( hBinRenderer->nInChannels == 16 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); } else if ( hBinRenderer->nInChannels == 9 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); } else if ( hBinRenderer->nInChannels == 4 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); } else { @@ -1248,7 +1248,7 @@ ivas_error ivas_binRenderer_open( else { /* same value for MC or HOA both use MC BRIR*/ - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); } } @@ -1261,11 +1261,16 @@ ivas_error ivas_binRenderer_open( } /* initialize the dmx matrix */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) +#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM + if ( hBinRenderer->nInChannels != 16 ) +#endif { - for ( k = 0; k < hBinRenderer->nInChannels; k++ ) + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { - hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; + for ( k = 0; k < hBinRenderer->nInChannels; k++ ) + { + hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; + } } } } @@ -1625,7 +1630,7 @@ void ivas_binaural_cldfb( int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; /* Implement a 5 msec loops */ - maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + maxBand = ( int16_t )( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); for ( subframeIdx = 0; subframeIdx < ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); subframeIdx++ ) { @@ -1787,7 +1792,7 @@ void ivas_binaural_cldfb_sf( int16_t slot_index_start, slot_index_start_cldfb; /* Implement a 5 msec loops */ - maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + maxBand = ( int16_t )( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); -- GitLab From 3765bd1eb43c1df291c11f946c746ae5aa00d69c Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 5 Apr 2024 12:37:19 +0200 Subject: [PATCH 3/7] fix formatting --- lib_dec/ivas_binRenderer_internal.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 8e0081881f..094471d20b 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1036,7 +1036,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->rotInCldfb = 1; hBinRenderer->ivas_format = SBA_FORMAT; - hBinRenderer->max_band = ( int16_t )( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); convBand = hBinRenderer->max_band; hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ @@ -1082,7 +1082,7 @@ ivas_error ivas_rend_openCldfbRend( return error; } - pCldfbRend->binaural_latency_ns = ( int32_t )( FASTCONV_HOA3_latency_s * 1000000000.f ); + pCldfbRend->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); hBinRenderer->hReverb = NULL; hBinRenderer->hEFAPdata = NULL; @@ -1152,7 +1152,7 @@ ivas_error ivas_binRenderer_open( { hBinRenderer->ivas_format = SBA_FORMAT; } - hBinRenderer->max_band = ( int16_t )( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); convBand = hBinRenderer->max_band; hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ @@ -1205,7 +1205,7 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); } else { @@ -1223,21 +1223,21 @@ ivas_error ivas_binRenderer_open( { if ( hBinRenderer->ivas_format == MC_FORMAT ) { - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); } else { if ( hBinRenderer->nInChannels == 16 ) { - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); } else if ( hBinRenderer->nInChannels == 9 ) { - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); } else if ( hBinRenderer->nInChannels == 4 ) { - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); } else { @@ -1248,7 +1248,7 @@ ivas_error ivas_binRenderer_open( else { /* same value for MC or HOA both use MC BRIR*/ - st_ivas->binaural_latency_ns = ( int32_t )( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); } } @@ -1630,7 +1630,7 @@ void ivas_binaural_cldfb( int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; /* Implement a 5 msec loops */ - maxBand = ( int16_t )( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); for ( subframeIdx = 0; subframeIdx < ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); subframeIdx++ ) { @@ -1792,7 +1792,7 @@ void ivas_binaural_cldfb_sf( int16_t slot_index_start, slot_index_start_cldfb; /* Implement a 5 msec loops */ - maxBand = ( int16_t )( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); -- GitLab From e5ed986b365093c69e08047db3faf71476aaf8c5 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 5 Apr 2024 13:34:40 +0200 Subject: [PATCH 4/7] replace explicit literal 16 by the constant HOA3_CHANNELS --- lib_dec/ivas_binRenderer_internal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 094471d20b..c7d2a6eea4 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1262,7 +1262,7 @@ ivas_error ivas_binRenderer_open( /* initialize the dmx matrix */ #ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM - if ( hBinRenderer->nInChannels != 16 ) + if ( hBinRenderer->nInChannels != HOA3_CHANNELS ) #endif { for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1281,7 +1281,7 @@ ivas_error ivas_binRenderer_open( hBinRenderer->hEFAPdata = NULL; #ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM - if ( hBinRenderer->hReverb != NULL && hBinRenderer->nInChannels != 16 ) + if ( hBinRenderer->hReverb != NULL && hBinRenderer->nInChannels != HOA3_CHANNELS ) #else if ( hBinRenderer->hReverb != NULL ) #endif -- GitLab From 6fc5b8202b18c86dca3dc9710ce1a5c807eb6026 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 5 Apr 2024 14:32:38 +0200 Subject: [PATCH 5/7] rename FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM to NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM --- lib_dec/ivas_binRenderer_internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index c7d2a6eea4..01d80de008 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1261,7 +1261,7 @@ ivas_error ivas_binRenderer_open( } /* initialize the dmx matrix */ -#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM +#ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM if ( hBinRenderer->nInChannels != HOA3_CHANNELS ) #endif { @@ -1280,13 +1280,13 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hEFAPdata = NULL; -#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM +#ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM if ( hBinRenderer->hReverb != NULL && hBinRenderer->nInChannels != HOA3_CHANNELS ) #else if ( hBinRenderer->hReverb != NULL ) #endif { -#ifdef FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM +#ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) #else if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) -- GitLab From fb5e293e52e4ea82ea697bf1a443e4c9bbc5a887 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 8 Apr 2024 11:30:37 +0200 Subject: [PATCH 6/7] replace another instance of a literal 16 by HOA3_CHANNELS --- lib_dec/ivas_binRenderer_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 01d80de008..59c15f6a04 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1289,7 +1289,7 @@ ivas_error ivas_binRenderer_open( #ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) #else - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != HOA3_CHANNELS ) #endif { for ( k = 0; k < 11; k++ ) -- GitLab From 691f014d12123e75e750b127188de8637d8b90aa Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 9 Apr 2024 08:19:16 +0200 Subject: [PATCH 7/7] fix typo in preprocessor define --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 682ef28198..943b9fb821 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,7 +166,7 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ +#define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ /* ##################### End NON-BE switches ########################### */ -- GitLab