From 44c55881dab37c0b956694bf670eb91267a19b12 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 30 Apr 2026 11:19:49 +0200 Subject: [PATCH 1/2] [fix] SBA to stereo rendering loudness --- lib_com/options.h | 1 + lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 20 ++++++++++++++++++++ lib_rend/ivas_allrad_dec_fx.c | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 6579999f2..a618000ac 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ #define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ +#define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 905d62d3c..c2798a55d 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1566,11 +1566,31 @@ void ivas_sba_dirac_stereo_dec_fx( synchro_synthesis_fx( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/, q_dft[0] ); /* output scaling */ +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + IF( !sba_mono_flag ) +#else test(); IF( !sba_mono_flag && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) ) +#endif { +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + test(); + IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) + { + /* low bitrate OSBA needs a makeup gain of 2.f to compensate for the encoder side + INV_SQRT2 * 2 = SQRT2 */ + v_multc_fx( output[0], SQRT2_FX, output[0], output_frame ); + v_multc_fx( output[1], SQRT2_FX, output[1], output_frame ); + } + ELSE + { + v_multc_fx( output[0], INV_SQRT2_FX, output[0], output_frame ); + v_multc_fx( output[1], INV_SQRT2_FX, output[1], output_frame ); + } +#else v_shr( output[0], 1, output[0], output_frame ); /*0.5f*/ v_shr( output[1], 1, output[1], output_frame ); /*0.5f*/ +#endif } /* delay HB synth */ diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 2c5c40b9c..18793c211 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -98,10 +98,17 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( } ELSE IF( EQ_32( hOutSetup.output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + ( *hoa_dec_mtx )[0] = INV_SQRT2_FX >> 2; + ( *hoa_dec_mtx )[1] = INV_SQRT2_FX >> 2; + ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = INV_SQRT2_FX >> 2; + ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -( INV_SQRT2_FX >> 2 ); +#else ( *hoa_dec_mtx )[0] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[1] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -ONE_IN_Q28; // 0.5f in Q29 +#endif move32(); move32(); move32(); -- GitLab From 60100303eb2a16a140befdae1d6c5c241e2e0fe5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 30 Apr 2026 14:57:40 +0200 Subject: [PATCH 2/2] [fix] Q factor for low bitrate OSBA branch --- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index c2798a55d..1d15b3d29 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1581,6 +1581,8 @@ void ivas_sba_dirac_stereo_dec_fx( INV_SQRT2 * 2 = SQRT2 */ v_multc_fx( output[0], SQRT2_FX, output[0], output_frame ); v_multc_fx( output[1], SQRT2_FX, output[1], output_frame ); + v_shr( output[0], -1, output[0], output_frame ); /* q_dft */ + v_shr( output[1], -1, output[1], output_frame ); /* q_dft */ } ELSE { -- GitLab