diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index f61890e98746f869b2a6a6a086098a4090628441..6c9166111ff804ab906449b4b2fc7ed20de5e85e 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1160,7 +1160,11 @@ void ivas_apply_non_diegetic_panning_fx( const Word16 output_frame /* i : output frame length per channel */ ); +#ifdef NONBE_FIX_967_ISM_MONO_DMX +void ivas_ism_mono_dmx_fx( +#else void ivas_mono_downmix_render_passive_fx( +#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono output */ const Word16 output_frame /* i : output frame length */ diff --git a/lib_com/options.h b/lib_com/options.h index 37865063a6fa3796f923ed70d0dfb921841c8061..f958121273da3f39db429369c2e7b9f07a9f3d22 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,6 +100,7 @@ #define FIX_957_REMOVE_PANNING_DEAD_CODE /* VA: Remove obsolete non-diegetic panning related code. */ #define NONBE_FIX_935_EARLY_REFLECTIONS_WRONG_ORDER /* Qualcomm: issue 953: fix order or ER channels in LC mode*/ #define FIX_955_FASTCONV_REND_IN_ISM /* VA: put FastConv rendering call under DEBUGGING */ +#define NONBE_FIX_967_ISM_MONO_DMX /* FhG: issue 967: accumulating energies in ISM mono DMX */ #define FIX_956_DECODER_COMMAND_LINE_FIX /* VA: Output correct error message when the decoder command-line has too many mandatory arguments. */ #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*/ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1e233533877bad1b1533d0859b2ff4683dd64174..304a853425549b25235efb99af1cd86191c926b8 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -265,7 +265,11 @@ ivas_error ivas_jbm_dec_tc_fx( test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) { +#ifdef NONBE_FIX_967_ISM_MONO_DMX + ivas_ism_mono_dmx_fx( st_ivas, p_output_fx, output_frame ); +#else ivas_mono_downmix_render_passive_fx( st_ivas, p_output_fx, output_frame ); +#endif Scale_sig32( p_output_fx[0], L_FRAME48k, 3 ); } @@ -794,7 +798,11 @@ ivas_error ivas_jbm_dec_tc_fx( move16(); IF( EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) { +#ifdef NONBE_FIX_967_ISM_MONO_DMX + ivas_ism_mono_dmx_fx( st_ivas, p_output_fx, output_frame ); +#else ivas_mono_downmix_render_passive_fx( st_ivas, p_output_fx, output_frame ); +#endif output_q = 8; move16(); @@ -1082,7 +1090,11 @@ ivas_error ivas_jbm_dec_tc_fx( } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { +#ifdef NONBE_FIX_967_ISM_MONO_DMX + ivas_ism_mono_dmx_fx( st_ivas, p_output_fx, output_frame ); +#else ivas_mono_downmix_render_passive_fx( st_ivas, p_output_fx, output_frame ); +#endif Scale_sig32( p_output_fx[0], L_FRAME48k, Q11 - Q8 ); // Q11 diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index 2eb8d84dfe6a1d93e468243d1a11353fed12e82e..1d24e0153383188ef0d0af15524a5cefeaee13b0 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -45,8 +45,13 @@ /*------------------------------------------------------------------------- * Local constants *------------------------------------------------------------------------*/ -#define DOWNMIX_ALPHA_FX 31130 /* Smoothing coefficient */ +#define DOWNMIX_ALPHA_FX 31130 /* Smoothing coefficient alpha */ +#ifdef NONBE_FIX_967_ISM_MONO_DMX +#define DOWNMIX_ONE_MINUS_ALPHA_FX 1638 /* Smoothing coefficient (1 - alpha) */ +#endif +#ifndef NONBE_FIX_967_ISM_MONO_DMX #define MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS 4 +#endif /*------------------------------------------------------------------------- * ivas_mono_dmx_renderer_open() @@ -102,11 +107,15 @@ void ivas_mono_dmx_renderer_close( } /*------------------------------------------------------------------------- - * ivas_mono_downmix_render_passive() + * ivas_ism_mono_dmx() * * Downmix process *------------------------------------------------------------------------*/ +#ifdef NONBE_FIX_967_ISM_MONO_DMX +void ivas_ism_mono_dmx_fx( +#else void ivas_mono_downmix_render_passive_fx( +#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono output Qin = 11/ Qout = 8*/ const Word16 output_frame /* i : output frame length */ @@ -120,6 +129,7 @@ void ivas_mono_downmix_render_passive_fx( Word16 Q_shift, proto_shift, input_shift, norm_protoEner, norm_inputEner, proto_norm; Word16 diff_shift, div, div_sqrt; Word32 protoEner_pre, inputEner_pre; + numInputChannels = st_ivas->nSCE; move16(); if ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -160,11 +170,13 @@ void ivas_mono_downmix_render_passive_fx( v_add_32( output_shr, proto_signal_fx, proto_signal_fx, output_frame ); } +#ifndef NONBE_FIX_967_ISM_MONO_DMX /* compute the input energy, proto energy after smoothing */ hDownmix->inputEnergy_fx = Mpy_32_16_1( hDownmix->inputEnergy_fx, DOWNMIX_ALPHA_FX ); move32(); hDownmix->protoEnergy_fx = Mpy_32_16_1( hDownmix->protoEnergy_fx, DOWNMIX_ALPHA_FX ); move32(); +#endif proto_norm = L_norm_arr( proto_signal_fx, output_frame ); @@ -185,6 +197,16 @@ void ivas_mono_downmix_render_passive_fx( } } +#ifdef NONBE_FIX_967_ISM_MONO_DMX + hDownmix->inputEnergy_fx = Mpy_32_16_1( hDownmix->inputEnergy_fx, DOWNMIX_ALPHA_FX ); + move32(); + hDownmix->protoEnergy_fx = Mpy_32_16_1( hDownmix->protoEnergy_fx, DOWNMIX_ALPHA_FX ); + move32(); + + protoEner_pre = Mpy_32_16_1( protoEner_pre, DOWNMIX_ONE_MINUS_ALPHA_FX ); + inputEner_pre = Mpy_32_16_1( inputEner_pre, DOWNMIX_ONE_MINUS_ALPHA_FX ); +#endif + /* compute the eq factor */ IF( hDownmix->protoEnergy_fx == 0 )