From 2df83c8b5fa37272de85aa9b86c65e3872a71253 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Oct 2024 15:00:07 +0200 Subject: [PATCH 1/5] issue 1209: remove dead code in IVAS SID signaling; under FIX_1209_SID_SIGNALING --- lib_com/ivas_cnst.h | 4 ++++ lib_com/options.h | 2 +- lib_dec/ivas_init_dec.c | 7 ++++++- lib_enc/ivas_init_enc.c | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 105c0e8057..4e6ad47f24 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -233,7 +233,11 @@ typedef enum #define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */ #define SID_ISM 0x2 /* 0| 1| 0 */ #define SID_MASA_1TC 0x3 /* 1| 1| 0 */ +#ifdef FIX_1209_SID_SIGNALING +/*reserved*/ /*0x4*/ /* 0| 0| 1 */ +#else #define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */ +#endif #define SID_SBA_1TC 0x5 /* 1| 0| 1 */ #define SID_SBA_2TC 0x6 /* 0| 1| 1 */ #define SID_MASA_2TC 0x7 /* 1| 1| 1 */ diff --git a/lib_com/options.h b/lib_com/options.h index 97feb76cc3..caaaa5a1ac 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,7 @@ #define FIX_587_DEFAULT_REVERB /* Philips: issue 587: inconsistent default reverb parameters across renderers */ #define FIX_HRTF_LOAD /* VA: issue 1187: fix memory issue when HRTFs are loaded from a binary file */ - +#define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a7262093c0..b624244afe 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1036,11 +1036,12 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; - break; +#ifndef FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; break; +#endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; st_ivas->element_mode_init = IVAS_SCE; @@ -1065,7 +1066,9 @@ static ivas_error ivas_read_format( } break; default: +#ifndef FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ +#endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } @@ -1079,10 +1082,12 @@ static ivas_error ivas_read_format( st_ivas->sba_order = st_ivas->bit_stream[*num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[*num_bits_read]; *num_bits_read += SBA_ORDER_BITS; +#ifndef FIX_1209_SID_SIGNALING if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = SBA_FOA_ORDER; } +#endif } /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 48a3286a4e..c4ad5e3c9c 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -161,9 +161,11 @@ void ivas_write_format_sid( case ISM_FORMAT: ind = SID_ISM; break; +#ifndef FIX_1209_SID_SIGNALING case MC_FORMAT: ind = SID_MULTICHANNEL; break; +#endif case SBA_FORMAT: switch ( element_mode ) { -- GitLab From d556e14db2ad024777824765c5b4d1ee3808e3cc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Oct 2024 16:16:57 +0200 Subject: [PATCH 2/5] fix SID first case --- lib_dec/ivas_init_dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b624244afe..21fc21b827 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1082,7 +1082,9 @@ static ivas_error ivas_read_format( st_ivas->sba_order = st_ivas->bit_stream[*num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[*num_bits_read]; *num_bits_read += SBA_ORDER_BITS; -#ifndef FIX_1209_SID_SIGNALING +#ifdef FIX_1209_SID_SIGNALING + st_ivas->sba_analysis_order = SBA_FOA_ORDER; /* Hard coding as DTX is supported with FOA analysis order only */ +#else if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = SBA_FOA_ORDER; -- GitLab From 67f238f0f28718c768eaf4641520d84c053b8d35 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Oct 2024 16:29:25 +0200 Subject: [PATCH 3/5] rename FIX_1209_SID_SIGNALING to NONBE_FIX_1209_SID_SIGNALING --- lib_com/ivas_cnst.h | 2 +- lib_com/options.h | 2 +- lib_dec/ivas_init_dec.c | 8 ++++---- lib_enc/ivas_init_enc.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4e6ad47f24..e1614d8d58 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -233,7 +233,7 @@ typedef enum #define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */ #define SID_ISM 0x2 /* 0| 1| 0 */ #define SID_MASA_1TC 0x3 /* 1| 1| 0 */ -#ifdef FIX_1209_SID_SIGNALING +#ifdef NONBE_FIX_1209_SID_SIGNALING /*reserved*/ /*0x4*/ /* 0| 0| 1 */ #else #define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */ diff --git a/lib_com/options.h b/lib_com/options.h index caaaa5a1ac..4c5a8dd5ef 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define FIX_587_DEFAULT_REVERB /* Philips: issue 587: inconsistent default reverb parameters across renderers */ #define FIX_HRTF_LOAD /* VA: issue 1187: fix memory issue when HRTFs are loaded from a binary file */ -#define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ /* #################### End BE switches ################################## */ @@ -187,6 +186,7 @@ #define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ #define FIX_1206_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */ +#define NONBE_FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 21fc21b827..7fd4356ebe 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1037,7 +1037,7 @@ static ivas_error ivas_read_format( case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; break; -#ifndef FIX_1209_SID_SIGNALING +#ifndef NONBE_FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; break; @@ -1066,7 +1066,7 @@ static ivas_error ivas_read_format( } break; default: -#ifndef FIX_1209_SID_SIGNALING +#ifndef NONBE_FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); @@ -1082,8 +1082,8 @@ static ivas_error ivas_read_format( st_ivas->sba_order = st_ivas->bit_stream[*num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[*num_bits_read]; *num_bits_read += SBA_ORDER_BITS; -#ifdef FIX_1209_SID_SIGNALING - st_ivas->sba_analysis_order = SBA_FOA_ORDER; /* Hard coding as DTX is supported with FOA analysis order only */ +#ifdef NONBE_FIX_1209_SID_SIGNALING + st_ivas->sba_analysis_order = SBA_FOA_ORDER; /* Hard coded DTX is supported with FOA analysis order only */ #else if ( st_ivas->sba_analysis_order == 0 ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index c4ad5e3c9c..df838f770b 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -161,7 +161,7 @@ void ivas_write_format_sid( case ISM_FORMAT: ind = SID_ISM; break; -#ifndef FIX_1209_SID_SIGNALING +#ifndef NONBE_FIX_1209_SID_SIGNALING case MC_FORMAT: ind = SID_MULTICHANNEL; break; -- GitLab From c4ecfad0395c9b393cc0fcf3e8980d80c7165e9d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 24 Oct 2024 16:46:42 +0200 Subject: [PATCH 4/5] propagate error code from ivas_read_format() --- lib_dec/ivas_init_dec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7fd4356ebe..3dd7ccedc5 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -109,6 +109,9 @@ ivas_error ivas_dec_get_format( int32_t ivas_total_brate; uint16_t *bit_stream_orig; AUDIO_CONFIG signaled_config; +#ifdef NONBE_FIX_1209_SID_SIGNALING + ivas_error error; +#endif num_bits_read = 0; element_mode_flag = 0; @@ -120,7 +123,14 @@ ivas_error ivas_dec_get_format( * Read IVAS format *-------------------------------------------------------------------*/ +#ifdef NONBE_FIX_1209_SID_SIGNALING + if ( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) + { + return error; + } +#else ivas_read_format( st_ivas, &num_bits_read ); +#endif if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format != st_ivas->last_ivas_format && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_ISM_FORMAT ) && @@ -485,7 +495,14 @@ ivas_error ivas_dec_setup( * Read IVAS format *-------------------------------------------------------------------*/ +#ifdef NONBE_FIX_1209_SID_SIGNALING + if ( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) + { + return error; + } +#else ivas_read_format( st_ivas, &num_bits_read ); +#endif /*-------------------------------------------------------------------* * Read other signling (ISM/MC mode, number of channels, etc.) -- GitLab From 043d817c7b95f6b239d8baf2b2b6901915a6731c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 31 Oct 2024 10:13:20 +0100 Subject: [PATCH 5/5] revert 'sba_analysis_order' change --- lib_dec/ivas_init_dec.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3dd7ccedc5..cc0d528b62 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1099,14 +1099,10 @@ static ivas_error ivas_read_format( st_ivas->sba_order = st_ivas->bit_stream[*num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[*num_bits_read]; *num_bits_read += SBA_ORDER_BITS; -#ifdef NONBE_FIX_1209_SID_SIGNALING - st_ivas->sba_analysis_order = SBA_FOA_ORDER; /* Hard coded DTX is supported with FOA analysis order only */ -#else if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = SBA_FOA_ORDER; } -#endif } /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ -- GitLab