From 2826d1a8a8a2631b32a25bd13957b6e634e932ea Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 5 Sep 2025 11:48:59 +1000 Subject: [PATCH 1/2] fix for masking noise issue --- lib_com/options.h | 1 + lib_dec/acelp_core_dec_fx.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3e11805fc..432974a18 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -90,6 +90,7 @@ #define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */ #define FIX_1995_REVERB_INIT /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */ +#define FIX_1996_MASKING_NOISE /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 144762f74..41a5cbe5f 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1637,12 +1637,16 @@ ivas_error acelp_core_dec_fx( IF( NE_16( st->element_mode, last_element_mode ) ) { set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen ); +#ifdef FIX_1996_MASKING_NOISE + set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen ); +#endif } Word32 psyn_32_fx[L_FRAME16k]; - Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6 + Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6 +#ifndef FIX_1996_MASKING_NOISE Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); // Q15 - +#endif generate_masking_noise_ivas_fx( psyn_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); Copy_Scale_sig_32_16( psyn_32_fx, psyn_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( st->Q_syn, exp ) ); // Q = st->Q_syn -- GitLab From 5e2296f67c7cfd234ff5d3bddaae604de949efd5 Mon Sep 17 00:00:00 2001 From: naghibza Date: Fri, 5 Sep 2025 10:50:20 +0200 Subject: [PATCH 2/2] fix for masking noise issue v2 --- lib_com/options.h | 2 +- lib_dec/acelp_core_dec_fx.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 87b945bf2..0f0ccb0fc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -90,7 +90,7 @@ #define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */ #define FIX_1995_REVERB_INIT /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */ -#define FIX_1996_MASKING_NOISE /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/ +#define FIX_1996_MASKING_NOISE_V2 /* Dlb/FhG: Heavy precision loss in ola buffers causing discontinuity*/ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 41a5cbe5f..b1525acd9 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1637,14 +1637,13 @@ ivas_error acelp_core_dec_fx( IF( NE_16( st->element_mode, last_element_mode ) ) { set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#ifdef FIX_1996_MASKING_NOISE - set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen ); -#endif } Word32 psyn_32_fx[L_FRAME16k]; Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6 -#ifndef FIX_1996_MASKING_NOISE +#ifdef FIX_1996_MASKING_NOISE_V2 + Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->frameSize, Q15 ); // Q15 +#else Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); // Q15 #endif generate_masking_noise_ivas_fx( psyn_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); -- GitLab