From 44cfaeb2ceef024a0995f382df0b027b71cca45a Mon Sep 17 00:00:00 2001 From: "Malenovsky, Vladimir" Date: Thu, 4 Dec 2025 10:31:49 +0100 Subject: [PATCH 1/6] initialize FD CNG with EVS-type of init function --- lib_com/options.h | 1 + lib_dec/init_dec_fx.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1a7b596d5..175072bf6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,6 +85,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ +#define FIX_2245_INIT_FD_CNG_EVS /* Dolby: Issue 2245: initialize FD CNG with EVS-type of init function */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index ec2c0ce0b..d8b8ba05f 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -928,7 +928,18 @@ ivas_error init_decoder_fx( } /* Init FD-CNG */ - initFdCngDec_ivas_fx( st_fx, st_fx->cldfbSyn->scale ); +#ifdef FIX_2245_INIT_FD_CNG_EVS + if ( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + initFdCngDec_fx( st_fx, st_fx->cldfbSyn->scale ); + } + else + { +#endif + initFdCngDec_ivas_fx( st_fx, st_fx->cldfbSyn->scale ); +#ifdef FIX_2245_INIT_FD_CNG_EVS + } +#endif } ELSE { -- GitLab From fea60c4bb4207ca676144eea2514dd880d61221f Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 4 Dec 2025 13:19:26 +0100 Subject: [PATCH 2/6] harmonize use of FD CNG init function --- lib_com/fd_cng_com_fx.c | 12 +++++++++--- lib_com/ivas_prot_fx.h | 3 ++- lib_com/options.h | 2 +- lib_dec/fd_cng_dec_fx.c | 14 ++++++++++++++ lib_dec/init_dec_fx.c | 13 +++---------- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++++ lib_dec/ivas_stereo_switching_dec_fx.c | 13 +++++++++++++ 7 files changed, 46 insertions(+), 15 deletions(-) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 1a85899d3..992540d66 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -58,7 +58,13 @@ ivas_error createFdCngCom_fx( * *-------------------------------------------------------------------*/ -void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) +#ifdef FIX_2245_INIT_FD_CNG_EVS +void initFdCngCom( +#else +void ivas_initFdCngCom_fx( +#endif + HANDLE_FD_CNG_COM hFdCngCom, + Word16 scale ) { /* Calculate CLDFB scaling factor */ /* shl(i_mult2(scale, scale), 3) does not fit in 16 bit */ @@ -172,7 +178,7 @@ void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) return; } - +#ifndef FIX_2245_INIT_FD_CNG_EVS void initFdCngCom( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) { /* Calculate CLDFB scaling factor */ @@ -277,7 +283,7 @@ void initFdCngCom( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) return; } - +#endif /*------------------------------------------------------------------- * deleteFdCngCom() * diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 3c7f54074..7cee85a2c 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1990,6 +1990,7 @@ ivas_error stereo_memory_dec_fx( const Word16 nchan_transport /* i : number of transport channels */ ); +#ifndef FIX_2245_INIT_FD_CNG_EVS void initFdCngDec_ivas_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale @@ -1998,7 +1999,7 @@ void initFdCngDec_ivas_fx( void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ); - +#endif Word16 set_ACELP_flag_IVAS( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ diff --git a/lib_com/options.h b/lib_com/options.h index 175072bf6..6590c90c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,7 +85,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ -#define FIX_2245_INIT_FD_CNG_EVS /* Dolby: Issue 2245: initialize FD CNG with EVS-type of init function */ +#define FIX_2245_INIT_FD_CNG_EVS /* Dolby/VA: Issue 2245: initialize FD CNG with EVS-type of init function */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 2c62fd653..042d72c64 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -81,16 +81,27 @@ ivas_error createFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ) return error; } +#ifdef FIX_2245_INIT_FD_CNG_EVS +void initFdCngDec_fx( + DEC_CORE_HANDLE st, /* i/o: decoder state structure */ + const Word16 scale /* i : Q factor */ +) +#else void initFdCngDec_ivas_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale /*Q15*/ ) +#endif { /* Initialize common */ HANDLE_FD_CNG_DEC hFdCngDec; hFdCngDec = st->hFdCngDec; +#ifdef FIX_2245_INIT_FD_CNG_EVS + initFdCngCom( hFdCngDec->hFdCngCom, scale ); +#else ivas_initFdCngCom_fx( hFdCngDec->hFdCngCom, scale ); +#endif set16_fx( hFdCngDec->olapBufferAna, 0, FFTLEN ); hFdCngDec->hFdCngCom->olapBufferAna = hFdCngDec->olapBufferAna; set16_fx( hFdCngDec->olapBufferSynth2, 0, FFTLEN ); @@ -196,9 +207,11 @@ void initFdCngDec_ivas_fx( move16(); Copy( st->lsp_old_fx, st->lspCNG_fx, M ); /*Q15*/ hFdCngDec->hFdCngCom->sid_frame_counter = 0; + return; } +#ifndef FIX_2245_INIT_FD_CNG_EVS void initFdCngDec_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ const Word16 scale /*Q15*/ ) @@ -287,6 +300,7 @@ void initFdCngDec_fx( return; } +#endif /* configureFdCngDec_fx diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index d8b8ba05f..e46991dc8 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -929,16 +929,9 @@ ivas_error init_decoder_fx( /* Init FD-CNG */ #ifdef FIX_2245_INIT_FD_CNG_EVS - if ( EQ_16( st_fx->element_mode, EVS_MONO ) ) - { - initFdCngDec_fx( st_fx, st_fx->cldfbSyn->scale ); - } - else - { -#endif - initFdCngDec_ivas_fx( st_fx, st_fx->cldfbSyn->scale ); -#ifdef FIX_2245_INIT_FD_CNG_EVS - } + initFdCngDec_fx( st_fx, st_fx->cldfbSyn->scale ); +#else + initFdCngDec_ivas_fx( st_fx, st_fx->cldfbSyn->scale ); #endif } ELSE diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 1a639a3d7..1f7710376 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -571,7 +571,11 @@ ivas_error initMdctStereoDtxData_fx( } /* Init FD-CNG */ +#ifdef FIX_2245_INIT_FD_CNG_EVS + initFdCngDec_fx( st, st->cldfbSyn->scale ); +#else initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); +#endif } IF( st->first_CNG == 0 ) diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 237b5f9d5..5ac255026 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -652,7 +652,11 @@ ivas_error stereo_memory_dec_fx( return error; } +#ifdef FIX_2245_INIT_FD_CNG_EVS + initFdCngDec_fx( st, st->cldfbSyn->scale ); +#else initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); +#endif configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); } @@ -759,7 +763,11 @@ ivas_error stereo_memory_dec_fx( } /* Init FD-CNG */ +#ifdef FIX_2245_INIT_FD_CNG_EVS + initFdCngDec_fx( st, st->cldfbSyn->scale ); +#else initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); +#endif if ( EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { @@ -1079,7 +1087,12 @@ ivas_error stereo_memory_dec_fx( { return error; } + +#ifdef FIX_2245_INIT_FD_CNG_EVS + initFdCngDec_fx( hCPE->hCoreCoder[i], hCPE->hCoreCoder[i]->cldfbSyn->scale ); +#else initFdCngDec_ivas_fx( hCPE->hCoreCoder[i], hCPE->hCoreCoder[i]->cldfbSyn->scale ); +#endif } } } -- GitLab From 5c78c00f16ad2bddf02ea4d6bf73103aad2cf440 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 4 Dec 2025 13:23:12 +0100 Subject: [PATCH 3/6] commit the actual fix --- lib_dec/fd_cng_dec_fx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 042d72c64..a5161ecc1 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -136,6 +136,7 @@ void initFdCngDec_ivas_fx( set16_fx( hFdCngDec->msPsd, 0, NPART_SHAPING ); set32_fx( hFdCngDec->msPsd_fx, 0, NPART_SHAPING ); + set16_fx( hFdCngDec->msNoiseFloor, 0, NPART_SHAPING ); set32_fx( hFdCngDec->msNoiseFloor_32fx, 0, NPART_SHAPING ); set32_fx( hFdCngDec->msNoiseEst, 0, NPART_SHAPING ); -- GitLab From fbf0056f433f0855edc0b809cf8838f2f5d6c580 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 4 Dec 2025 13:25:00 +0100 Subject: [PATCH 4/6] add compilation switch --- lib_dec/fd_cng_dec_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index a5161ecc1..89cdc6d12 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -136,7 +136,9 @@ void initFdCngDec_ivas_fx( set16_fx( hFdCngDec->msPsd, 0, NPART_SHAPING ); set32_fx( hFdCngDec->msPsd_fx, 0, NPART_SHAPING ); +#ifdef FIX_2245_INIT_FD_CNG_EVS set16_fx( hFdCngDec->msNoiseFloor, 0, NPART_SHAPING ); +#endif set32_fx( hFdCngDec->msNoiseFloor_32fx, 0, NPART_SHAPING ); set32_fx( hFdCngDec->msNoiseEst, 0, NPART_SHAPING ); -- GitLab From a5aaa5b0865e1aeef0fb835f0517905cb6cc9556 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 4 Dec 2025 13:31:33 +0100 Subject: [PATCH 5/6] clang-format --- lib_com/fd_cng_com_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 992540d66..45dd66f45 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -61,9 +61,9 @@ ivas_error createFdCngCom_fx( #ifdef FIX_2245_INIT_FD_CNG_EVS void initFdCngCom( #else -void ivas_initFdCngCom_fx( +void ivas_initFdCngCom_fx( #endif - HANDLE_FD_CNG_COM hFdCngCom, + HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) { /* Calculate CLDFB scaling factor */ -- GitLab From a602a1cf9c70e4bf299b1bb71382319af766238c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 4 Dec 2025 14:17:17 +0100 Subject: [PATCH 6/6] more fix --- lib_dec/fd_cng_dec_fx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 89cdc6d12..9f8263016 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -164,6 +164,9 @@ void initFdCngDec_ivas_fx( move16(); set16_fx( hFdCngDec->msLogPeriodog, 0, NPART_SHAPING ); +#ifdef FIX_2245_INIT_FD_CNG_EVS + set16_fx( hFdCngDec->msLogNoiseEst, 0, NPART_SHAPING ); +#endif set32_fx( hFdCngDec->msLogNoiseEst_32fx, 0, NPART_SHAPING ); set16_fx( hFdCngDec->psize_shaping, 0, NPART_SHAPING ); -- GitLab