diff --git a/lib_com/options.h b/lib_com/options.h index 83f3db8a33c503765ab249e2b7ba096e987e9413..4ba6b5c48eb5be1109518400a3f4d96625cb4ebb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,7 +164,7 @@ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ - +#define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index fd0bf5b53088d9fad499d549c4fc5058e7561973..02c74efa37839cdeab97c2a89ddaa104b65ac170 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -403,6 +403,10 @@ ivas_error ivas_dec( } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { +#ifdef FIX_564 + /* loudness correction */ + ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); +#else float gain; if ( nchan_remapped == 1 ) @@ -418,6 +422,7 @@ ivas_error ivas_dec( { v_multc( output[n], gain, output[n], output_frame ); } +#endif } /* Loudspeakers, Ambisonics or Binaural rendering */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 5222104ee87187584262d0a71799c292985a47a4..858d78ab28bb3ebfdbe7f187ba48665047560029 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -304,12 +304,17 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { +#ifdef FIX_564 + /* loudness correction */ + ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); +#else float gain = 0.8414f; /* Todo: Temporary gain for roughly matching the loudness. To be tuned later together with other outputs. Also, this is not inline with ivas_dec() */ for ( n = 0; n < nchan_remapped; n++ ) { v_multc( output[n], gain, output[n], output_frame ); } +#endif } } else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 8db8d1a4714c7046b9383690bcf50ea36c1cfc3d..2b4643c8b4cae0d91337eba57622960034642aab 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -408,6 +408,41 @@ void ivas_dirac_dec_binaural_render( } +#ifdef FIX_564 +/*------------------------------------------------------------------------- + * ivas_dirac_dec_binaural_gain() + * + * loudness correction for parametric binaural renderer + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_binaural_gain( + float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t n; + float gain; + + if ( nchan_remapped == 1 ) + { + gain = 1.4454f; + } + else + { + gain = 1.3657f; + } + + for ( n = 0; n < nchan_remapped; n++ ) + { + v_multc( output[n], gain, output[n], output_frame ); + } + + return; +} +#endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_binaural() * diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 4ea5cb448486aebfae4d86f28d66d4bcd7764655..9594cf0b92db6133b435c6bc8beff08378ebc5e0 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -149,6 +149,15 @@ ivas_error ivas_sba_get_hoa_dec_matrix( const int16_t ambisonics_order /* i : Ambisonics order */ ); +#ifdef FIX_564 + +void ivas_dirac_dec_binaural_gain( + float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ + const int16_t output_frame /* i : output frame length */ +); +#endif + void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */