From 71df852f2000bbc8f29d25e4c781b343b7abf05a Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 13:40:27 +0100 Subject: [PATCH 1/9] fix FIX_2252_TD_CNG_STARTS_SID --- lib_com/options.h | 4 +--- lib_dec/decision_matrix_dec.c | 4 ++++ lib_dec/init_dec.c | 13 +++++++++++++ lib_dec/ivas_decision_matrix_dec.c | 4 ++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b693d06fa4..48df91a9d2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,11 +169,9 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.258 V3.0 */ - - #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ #define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ - +#define FIX_2252_TD_CNG_STARTS_SID /* VA: issues 2251 and 2252: Resolve "MSAN with bitstream that starts with an SID" */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 0cc8b6e57c..86f6af807f 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -101,6 +101,10 @@ void decision_matrix_dec( if ( get_next_indice( st, 1 ) == 1 ) { st->L_frame = L_FRAME16k; +#ifdef FIX_2252_TD_CNG_STARTS_SID + st->nb_subfr = NB_SUBFR16k; + st->bwidth = WB; +#endif } } else diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index c2582a22d7..e3ec671b3e 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -79,8 +79,21 @@ ivas_error init_decoder( st->last_total_brate_ber = -1; st->core_brate = ACELP_8k00; st->ini_frame = 0; +#ifdef FIX_2252_TD_CNG_STARTS_SID + if ( st->element_mode == EVS_MONO ) + { + st->bwidth = NB; + st->last_bwidth = NB; + } + else + { + st->bwidth = WB; + st->last_bwidth = WB; + } +#else st->bwidth = NB; st->last_bwidth = NB; +#endif st->extl_brate = 0; st->coder_type = GENERIC; diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 0de93e1370..826bdb64d6 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -95,6 +95,10 @@ void ivas_decision_matrix_dec( if ( get_next_indice( st, 1 ) ) { st->L_frame = L_FRAME16k; +#ifdef FIX_2252_TD_CNG_STARTS_SID + st->nb_subfr = NB_SUBFR16k; + st->bwidth = WB; +#endif } else { -- GitLab From b08b4e9655744f1b1b10a74127a3f7c7ff2131c7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 14:34:39 +0100 Subject: [PATCH 2/9] fix --- lib_dec/decision_matrix_dec.c | 2 +- lib_dec/ivas_decision_matrix_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 86f6af807f..496cfca5d9 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -103,7 +103,7 @@ void decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = WB; + st->bwidth = min(st->bwidth, WB); #endif } } diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 826bdb64d6..dfb13eba41 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -97,7 +97,7 @@ void ivas_decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = WB; + st->bwidth = min( st->bwidth, WB ); #endif } else -- GitLab From 4e5f65a5e11548dad995c50e8102d8de9a5ad988 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 14:39:35 +0100 Subject: [PATCH 3/9] clang-format --- lib_dec/decision_matrix_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 496cfca5d9..ebe94a8ad5 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -103,7 +103,7 @@ void decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = min(st->bwidth, WB); + st->bwidth = min( st->bwidth, WB ); #endif } } -- GitLab From 5173b4dfeab88b1578008a3aad27b0d147205c85 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 16:33:56 +0100 Subject: [PATCH 4/9] restore BE-ness --- lib_dec/decision_matrix_dec.c | 2 +- lib_dec/init_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index ebe94a8ad5..f613405d77 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -103,7 +103,7 @@ void decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = min( st->bwidth, WB ); + //st->bwidth = min( st->bwidth, WB ); #endif } } diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index e3ec671b3e..42b9ede635 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -79,7 +79,7 @@ ivas_error init_decoder( st->last_total_brate_ber = -1; st->core_brate = ACELP_8k00; st->ini_frame = 0; -#ifdef FIX_2252_TD_CNG_STARTS_SID +#ifdef FIX_2252_TD_CNG_STARTS_SIDaa if ( st->element_mode == EVS_MONO ) { st->bwidth = NB; -- GitLab From 034f11e12c568631894163e76c89b5344bffa660 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 17:30:35 +0100 Subject: [PATCH 5/9] fix --- lib_dec/decision_matrix_dec.c | 2 +- lib_dec/init_dec.c | 4 ++-- lib_dec/ivas_decision_matrix_dec.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index f613405d77..b933a01ffa 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -103,7 +103,7 @@ void decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - //st->bwidth = min( st->bwidth, WB ); + st->bwidth = max( st->bwidth, WB ); #endif } } diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 42b9ede635..f22b1dd82b 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -79,7 +79,7 @@ ivas_error init_decoder( st->last_total_brate_ber = -1; st->core_brate = ACELP_8k00; st->ini_frame = 0; -#ifdef FIX_2252_TD_CNG_STARTS_SIDaa +#ifdef FIX_2252_TD_CNG_STARTS_SID if ( st->element_mode == EVS_MONO ) { st->bwidth = NB; @@ -88,7 +88,7 @@ ivas_error init_decoder( else { st->bwidth = WB; - st->last_bwidth = WB; + // st->last_bwidth = WB; // TBV } #else st->bwidth = NB; diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index dfb13eba41..b38c900421 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -97,7 +97,7 @@ void ivas_decision_matrix_dec( st->L_frame = L_FRAME16k; #ifdef FIX_2252_TD_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = min( st->bwidth, WB ); + st->bwidth = max( st->bwidth, WB ); #endif } else -- GitLab From 4069ba42393beea8275c83f8db2c7b9aaccebeaa Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 17:35:44 +0100 Subject: [PATCH 6/9] correct the switch name --- lib_com/options.h | 2 +- lib_dec/decision_matrix_dec.c | 4 ++-- lib_dec/init_dec.c | 2 +- lib_dec/ivas_decision_matrix_dec.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 48df91a9d2..d1a7b290c4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,7 @@ #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ #define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ -#define FIX_2252_TD_CNG_STARTS_SID /* VA: issues 2251 and 2252: Resolve "MSAN with bitstream that starts with an SID" */ +#define FIX_2252_LP_CNG_STARTS_SID /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index b933a01ffa..4329099e62 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -101,9 +101,9 @@ void decision_matrix_dec( if ( get_next_indice( st, 1 ) == 1 ) { st->L_frame = L_FRAME16k; -#ifdef FIX_2252_TD_CNG_STARTS_SID +#ifdef FIX_2252_LP_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; - st->bwidth = max( st->bwidth, WB ); + st->bwidth = max( st->bwidth, WB ); #endif } } diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index f22b1dd82b..ceccdd11cc 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -79,7 +79,7 @@ ivas_error init_decoder( st->last_total_brate_ber = -1; st->core_brate = ACELP_8k00; st->ini_frame = 0; -#ifdef FIX_2252_TD_CNG_STARTS_SID +#ifdef FIX_2252_LP_CNG_STARTS_SID if ( st->element_mode == EVS_MONO ) { st->bwidth = NB; diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index b38c900421..0157823adf 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -95,7 +95,7 @@ void ivas_decision_matrix_dec( if ( get_next_indice( st, 1 ) ) { st->L_frame = L_FRAME16k; -#ifdef FIX_2252_TD_CNG_STARTS_SID +#ifdef FIX_2252_LP_CNG_STARTS_SID st->nb_subfr = NB_SUBFR16k; st->bwidth = max( st->bwidth, WB ); #endif -- GitLab From 17b589eb698d0793d514a5ba22e9246bee47654e Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 17:57:37 +0100 Subject: [PATCH 7/9] fix --- lib_dec/init_dec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index ceccdd11cc..1bb8abde58 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -88,7 +88,11 @@ ivas_error init_decoder( else { st->bwidth = WB; - // st->last_bwidth = WB; // TBV +#if 0 // keep deactivated for the moment to keep BE + st->last_bwidth = WB; +#else + st->bwidth = NB; +#endif } #else st->bwidth = NB; -- GitLab From 4b601cba82e8b66696473d508d7a13b6f09c917c Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 18:02:47 +0100 Subject: [PATCH 8/9] typo typo --- lib_dec/init_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 1bb8abde58..6a5387d71a 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -91,7 +91,7 @@ ivas_error init_decoder( #if 0 // keep deactivated for the moment to keep BE st->last_bwidth = WB; #else - st->bwidth = NB; + st->last_bwidth = NB; #endif } #else -- GitLab From 6e1160434f709aa3e133deb1d5cd0861dab82863 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Dec 2025 20:44:19 +0100 Subject: [PATCH 9/9] another attempt to get BE --- lib_dec/init_dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 6a5387d71a..f13748c54b 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -87,10 +87,11 @@ ivas_error init_decoder( } else { - st->bwidth = WB; #if 0 // keep deactivated for the moment to keep BE + st->bwidth = WB; st->last_bwidth = WB; #else + st->bwidth = NB; st->last_bwidth = NB; #endif } -- GitLab