diff --git a/lib_com/options.h b/lib_com/options.h index ef31d7758f9770efadc3d0d53962fce02abddd5c..23a486e6b9d11d3b9f679f58bbd305e5cada2bf6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ /* any switch which is non-be wrt. TS 26.258 V3.0 */ #define USE_RTPDUMP /* FhG: RTPDUMP format (rtptools standard) instead of custom format */ +#define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ #define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* Expose Payload Type setting in RTP Header */ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, synch with BASOP updates and adding clamping of distance att input and listener position */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index e074d13f7e8756427e3e6d8c6ab2e3a070e8c437..fcc4f941244363590c434f075095a6ff13a2ccd1 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -910,10 +910,29 @@ void ivas_sba_dirac_stereo_dec( synchro_synthesis( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); /* output scaling */ +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + if ( !sba_mono_flag ) +#else if ( !sba_mono_flag && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_NONE ) ) +#endif { +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && 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( output[0], SQRT2, output[0], output_frame ); + v_multc( output[1], SQRT2, output[1], output_frame ); + } + else + { + v_multc( output[0], INV_SQRT2, output[0], output_frame ); + v_multc( output[1], INV_SQRT2, output[1], output_frame ); + } +#else v_multc( output[0], 0.5f, output[0], output_frame ); v_multc( output[1], 0.5f, output[1], output_frame ); +#endif } /* delay HB synth */ diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index 141e538817c686b0e3b282e38567b1434d325866..5b27c04cb982a81ea66d9aef94b7fb52ac994ab7 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -129,10 +129,17 @@ ivas_error ivas_sba_get_hoa_dec_matrix( } else if ( hOutSetup.output_config == IVAS_AUDIO_CONFIG_STEREO ) { +#ifdef FIX_1521_SBA_LOUDNESS_STEREO + ( *hoa_dec_mtx )[0] = INV_SQRT2; + ( *hoa_dec_mtx )[1] = INV_SQRT2; + ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = INV_SQRT2; + ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -INV_SQRT2; +#else ( *hoa_dec_mtx )[0] = 0.5f; ( *hoa_dec_mtx )[1] = 0.5f; ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = 0.5f; ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -0.5f; +#endif } else if ( hOutSetup.is_loudspeaker_setup ) {