From 309c4c34506a044dadf4a23eed161508b94bde5a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 29 Apr 2025 22:13:25 +0200 Subject: [PATCH 1/2] work in progress --- lib_com/ivas_prot_fx.h | 4 ++++ lib_com/options.h | 1 + lib_dec/ivas_jbm_dec_fx.c | 12 ++++++++++++ lib_dec/ivas_mono_dmx_renderer_fx.c | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index f61890e98..6c9166111 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 97eafb65e..77437c5a2 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. */ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 1e2335338..304a85342 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 2eb8d84df..11239b5f6 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -46,7 +46,9 @@ * Local constants *------------------------------------------------------------------------*/ #define DOWNMIX_ALPHA_FX 31130 /* Smoothing coefficient */ +#ifndef NONBE_FIX_967_ISM_MONO_DMX #define MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS 4 +#endif /*------------------------------------------------------------------------- * ivas_mono_dmx_renderer_open() @@ -102,11 +104,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 +126,13 @@ 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; +#ifdef NONBE_FIX_967_ISM_MONO_DMX + Word32 inputEnergy_local_fx; + Word16 Q_inputEner_local; + Word32 protoEnergy_local_fx; + Word16 Q_protoEner_local; +#endif + numInputChannels = st_ivas->nSCE; move16(); if ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -160,11 +173,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 ); -- GitLab From a939067beb109b827e34c40b5da106dd2677bd2c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Apr 2025 11:54:34 +0200 Subject: [PATCH 2/2] complete implementation --- lib_dec/ivas_mono_dmx_renderer_fx.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index 11239b5f6..1d24e0153 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -45,7 +45,10 @@ /*------------------------------------------------------------------------- * 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 @@ -126,12 +129,6 @@ 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; -#ifdef NONBE_FIX_967_ISM_MONO_DMX - Word32 inputEnergy_local_fx; - Word16 Q_inputEner_local; - Word32 protoEnergy_local_fx; - Word16 Q_protoEner_local; -#endif numInputChannels = st_ivas->nSCE; move16(); @@ -200,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 ) -- GitLab