From 28ce1f371027412d1377cddff49d7f03797bcf7f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 6 May 2025 15:30:48 +0200 Subject: [PATCH 1/3] port 1298 from float --- lib_com/options.h | 1 + lib_dec/ivas_output_config_fx.c | 8 ++++++++ lib_dec/ivas_sba_dec_fx.c | 8 ++++++++ lib_dec/ivas_spar_decoder_fx.c | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 71e860604..d696d9339 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,6 +99,7 @@ #define NONBE_FIX_967_ISM_MONO_DMX /* FhG: issue 967: accumulating energies in ISM mono DMX */ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ +#define NONBE_FIX_935_SBA_REVERB /* FhG: issue 935: fix MSAN error for SBA related to BINAURAL_ROOM_REVERB */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index 9d8a592e0..75a592e1e 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -158,11 +158,19 @@ void ivas_renderer_select( move16(); test(); +#ifdef NONBE_FIX_935_SBA_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) ) +#endif +#else #ifdef SPLIT_REND_WITH_HEAD_ROT IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #endif +#endif /* NONBE_FIX_935_SBA_REVERB */ { *renderer_type = RENDERER_BINAURAL_FASTCONV; move16(); diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index fdbcdef48..b5d494eae 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -216,11 +216,19 @@ ivas_error ivas_sba_dec_reconfigure_fx( ELSE { test(); +#ifdef NONBE_FIX_935_SBA_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) ) +#endif +#else #ifdef SPLIT_REND_WITH_HEAD_ROT IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #endif +#endif /* NONBE_FIX_935_SBA_REVERB */ { renderer_type_new = RENDERER_BINAURAL_FASTCONV; move16(); diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 38b403606..b95a93678 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -294,8 +294,14 @@ ivas_error ivas_spar_dec_open_fx( test(); test(); +#ifdef NONBE_FIX_935_SBA_REVERB + + IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) +#else test(); + IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && ( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) +#endif { /* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */ Word32 quo, rem; -- GitLab From 30d55ece7594d0b00c20dcb3913bc2fe18b7c57c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 7 May 2025 15:56:39 +0200 Subject: [PATCH 2/3] use saturated subtraction in loop --- lib_dec/ivas_binRenderer_internal_fx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 0709c6b75..313815a58 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -1098,20 +1098,24 @@ static void ivas_binaural_obtain_DMX_fx( FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { Word32 foa_const_fx = L_shl( hBinRenderer->hReverb->foa_enc_fx[chIdx][1], 1 ); // Q30 + Word32 one_add_foa_const, one_sub_foa_const; + + one_add_foa_const = L_add( ONE_IN_Q30, foa_const_fx ); // Q30 + one_sub_foa_const = L_sub_sat( ONE_IN_Q30, foa_const_fx ); // Q30 inRealPtr_fx = (Word32 *) &( RealBuffer[chIdx][k][0] ); inImagPtr_fx = (Word32 *) &( ImagBuffer[chIdx][k][0] ); FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { - outRealLeftPtr_fx[bandIdx] = L_add( outRealLeftPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_add( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1 + outRealLeftPtr_fx[bandIdx] = L_add( outRealLeftPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], one_add_foa_const ) ); // Q_in - 1 move32(); - outImagLeftPtr_fx[bandIdx] = L_add( outImagLeftPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_add( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1 + outImagLeftPtr_fx[bandIdx] = L_add( outImagLeftPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], one_add_foa_const ) ); // Q_in - 1 move32(); - outRealRightPtr_fx[bandIdx] = L_add( outRealRightPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], L_sub( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1 + outRealRightPtr_fx[bandIdx] = L_add( outRealRightPtr_fx[bandIdx], Mpy_32_32( inRealPtr_fx[bandIdx], one_sub_foa_const ) ); // Q_in - 1 move32(); - outImagRightPtr_fx[bandIdx] = L_add( outImagRightPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], L_sub( ONE_IN_Q30, foa_const_fx ) ) ); // Q_in - 1 + outImagRightPtr_fx[bandIdx] = L_add( outImagRightPtr_fx[bandIdx], Mpy_32_32( inImagPtr_fx[bandIdx], one_sub_foa_const ) ); // Q_in - 1 move32(); } } -- GitLab From 4f13a0afc15a8ebe125bae11a0a395e113b9c242 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 7 May 2025 16:12:26 +0200 Subject: [PATCH 3/3] apply clang format --- lib_dec/ivas_binRenderer_internal_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 313815a58..9b7bd86b6 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -1100,7 +1100,7 @@ static void ivas_binaural_obtain_DMX_fx( Word32 foa_const_fx = L_shl( hBinRenderer->hReverb->foa_enc_fx[chIdx][1], 1 ); // Q30 Word32 one_add_foa_const, one_sub_foa_const; - one_add_foa_const = L_add( ONE_IN_Q30, foa_const_fx ); // Q30 + one_add_foa_const = L_add( ONE_IN_Q30, foa_const_fx ); // Q30 one_sub_foa_const = L_sub_sat( ONE_IN_Q30, foa_const_fx ); // Q30 inRealPtr_fx = (Word32 *) &( RealBuffer[chIdx][k][0] ); -- GitLab