diff --git a/lib_com/options.h b/lib_com/options.h index 757452c71e2ad3154bf838f42e57de9556c30b2c..39e60980dc1048749356b2629988de05894ddb2e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #define FIX_691_OSBA_CRASH /* FhG: Fix for issue 691: Crash for OSBA Stereo out */ #define FIX_694_OMASA_EXTREME /* Nokia: fix for crash in OMASA on extreme sample */ #define FIX_679_JBM_MC2SBA /* FhG: fix issue 679: check for transport vs. internal channel count in JBM prior to ivas_mc2sba() */ +#define FIX_591_PARAMISM_JBM_ENER_CORRECTION /* FhG: fix energy correction in ParamISM rendering */ #define FIX_LARGE_RENDERER_DELAY_COMP /* Fix renderer delay compensation with delays greater than 1 frame */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index a30b25b532c62eeddb9077b7d254c941c5250a45..071513de38caeddfd845f50b3d83ec1d7405665d 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1124,6 +1124,9 @@ void ivas_param_ism_dec_digest_tc( float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; DIRAC_DEC_HANDLE hDirAC; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; +#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION + int16_t fade_len; +#endif /* Initialization */ hDirAC = st_ivas->hDirAC; @@ -1133,7 +1136,12 @@ void ivas_param_ism_dec_digest_tc( ene_tc = 0.0f; ene_sum = 0.0f; last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; +#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION + output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands; + fade_len = output_frame / 2; +#else output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); +#endif nchan_transport = st_ivas->nchan_transport; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -1238,9 +1246,13 @@ void ivas_param_ism_dec_digest_tc( { /* Smoothing */ gain = 0.75f * gain + 0.25f * last_gain; - /* 10ms ramp */ +#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION + grad = ( gain - last_gain ) / (float) fade_len; /* slope between two consecutive gains, 480 samples length */ + for ( i = 0; i < fade_len; i++ ) +#else grad = ( gain - last_gain ) * 2.0f / (float) output_frame; /* slope between two consecutive gains, 480 samples length */ - for ( i = 0; i < ( output_frame / 2 ); i++ ) + for ( i = 0; i < output_frame / 2; i++ ) +#endif { transport_channels_f[0][i] *= ( last_gain + i * grad ); transport_channels_f[1][i] *= ( last_gain + i * grad ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index da8bf7fc574f21716a2f0475fdf6ae90fe40169a..0da2fba312b3c24c155cee1d007029379e5a5117 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -207,6 +207,13 @@ ivas_error ivas_jbm_dec_tc( { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } +#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION + else if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) + { + /* loudness correction */ + ivas_dirac_dec_binaural_sba_gain( output, st_ivas->nchan_transport, output_frame ); + } +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) {