From 3c0d7273acd710e4f9b84c36e603db26f945f29f Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Feb 2025 10:32:22 +0100 Subject: [PATCH 1/3] port FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP; under NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD --- lib_com/options.h | 2 ++ lib_enc/dtx.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c7111f22a..cc3f12cbf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -178,6 +178,8 @@ #define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ #define NONBE_1273_ISM_METADATA_COUNTER /* VA: FLP issue 1273: fix counter overflow in ISM metadata encoder */ #define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ +#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ + /* #################### End FIXES switches ############################ */ diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index c1e842e58..9f52e5b3f 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -65,6 +65,13 @@ #define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ #define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ + +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD +#define DTX_THR_EVS 15 /* lp_noise threshold for DTX at higher bitrates in EVS */ // ToDo: to be removed once EVS is CR fixed +#define DTX_THR 5 /* lp_noise threshold for DTX at higher bitrates */ +#endif + + /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ @@ -92,6 +99,15 @@ void dtx( int16_t last_br_cng_flag, last_br_flag, br_dtx_flag; #ifdef NONBE_1211_DTX_BR_SWITCHING int32_t total_brate_ref; +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD + int16_t dtx_thr; + + dtx_thr = DTX_THR; + if ( st->element_mode == EVS_MONO ) + { + dtx_thr = DTX_THR_EVS; // ToDo: to be removed once EVS is CR fixed + } +#endif total_brate_ref = st->total_brate; #endif @@ -106,11 +122,19 @@ void dtx( } else { +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD + last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < dtx_thr || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); +#else last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); +#endif #ifdef NONBE_1211_DTX_BR_SWITCHING last_br_flag = ( st->element_mode == EVS_MONO && st->last_total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && last_ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD + st->lp_noise < dtx_thr; +#else st->lp_noise < 15; +#endif #else last_br_flag = st->last_total_brate <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate <= MAX_BRATE_DTX_IVAS ); br_dtx_flag = 0; @@ -195,7 +219,11 @@ void dtx( { br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD + st->lp_noise < dtx_thr; +#else st->lp_noise < 15; +#endif } if ( st->Opt_DTX_ON && vad == 0 && -- GitLab From 72339f05224e29e4a5a74e7299bc86da9f324120 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 19 Feb 2025 16:54:29 +0100 Subject: [PATCH 2/3] Apply DTX_THR in ISM DTX as well. --- lib_com/cnst.h | 4 ++++ lib_enc/dtx.c | 2 -- lib_enc/ivas_ism_dtx_enc.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 556da0d14..949a5ea09 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -750,6 +750,10 @@ typedef enum #define GAIN_PRED_ORDER 4 /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */ #define MEAN_ENER 30 /* Gain quantization - average innovation energy */ +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD +#define DTX_THR 5 /* DTX - lp_noise threshold for DTX at higher bitrates */ +#endif + #define DTX_HIST_SIZE 8 /* CNG & DTX - number of last signal frames used for CNG averaging */ #define CNG_ISF_FACT 0.9f /* CNG & DTX - CNG spectral envelope smoothing factor */ #define STEP_AMR_WB_SID 2.625f /* CNG & DTX - CNG energy quantization step */ diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 9f52e5b3f..449678bd0 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -68,10 +68,8 @@ #ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR_EVS 15 /* lp_noise threshold for DTX at higher bitrates in EVS */ // ToDo: to be removed once EVS is CR fixed -#define DTX_THR 5 /* lp_noise threshold for DTX at higher bitrates */ #endif - /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 1277d0d88..04d656765 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -155,7 +155,11 @@ int16_t ivas_ism_dtx_enc( ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || +#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD + lp_noise_max < DTX_THR ) ) +#else lp_noise_max < 15 ) ) +#endif { dtx_flag = 0; } -- GitLab From 2fbed67f881236ad6fef150c6c9af0b0954c8d4d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 3 Mar 2025 14:40:57 +0530 Subject: [PATCH 3/3] Fix for 3GPP issue 708: OSBA decoder crash Link #708 --- lib_com/options.h | 1 + lib_dec/ivas_sba_dec.c | 4 ++++ lib_enc/lib_enc.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 07f503121..7731646a8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define NONBE_1273_ISM_METADATA_COUNTER /* VA: FLP issue 1273: fix counter overflow in ISM metadata encoder */ #define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ #define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ +#define NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH /* FhG: issue 708: fix crash in OSBA BR switching with long test vectors */ #define NONBE_1319_M2R_PRECISION_ALIGN /* Nokia: bring updates from PC code related to OMASA masa2total ratios */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 470cd6182..ac4e155b8 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -296,7 +296,11 @@ ivas_error ivas_sba_dec_reconfigure( } } +#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH + if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) +#else if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && st_ivas->ivas_format == SBA_FORMAT ) +#endif { if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) { diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index db5e9d0d4..3c186cc01 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -990,7 +990,11 @@ static ivas_error configureEncoder( } #endif +#ifdef NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH + if ( hEncoderConfig->Opt_PCA_ON && !( ( hEncoderConfig->ivas_format == SBA_FORMAT || hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) +#else if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) +#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "PCA supported at SBA FOA 256 kbps only." ); } -- GitLab