From 2c7f3af586845a114cda4f0589acef0380cab23c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 29 Apr 2026 08:21:02 +0200 Subject: [PATCH 1/2] port fix for float issue 1559 --- lib_com/fd_cng_com_fx.c | 4 ++++ lib_com/options.h | 1 + lib_dec/fd_cng_dec_fx.c | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 497587635..9b13274d8 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -112,6 +112,10 @@ void initFdCngCom( move16(); hFdCngCom->stopFFTbin = 0; move16(); +#ifdef FIX_1559 + hFdCngCom->nFFTpart = 0; + move16(); +#endif hFdCngCom->frameSize = 0; move16(); hFdCngCom->fftlen = 0; diff --git a/lib_com/options.h b/lib_com/options.h index 53bfa8a2e..b9ed90169 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,6 +148,7 @@ #define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ #define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ +#define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 5fced60ad..2f845329c 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4155,6 +4155,9 @@ void configureFdCngDec_ivas_fx( { Word16 j, stopBandFR; HANDLE_FD_CNG_COM hsCom = hFdCngDec->hFdCngCom; +#ifdef FIX_1559 + Word16 nFFTpart_prev; +#endif hsCom->CngBandwidth = bwidth; /*Q0*/ move16(); @@ -4289,6 +4292,10 @@ void configureFdCngDec_ivas_fx( hsCom->stopBand = add( hsCom->FdCngSetup.sidPartitions[( hsCom->FdCngSetup.numPartitions - 1 )], 1 ); /*Q0*/ initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0 ); +#ifdef FIX_1559 + + nFFTpart_prev = hsCom->nFFTpart; +#endif IF( EQ_16( hsCom->stopFFTbin, 160 ) ) { hsCom->nFFTpart = 17; @@ -4314,6 +4321,21 @@ void configureFdCngDec_ivas_fx( move16(); } +#ifdef FIX_1559 + /* In case of going from a lower number of partitions to a higher number, initialize + the higher ines which might be zero and/or outdated with the highest partitions value + this avoids almost-zero values to linger around and causing signal bursts after switching to higher bitrate. + Don't do this on initialization of the codec (nFFTpart_prev == 0)*/ + IF( NE_16( nFFTpart_prev, 0 ) ) + { + FOR( j = nFFTpart_prev; j < hsCom->nFFTpart; ++j ) + { + hFdCngDec->partNoiseShape[j] = hFdCngDec->partNoiseShape[nFFTpart_prev - 1]; + move16(); + } + } +#endif + stopBandFR = 40; //(Word16)floor(1000.f /*Hz*/ / 25.f /*Hz/Bin*/); move16(); if ( GT_16( stopBandFR, hsCom->stopFFTbin ) ) -- GitLab From 25aff9c93d527cc41d4a3ccf22a31cd31409228f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 29 Apr 2026 08:47:02 +0200 Subject: [PATCH 2/2] add missing move --- lib_dec/fd_cng_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 2f845329c..6f4363229 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4293,8 +4293,8 @@ void configureFdCngDec_ivas_fx( initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0 ); #ifdef FIX_1559 - nFFTpart_prev = hsCom->nFFTpart; + move16(); #endif IF( EQ_16( hsCom->stopFFTbin, 160 ) ) { -- GitLab