From ebbdf2d19edd3495147b052438eca4d4f80275e8 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 12:13:53 +0100 Subject: [PATCH 01/44] make OSBA X-over BR configurable with IVAS_OSBA_DISCRETE_ISM_MIN_BR --- lib_com/ivas_cnst.h | 4 +++- lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 5 ++++- lib_dec/ivas_sba_dec.c | 6 +++++- lib_enc/ivas_init_enc.c | 6 +++++- lib_enc/ivas_osba_enc.c | 6 +++++- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4960db4712..609b4f9901 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -363,7 +363,9 @@ typedef enum #define ISM_DTX_ELE_BITS_LOW 5 #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) - +#ifdef NONBE_FIX_ISM_XOVER_BR +#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_256k +#endif /* ISM modes */ typedef enum { diff --git a/lib_com/options.h b/lib_com/options.h index e0c9fae45c..2eaaf77a2e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,6 +167,7 @@ /* all switches in this category should start with "NONBE_" */ #define NONBE_FIX_1021_ISM_BRIR_RS_FLUSH /* FhG: issue #1021: fix ISM with JBM and RS renderer flushing*/ +#define NONBE_FIX_ISM_XOVER_BR /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b92dc19ded..7e02de680f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -509,8 +509,11 @@ ivas_error ivas_dec_setup( st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; } } - +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate >= IVAS_256k ) +#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index af102dd96e..3f89ac35c1 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -143,8 +143,12 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate >= IVAS_256k ) - { +#endif + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } else diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index a394f16090..d0b5165d84 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -674,8 +674,12 @@ ivas_error ivas_init_encoder( { st_ivas->ism_mode = ISM_MODE_NONE; +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate >= IVAS_256k ) - { +#endif + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index a2b857b9d8..aa77622b9a 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -197,8 +197,12 @@ ivas_error ivas_osba_enc_reconfig( spar_reconfig_flag = 0; old_ism_mode = st_ivas->ism_mode; +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate >= IVAS_256k ) - { +#endif + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } else -- GitLab From 689b45c18df4e9ca420c6499ac6c68fa1b550844 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 15:54:05 +0100 Subject: [PATCH 02/44] replace another instance of the hard-coded x-over BR --- lib_dec/ivas_init_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7e02de680f..f916cbfb88 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -480,7 +480,11 @@ ivas_error ivas_dec_setup( num_bits_read += SBA_ORDER_BITS; /* read Ambisonic (SBA) order */ +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate < IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate < IVAS_256k ) +#endif { st_ivas->sba_order = 3; } -- GitLab From 1605011e8f11bb95c3ec8d046978200847a77598 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 16:13:46 +0100 Subject: [PATCH 03/44] set OSBA x-over BR to 80 kbps --- lib_com/ivas_cnst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 609b4f9901..15071094c1 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -364,7 +364,7 @@ typedef enum #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) #ifdef NONBE_FIX_ISM_XOVER_BR -#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_256k +#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_80k #endif /* ISM modes */ typedef enum -- GitLab From 3374e9557cea11e89287f24b17a9cec0d34d7b08 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 09:58:37 +0100 Subject: [PATCH 04/44] replace fixed by variable x-over BR in format signaling --- lib_dec/ivas_init_dec.c | 6 +++++- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_mct_core_enc.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f916cbfb88..ace0cff586 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -468,7 +468,11 @@ ivas_error ivas_dec_setup( /* the number of objects is written at the end of the bitstream, in the SBA metadata */ st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) +#endif { /* read Ambisonic (SBA) planar flag */ st_ivas->sba_planar = st_ivas->bit_stream[num_bits_read]; @@ -481,7 +485,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_total_brate < IVAS_OSBA_DISCRETE_ISM_MIN_BR ) #else if ( ivas_total_brate < IVAS_256k ) #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3f89ac35c1..feb99dc2e4 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -148,7 +148,7 @@ ivas_error ivas_sba_dec_reconfigure( #else if ( ivas_total_brate >= IVAS_256k ) #endif - { + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } else diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 8705d94c64..1f22b05e44 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -497,7 +497,11 @@ void ivas_mct_core_enc( { nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; - if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ivas_format == SBA_ISM_FORMAT || ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) +#else + if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) +#endif { nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; } -- GitLab From 21f072571dab14b5e8d2e5f8bd6caa79f1668104 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 10:43:50 +0100 Subject: [PATCH 05/44] fix formula for nCPE at all OSBA bitrates --- lib_dec/ivas_init_dec.c | 28 +++++++++++++++++++++++----- lib_dec/ivas_sba_dec.c | 22 ++++++++++++++++++++-- lib_enc/ivas_init_enc.c | 14 +++++++++++--- lib_enc/ivas_osba_enc.c | 22 ++++++++++++++++++++-- 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ace0cff586..8d9193e4b0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -324,7 +324,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); + k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -514,7 +514,16 @@ ivas_error ivas_dec_setup( /*correct number of CPEs for discrete ISM coding*/ if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n; + + n = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n / 2 ) + ( n % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; +#endif } } #ifdef NONBE_FIX_ISM_XOVER_BR @@ -657,7 +666,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; + k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -678,7 +687,7 @@ ivas_error ivas_dec_setup( { k -= nchan_ism; /* SID metadata flags */ idx = st_ivas->bit_stream[k]; - st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); + st_ivas->ism_mode = ( ISM_MODE )( idx + 1 ); } if ( st_ivas->ini_frame == 0 ) @@ -1427,7 +1436,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); @@ -1582,7 +1591,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } @@ -1598,7 +1607,16 @@ ivas_error ivas_init_decoder( if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; +#endif st_ivas->element_mode_init = IVAS_CPE_MDCT; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index feb99dc2e4..8544558001 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -515,8 +515,17 @@ ivas_error ivas_sba_dec_reconfigure( return error; } +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; - } +#endif + } else if ( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { /* ISM renderer handle */ @@ -538,8 +547,17 @@ ivas_error ivas_sba_dec_reconfigure( } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; - nCPE_old = st_ivas->nCPE; +#endif + nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->nchan_ism; } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index d0b5165d84..31b15daacb 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -678,8 +678,8 @@ ivas_error ivas_init_encoder( if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) #else if ( ivas_total_brate >= IVAS_256k ) -#endif - { +#endif + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } @@ -736,8 +736,16 @@ ivas_error ivas_init_encoder( else { /* allocate and initialize MCT core coder */ - st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else + st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; +#endif for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index aa77622b9a..f4578ebf73 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -340,16 +340,34 @@ ivas_error ivas_osba_enc_reconfig( if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; - } +#endif + } else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + } +#else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; - nCPE_old = st_ivas->nCPE; +#endif + nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; } -- GitLab From 12087c543081297e217352fdb96a865a1e4d6d82 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 11:50:42 +0100 Subject: [PATCH 06/44] set x-over BR to 256 kbps for testing --- lib_com/ivas_cnst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 15071094c1..609b4f9901 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -364,7 +364,7 @@ typedef enum #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) #ifdef NONBE_FIX_ISM_XOVER_BR -#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_80k +#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_256k #endif /* ISM modes */ typedef enum -- GitLab From ec77972c8dded964ebc0626808da51f67e25aba3 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 12:07:25 +0100 Subject: [PATCH 07/44] fix formatting --- lib_dec/ivas_init_dec.c | 10 +++++----- lib_dec/ivas_sba_dec.c | 4 ++-- lib_enc/ivas_mct_core_enc.c | 2 +- lib_enc/ivas_osba_enc.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 8d9193e4b0..1dcee15435 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -324,7 +324,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); + k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -666,7 +666,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; + k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -687,7 +687,7 @@ ivas_error ivas_dec_setup( { k -= nchan_ism; /* SID metadata flags */ idx = st_ivas->bit_stream[k]; - st_ivas->ism_mode = ( ISM_MODE )( idx + 1 ); + st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); } if ( st_ivas->ini_frame == 0 ) @@ -1436,7 +1436,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); @@ -1591,7 +1591,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 8544558001..89f2d0c7b4 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -525,7 +525,7 @@ ivas_error ivas_sba_dec_reconfigure( #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif - } + } else if ( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { /* ISM renderer handle */ @@ -557,7 +557,7 @@ ivas_error ivas_sba_dec_reconfigure( #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif - nCPE_old = st_ivas->nCPE; + nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->nchan_ism; } diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 1f22b05e44..47f3787632 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -500,7 +500,7 @@ void ivas_mct_core_enc( #ifdef NONBE_FIX_ISM_XOVER_BR if ( ivas_format == SBA_ISM_FORMAT || ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) #else - if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) + if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) #endif { nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index f4578ebf73..a0d1dd4b0f 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -202,7 +202,7 @@ ivas_error ivas_osba_enc_reconfig( #else if ( ivas_total_brate >= IVAS_256k ) #endif - { + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } else @@ -350,7 +350,7 @@ ivas_error ivas_osba_enc_reconfig( #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; #endif - } + } else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; @@ -367,7 +367,7 @@ ivas_error ivas_osba_enc_reconfig( #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; #endif - nCPE_old = st_ivas->nCPE; + nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; } -- GitLab From 7c293a901d31dc855f421c3e99a3a6a315bee2ed Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 13:47:58 +0100 Subject: [PATCH 08/44] fix condition to subtract planar bit from available bits in MCT core enc --- lib_enc/ivas_mct_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 47f3787632..9bf40467a9 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -498,7 +498,7 @@ void ivas_mct_core_enc( nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_format == SBA_ISM_FORMAT || ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_format == SBA_ISM_FORMAT && ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR || ivas_total_brate < IVAS_24k4 ) ) #else if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) #endif -- GitLab From c872fd0a3676561aee06c02c1fa05bf4b7b054e7 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 30 Jan 2024 16:54:05 +0100 Subject: [PATCH 09/44] move OSBA method decission to the new function ivas_osba_ism_mode_select --- Workspace_msvc/lib_com.vcxproj | 3 ++- Workspace_msvc/lib_com.vcxproj.filters | 3 +++ lib_com/ivas_cnst.h | 4 +--- lib_com/ivas_prot.h | 9 ++++++++- lib_dec/ivas_init_dec.c | 6 +++--- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 6 +++++- lib_enc/ivas_mct_enc.c | 7 ++++++- lib_enc/ivas_osba_enc.c | 2 +- 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index d11b9087ee..decc09705d 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -275,6 +275,7 @@ + @@ -308,4 +309,4 @@ - + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index a719959802..c543174067 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -469,6 +469,9 @@ common_ivas_c + + common_ivas_c + diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 609b4f9901..4960db4712 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -363,9 +363,7 @@ typedef enum #define ISM_DTX_ELE_BITS_LOW 5 #define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) #define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) -#ifdef NONBE_FIX_ISM_XOVER_BR -#define IVAS_OSBA_DISCRETE_ISM_MIN_BR IVAS_256k -#endif + /* ISM modes */ typedef enum { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a191d1bf39..33d9bacbe6 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3018,6 +3018,10 @@ void ivas_mct_core_enc( const int16_t switch_bw, /* i : flag bandwidth switch occurance */ const int16_t lfe_bits, /* i : bits spent for LFE */ const int16_t sba_order /* i : Ambisonic (SBA) order */ +#ifdef NONBE_FIX_ISM_XOVER_BR + , + const int16_t nchan_ism /* i : number of input ISM's */ +#endif ); void ivas_mdct_quant_coder( @@ -5619,7 +5623,10 @@ void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); - +int16_t ivas_osba_ism_mode_select( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism /* i : number of input ISM's */ +); /*----------------------------------------------------------------------------------* * OMASA prototypes *---------------------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1dcee15435..86aa67c39c 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -469,7 +469,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_total_brate < IVAS_24k4 || ivas_osba_ism_mode_select(ivas_total_brate,st_ivas->nchan_ism) ) #else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) #endif @@ -485,7 +485,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( !ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) #else if ( ivas_total_brate < IVAS_256k ) #endif @@ -527,7 +527,7 @@ ivas_error ivas_dec_setup( } } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_osba_ism_mode_select(ivas_total_brate,st_ivas->nchan_ism) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 89f2d0c7b4..b8e827259e 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -144,7 +144,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 31b15daacb..9f1891a35e 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -675,7 +675,7 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ISM_MODE_NONE; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 9bf40467a9..b9afc1b7c4 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -191,6 +191,10 @@ void ivas_mct_core_enc( const int16_t switch_bw, /* i : flag bandwidth switch occurance */ const int16_t lfe_bits, /* i : bits spent for LFE */ const int16_t sba_order /* i : Ambisonic (SBA) order */ +#ifdef NONBE_FIX_ISM_XOVER_BR + , + const int16_t nchan_ism /* i : number of input ISM's */ +#endif ) { int16_t ch, ch_core, nSubframes, L_subframeTCX; @@ -498,7 +502,7 @@ void ivas_mct_core_enc( nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_format == SBA_ISM_FORMAT && ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR || ivas_total_brate < IVAS_24k4 ) ) + if ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) || ivas_total_brate < IVAS_24k4 ) ) #else if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 83c5f57c17..9b5762856b 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -248,7 +248,12 @@ ivas_error ivas_mct_enc( } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order +#ifdef NONBE_FIX_ISM_XOVER_BR + , + st_ivas->hEncoderConfig->nchan_ism +#endif + ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index a0d1dd4b0f..4bf4d88e28 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -198,7 +198,7 @@ ivas_error ivas_osba_enc_reconfig( spar_reconfig_flag = 0; old_ism_mode = st_ivas->ism_mode; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate >= IVAS_OSBA_DISCRETE_ISM_MIN_BR ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif -- GitLab From e17878d4d7e30eb8b768f19944b0f01434fa32a9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 30 Jan 2024 17:48:20 +0100 Subject: [PATCH 10/44] fix formatting --- lib_dec/ivas_init_dec.c | 4 ++-- lib_enc/ivas_mct_core_enc.c | 2 +- lib_enc/ivas_mct_enc.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 86aa67c39c..8662c0c7a4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -469,7 +469,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_24k4 || ivas_osba_ism_mode_select(ivas_total_brate,st_ivas->nchan_ism) ) + if ( ivas_total_brate < IVAS_24k4 || ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) #else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) #endif @@ -527,7 +527,7 @@ ivas_error ivas_dec_setup( } } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select(ivas_total_brate,st_ivas->nchan_ism) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index b9afc1b7c4..451d4fce90 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -193,7 +193,7 @@ void ivas_mct_core_enc( const int16_t sba_order /* i : Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR , - const int16_t nchan_ism /* i : number of input ISM's */ + const int16_t nchan_ism /* i : number of input ISM's */ #endif ) { diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 9b5762856b..f35ffa810f 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -253,7 +253,7 @@ ivas_error ivas_mct_enc( , st_ivas->hEncoderConfig->nchan_ism #endif - ); + ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) -- GitLab From 03dcf33bd7ec6249c720424c674769fdaa41e9e6 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 08:52:02 +0100 Subject: [PATCH 11/44] add new file lib_com/ivas_osba_com.c --- lib_com/ivas_osba_com.c | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 lib_com/ivas_osba_com.c diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c new file mode 100644 index 0000000000..72073bcdb1 --- /dev/null +++ b/lib_com/ivas_osba_com.c @@ -0,0 +1,83 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "options.h" +#include "ivas_cnst.h" +#include "ivas_prot.h" +#include "prot.h" +#include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif + +/*! r : ISM format mode */ +int16_t ivas_osba_ism_mode_select( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism /* i : number of input ISM's */ +) +{ + int16_t ism_mode = 0; + + switch ( nchan_ism ) + { + case 1: + if ( ivas_total_brate >= IVAS_256k ) + { + ism_mode = 1; + } + break; + case 2: + if ( ivas_total_brate >= IVAS_256k ) + { + ism_mode = 1; + } + break; + case 3: + if ( ivas_total_brate >= IVAS_256k ) + { + ism_mode = 1; + } + break; + case 4: + if ( ivas_total_brate >= IVAS_256k ) + { + ism_mode = 1; + } + break; + } + + return ism_mode; +} + + + + -- GitLab From 373f34b8ce8c9a6052efd7462b7554ef3ba4fb74 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 09:08:53 +0100 Subject: [PATCH 12/44] fix path to ivas_osba_com.c in the Visual Studio project files --- Workspace_msvc/lib_com.vcxproj | 2 +- Workspace_msvc/lib_com.vcxproj.filters | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index decc09705d..994e336f61 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -205,6 +205,7 @@ + @@ -275,7 +276,6 @@ - diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index c543174067..ba58ea201f 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -469,7 +469,7 @@ common_ivas_c - + common_ivas_c -- GitLab From 948efd5bf7df261760d8fbfe6129a874b81e2db5 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 09:18:23 +0100 Subject: [PATCH 13/44] fix formatting --- lib_com/ivas_osba_com.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c index 72073bcdb1..4bac48c61d 100644 --- a/lib_com/ivas_osba_com.c +++ b/lib_com/ivas_osba_com.c @@ -77,7 +77,3 @@ int16_t ivas_osba_ism_mode_select( return ism_mode; } - - - - -- GitLab From 6df6fc97e6dc4c9eb4da5fd1bf40c5d0d29dc794 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 21 Mar 2024 09:17:40 +0100 Subject: [PATCH 14/44] change x-over bitrates in ivas_osba_ism_mode_select --- lib_com/ivas_osba_com.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c index 4bac48c61d..b59193561d 100644 --- a/lib_com/ivas_osba_com.c +++ b/lib_com/ivas_osba_com.c @@ -50,25 +50,25 @@ int16_t ivas_osba_ism_mode_select( switch ( nchan_ism ) { case 1: - if ( ivas_total_brate >= IVAS_256k ) + if ( ivas_total_brate >= IVAS_96k ) { ism_mode = 1; } break; case 2: - if ( ivas_total_brate >= IVAS_256k ) + if ( ivas_total_brate >= IVAS_128k ) { ism_mode = 1; } break; case 3: - if ( ivas_total_brate >= IVAS_256k ) + if ( ivas_total_brate >= IVAS_128k ) { ism_mode = 1; } break; case 4: - if ( ivas_total_brate >= IVAS_256k ) + if ( ivas_total_brate >= IVAS_128k ) { ism_mode = 1; } -- GitLab From c2338f1883b426f8b024cd6f1a263bcb4ce7309c Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 21 Mar 2024 11:19:00 +0100 Subject: [PATCH 15/44] fix crash fix bitrate switching --- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_osba_enc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index b8e827259e..40f322ae51 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -556,10 +556,10 @@ ivas_error ivas_sba_dec_reconfigure( } #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; -#endif nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->nchan_ism; +#endif } } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 4bf4d88e28..19fc5f8074 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -366,10 +366,10 @@ ivas_error ivas_osba_enc_reconfig( } #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; -#endif nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; +#endif } if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) -- GitLab From 41966a71b64b6df4369b1526d648eda42f9343f9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 08:29:46 +0100 Subject: [PATCH 16/44] fix bit calculation in MCT debugging assert --- lib_enc/ivas_mct_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 451d4fce90..3341db7243 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -582,7 +582,7 @@ void ivas_mct_core_enc( #ifdef DEBUGGING format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); - format_bits += ( ivas_format == SBA_ISM_FORMAT && nChannels > FOA_CHANNELS ); + format_bits += ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) || ivas_total_brate < IVAS_24k4 ) ); mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif -- GitLab From 6a7dca9f97399cedf69df22871cc8d50a57cc7bc Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 09:07:30 +0100 Subject: [PATCH 17/44] fix encoder side bitrate calculation --- lib_enc/ivas_osba_enc.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 19fc5f8074..4f3757b573 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -181,6 +181,9 @@ ivas_error ivas_osba_enc_reconfig( int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t n_all, n_all_old; +#endif error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; @@ -212,6 +215,9 @@ ivas_error ivas_osba_enc_reconfig( nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; +#ifdef NONBE_FIX_ISM_XOVER_BR + n_all_old = nchan_transport_old + st_ivas->hEncoderConfig->nchan_ism; +#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands; @@ -338,32 +344,31 @@ ivas_error ivas_osba_enc_reconfig( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ +#ifdef NONBE_FIX_ISM_XOVER_BR + n_all = st_ivas->nchan_transport; +#endif if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; - - n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); - } + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; #endif } else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + n_all = st_ivas->nchan_transport; +#else nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; +#endif } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; - - n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); - } + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; nCPE_old = st_ivas->nCPE; @@ -372,7 +377,7 @@ ivas_error ivas_osba_enc_reconfig( #endif } - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate /n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 67f02ef022b018210c3780b44c2ea96b65029fac Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 10:42:15 +0100 Subject: [PATCH 18/44] fix decoder-side bitrate switching in OSBA --- lib_dec/ivas_corecoder_dec_reconfig.c | 8 ++++++-- lib_dec/ivas_sba_dec.c | 29 +++++++++++++-------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index fd7ce6c803..b4c2570f90 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -73,7 +73,7 @@ ivas_error ivas_corecoder_dec_reconfig( hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; - output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + output_frame = ( int16_t )( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); error = IVAS_ERR_OK; if ( st_ivas->ivas_format == MC_FORMAT ) @@ -258,7 +258,7 @@ ivas_error ivas_corecoder_dec_reconfig( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[0]->hCoreCoder[n]->total_brate = st_ivas->hCPE[0]->element_brate; - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); + st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = ( int16_t )( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); st_ivas->hCPE[0]->hCoreCoder[n]->igf = 0; } } @@ -270,7 +270,11 @@ ivas_error ivas_corecoder_dec_reconfig( } else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ( error = mct_dec_reconfigure( st_ivas, nchan_transport_real != nchan_transport_old ) ) != IVAS_ERR_OK ) +#else if ( ( error = mct_dec_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 40f322ae51..7b3896ca5f 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -124,6 +124,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_error error; ISM_MODE ism_mode_old; int16_t granularity_new; + int16_t n_all; ism_mode_old = st_ivas->ism_mode; hDecoderConfig = st_ivas->hDecoderConfig; @@ -453,7 +454,7 @@ ivas_error ivas_sba_dec_reconfigure( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - + n_all = st_ivas->nchan_transport; if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) @@ -516,12 +517,8 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; - - n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); - } + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif @@ -542,18 +539,18 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hHrtfTD = NULL; } } +#ifdef NONBE_FIX_ISM_XOVER_BR + n_all = st_ivas->nchan_transport; +#endif nchan_transport_old += st_ivas->nchan_ism; - st_ivas->ism_mode = ISM_MODE_NONE; + + st_ivas->ism_mode = ISM_MODE_NONE; } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; - - n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); - } + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; nCPE_old = st_ivas->nCPE; @@ -563,7 +560,9 @@ ivas_error ivas_sba_dec_reconfigure( } } - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, + sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, + ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From b4c733387338daa1a48f2fd7d5e0bca960287648 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 10:50:54 +0100 Subject: [PATCH 19/44] fix formatting --- lib_dec/ivas_corecoder_dec_reconfig.c | 4 ++-- lib_dec/ivas_sba_dec.c | 8 ++++---- lib_enc/ivas_osba_enc.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index b4c2570f90..0104cab91e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -73,7 +73,7 @@ ivas_error ivas_corecoder_dec_reconfig( hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; - output_frame = ( int16_t )( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); error = IVAS_ERR_OK; if ( st_ivas->ivas_format == MC_FORMAT ) @@ -258,7 +258,7 @@ ivas_error ivas_corecoder_dec_reconfig( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[0]->hCoreCoder[n]->total_brate = st_ivas->hCPE[0]->element_brate; - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = ( int16_t )( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); + st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); st_ivas->hCPE[0]->hCoreCoder[n]->igf = 0; } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 7b3896ca5f..e45b12348a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -544,7 +544,7 @@ ivas_error ivas_sba_dec_reconfigure( #endif nchan_transport_old += st_ivas->nchan_ism; - st_ivas->ism_mode = ISM_MODE_NONE; + st_ivas->ism_mode = ISM_MODE_NONE; } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { @@ -560,9 +560,9 @@ ivas_error ivas_sba_dec_reconfigure( } } - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, - sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, - ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, + sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, + ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 4f3757b573..1d13c37808 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -377,7 +377,7 @@ ivas_error ivas_osba_enc_reconfig( #endif } - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate /n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate / n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 3108fa05dbc07da4b884e2a6a0cc5b405c4042c0 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 10:55:03 +0100 Subject: [PATCH 20/44] encapsulate all changes into ifdefs --- lib_dec/ivas_sba_dec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index e45b12348a..8cce329cfc 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -124,7 +124,9 @@ ivas_error ivas_sba_dec_reconfigure( ivas_error error; ISM_MODE ism_mode_old; int16_t granularity_new; +#ifdef NONBE_FIX_ISM_XOVER_BR int16_t n_all; +#endif ism_mode_old = st_ivas->ism_mode; hDecoderConfig = st_ivas->hDecoderConfig; @@ -429,7 +431,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); if ( st_ivas->hDirAC ) @@ -454,7 +456,9 @@ ivas_error ivas_sba_dec_reconfigure( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ +#ifdef NONBE_FIX_ISM_XOVER_BR n_all = st_ivas->nchan_transport; +#endif if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) @@ -734,7 +738,7 @@ void ivas_sba_dec_digest_tc( float *decorr_signal[BINAURAL_CHANNELS]; float *p_tc[2 * BINAURAL_CHANNELS]; - default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + default_frame = ( int16_t )( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); nSamplesLeftForTD = nSamplesForRendering; for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) -- GitLab From d9ec2b7afbb6a52a13e4c9969234c07ad6de3f10 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 11:05:15 +0100 Subject: [PATCH 21/44] fix formatting --- lib_dec/ivas_sba_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 8cce329cfc..f107015d58 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -431,7 +431,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); if ( st_ivas->hDirAC ) @@ -738,7 +738,7 @@ void ivas_sba_dec_digest_tc( float *decorr_signal[BINAURAL_CHANNELS]; float *p_tc[2 * BINAURAL_CHANNELS]; - default_frame = ( int16_t )( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); nSamplesLeftForTD = nSamplesForRendering; for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) -- GitLab From 1d0d0ea45920fe1b71f936cc5de106a15cd56c97 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 13:40:54 +0100 Subject: [PATCH 22/44] fix uninitialized memory in OSBA encoder with bitrate switching --- lib_enc/ivas_osba_enc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 1d13c37808..6f22646fae 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -122,7 +122,7 @@ ivas_error ivas_osba_enc_open( hOSba->input_data_mem[i] = NULL; } - input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); + input_frame = ( int16_t )( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); for ( i = 0; i < input_frame; i++ ) { hOSba->interpolator[i] = ( (float) i ) / ( (float) input_frame ); @@ -216,7 +216,18 @@ ivas_error ivas_osba_enc_reconfig( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; #ifdef NONBE_FIX_ISM_XOVER_BR - n_all_old = nchan_transport_old + st_ivas->hEncoderConfig->nchan_ism; + if ( old_ism_mode == ISM_MODE_NONE ) + { + n_all_old = nchan_transport_old; + } + else if ( old_ism_mode == ISM_SBA_MODE_DISC ) + { + n_all_old = nchan_transport_old + st_ivas->hEncoderConfig->nchan_ism; + } + else + { + assert( 0 && "This should not happen!" ); + } #endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); -- GitLab From b08a9d792d2a57c00d97dcff8b655c8423106cb5 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 14:36:23 +0100 Subject: [PATCH 23/44] fix cases with switches where the number of TCs for SBA and objects is unchanged --- lib_enc/ivas_corecoder_enc_reconfig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index be39e263b9..c7768972f6 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -446,7 +446,11 @@ ivas_error ivas_corecoder_enc_reconfig( } else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( ( error = mct_enc_reconfigure( st_ivas, nchan_transport_old_real != nchan_transport_real ) ) != IVAS_ERR_OK ) +#else if ( ( error = mct_enc_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) +#endif { return error; } -- GitLab From feccc37a8a8f5199f6027d3daadc953e07d182b6 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 14:42:20 +0100 Subject: [PATCH 24/44] fix formatting --- lib_enc/ivas_osba_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 6f22646fae..e5f0fe4ecc 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -122,7 +122,7 @@ ivas_error ivas_osba_enc_open( hOSba->input_data_mem[i] = NULL; } - input_frame = ( int16_t )( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); + input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); for ( i = 0; i < input_frame; i++ ) { hOSba->interpolator[i] = ( (float) i ) / ( (float) input_frame ); -- GitLab From 4b1d974918fcf85d7e796f7239660cd02d1b1dcb Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 14:49:25 +0100 Subject: [PATCH 25/44] fix windows compiler warning --- lib_enc/ivas_osba_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index e5f0fe4ecc..ee28ac90ca 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -182,7 +182,7 @@ ivas_error ivas_osba_enc_reconfig( ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t n_all, n_all_old; + int16_t n_all, n_all_old = 0; #endif error = IVAS_ERR_OK; -- GitLab From 254009389aed466ba3698b1365ddea72d48ec539 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 22 Mar 2024 16:51:48 +0100 Subject: [PATCH 26/44] disable NONBE_FIX_ISM_XOVER_BR --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b71781aa23..4ab65a9e67 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,7 @@ #define NONBE_FIX_1021_ISM_BRIR_RS_FLUSH /* FhG: issue #1021: fix ISM with JBM and RS renderer flushing*/ #define NONBE_FIX_1034_DRY_MASA_RATIOS /* Nokia: Fix issue 1034, use of wrong numDir state. */ -#define NONBE_FIX_ISM_XOVER_BR +/*#define NONBE_FIX_ISM_XOVER_BR*/ /* ##################### End NON-BE switches ########################### */ -- GitLab From ffca0a073f1b5e995028e0b563ddbf8a368cdd40 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 08:18:56 +0100 Subject: [PATCH 27/44] fix encapsulation of all changes --- lib_dec/ivas_sba_dec.c | 5 ++++- lib_enc/ivas_mct_core_enc.c | 4 ++++ lib_enc/ivas_osba_enc.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index f107015d58..653a01088c 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -563,10 +563,13 @@ ivas_error ivas_sba_dec_reconfigure( #endif } } - +#ifdef NONBE_FIX_ISM_XOVER_BR if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 3341db7243..9d53324722 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -582,7 +582,11 @@ void ivas_mct_core_enc( #ifdef DEBUGGING format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); +#ifdef NONBE_FIX_ISM_XOVER_BR format_bits += ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) || ivas_total_brate < IVAS_24k4 ) ); +#else + format_bits += ( ivas_format == SBA_ISM_FORMAT && nChannels > FOA_CHANNELS ); +#endif mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index ee28ac90ca..4289adfa5e 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -388,7 +388,11 @@ ivas_error ivas_osba_enc_reconfig( #endif } +#ifdef NONBE_FIX_ISM_XOVER_BR if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate / n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) +#endif { return error; } -- GitLab From e20e713e31df320e1899907ed135e71396d08bf8 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 10:16:40 +0100 Subject: [PATCH 28/44] re-enable NONBE_FIX_ISM_XOVER_BR --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4ab65a9e67..b71781aa23 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,7 @@ #define NONBE_FIX_1021_ISM_BRIR_RS_FLUSH /* FhG: issue #1021: fix ISM with JBM and RS renderer flushing*/ #define NONBE_FIX_1034_DRY_MASA_RATIOS /* Nokia: Fix issue 1034, use of wrong numDir state. */ -/*#define NONBE_FIX_ISM_XOVER_BR*/ +#define NONBE_FIX_ISM_XOVER_BR /* ##################### End NON-BE switches ########################### */ -- GitLab From c60af131e1c5ea549a823be0fc4742e0c85acf5a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 10:55:09 +0100 Subject: [PATCH 29/44] add missing || st_ivas->ivas_format == SBA_ISM_FORMAT --- lib_dec/ivas_corecoder_dec_reconfig.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 0104cab91e..5ec49ef94f 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -354,9 +354,12 @@ ivas_error ivas_corecoder_dec_reconfig( /*-----------------------------------------------------------------* * Set CNA/CNG flags *-----------------------------------------------------------------*/ - +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) +#else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) - { +#endif + { ivas_sba_set_cna_cng_flag( st_ivas ); } -- GitLab From d3d640f55a0d448e9569f718bed30ad79bb16f39 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 13:11:50 +0100 Subject: [PATCH 30/44] fix bitstream mismatch when the x-over BR is set to 256 kbps --- Workspace_msvc/decoder.vcxproj | 1 + Workspace_msvc/encoder.vcxproj | 1 + Workspace_msvc/lib_com.vcxproj | 1 + Workspace_msvc/lib_debug.vcxproj | 1 + Workspace_msvc/lib_dec.vcxproj | 1 + Workspace_msvc/lib_enc.vcxproj | 1 + Workspace_msvc/lib_lc3plus.vcxproj | 1 + Workspace_msvc/lib_rend.vcxproj | 1 + Workspace_msvc/lib_util.vcxproj | 1 + Workspace_msvc/renderer.vcxproj | 1 + lib_com/options.h | 2 +- lib_dec/ivas_corecoder_dec_reconfig.c | 2 +- lib_dec/ivas_sba_dec.c | 6 ++++-- lib_enc/ivas_osba_enc.c | 6 ++++-- scripts/testv/stvOSBA_1ISM_3OA48c.wav | 3 --- 15 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index 2228349d5e..0a3de9b91a 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -83,6 +83,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 309dc15253..45b1d8d6db 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -83,6 +83,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 994e336f61..f8e7f61989 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -73,6 +73,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 5e986bb167..5229874e92 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -69,6 +69,7 @@ Default %(DisableSpecificWarnings) false + true $(OutDir)$(TargetName).lib diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index ea7ad47897..d54c659654 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -83,6 +83,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index aac96693ce..a523a2cb9b 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -83,6 +83,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj index a2e45cb609..29d3858da2 100644 --- a/Workspace_msvc/lib_lc3plus.vcxproj +++ b/Workspace_msvc/lib_lc3plus.vcxproj @@ -73,6 +73,7 @@ OldStyle false false + true Console diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index de8e09d283..3caf5bfb3b 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -83,6 +83,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 80e744c4f1..b3f2ca0505 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -68,6 +68,7 @@ Default %(DisableSpecificWarnings) false + true $(OutDir)$(TargetName).lib diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 83f6afc4dc..e7e16a4171 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -80,6 +80,7 @@ Default %(DisableSpecificWarnings) false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/lib_com/options.h b/lib_com/options.h index b71781aa23..98ad1e3a52 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/*#define DEBUGGING*/ /* Activate debugging part of the code */ +/*#define DEBUGGING*/ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 5ec49ef94f..9344dc42de 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -359,7 +359,7 @@ ivas_error ivas_corecoder_dec_reconfig( #else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) #endif - { + { ivas_sba_set_cna_cng_flag( st_ivas ); } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 653a01088c..bddee5a8d7 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -521,8 +521,10 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + { + int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 ); + } #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 4289adfa5e..3bc0870819 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -361,8 +361,10 @@ ivas_error ivas_osba_enc_reconfig( if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + { + int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 ); + } #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; #endif diff --git a/scripts/testv/stvOSBA_1ISM_3OA48c.wav b/scripts/testv/stvOSBA_1ISM_3OA48c.wav index ec3db290da..e69de29bb2 100644 --- a/scripts/testv/stvOSBA_1ISM_3OA48c.wav +++ b/scripts/testv/stvOSBA_1ISM_3OA48c.wav @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:79178d7cfe0601d5c30573b19718fd15681d6e98f4e54cf54608f35775c28fcc -size 32640908 -- GitLab From fa45e42e1bef72af50aa00e359e620523dd56e78 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 13:40:10 +0100 Subject: [PATCH 31/44] restore corrupted test file scripts/testv/stvOSBA_1ISM_3OA48c.wav --- scripts/testv/stvOSBA_1ISM_3OA48c.wav | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/testv/stvOSBA_1ISM_3OA48c.wav b/scripts/testv/stvOSBA_1ISM_3OA48c.wav index e69de29bb2..ec3db290da 100644 --- a/scripts/testv/stvOSBA_1ISM_3OA48c.wav +++ b/scripts/testv/stvOSBA_1ISM_3OA48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79178d7cfe0601d5c30573b19718fd15681d6e98f4e54cf54608f35775c28fcc +size 32640908 -- GitLab From c2e62d038743447b544ea9f3e3d1a48c119abd84 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 25 Mar 2024 14:08:39 +0100 Subject: [PATCH 32/44] restore original VS project files --- Workspace_msvc/decoder.vcxproj | 1 - Workspace_msvc/encoder.vcxproj | 1 - Workspace_msvc/lib_com.vcxproj | 3 +-- Workspace_msvc/lib_com.vcxproj.filters | 3 --- Workspace_msvc/lib_debug.vcxproj | 1 - Workspace_msvc/lib_dec.vcxproj | 1 - Workspace_msvc/lib_enc.vcxproj | 1 - Workspace_msvc/lib_lc3plus.vcxproj | 1 - Workspace_msvc/lib_rend.vcxproj | 1 - Workspace_msvc/lib_util.vcxproj | 1 - Workspace_msvc/renderer.vcxproj | 1 - 11 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index 0a3de9b91a..2228349d5e 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -83,7 +83,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 45b1d8d6db..309dc15253 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -83,7 +83,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index f8e7f61989..d3fdd9b4bb 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -73,7 +73,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) @@ -310,4 +309,4 @@ - \ No newline at end of file + diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index ba58ea201f..a719959802 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -469,9 +469,6 @@ common_ivas_c - - common_ivas_c - diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 5229874e92..5e986bb167 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -69,7 +69,6 @@ Default %(DisableSpecificWarnings) false - true $(OutDir)$(TargetName).lib diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index d54c659654..ea7ad47897 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -83,7 +83,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index a523a2cb9b..aac96693ce 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -83,7 +83,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj index 29d3858da2..a2e45cb609 100644 --- a/Workspace_msvc/lib_lc3plus.vcxproj +++ b/Workspace_msvc/lib_lc3plus.vcxproj @@ -73,7 +73,6 @@ OldStyle false false - true Console diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 3caf5bfb3b..de8e09d283 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -83,7 +83,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index b3f2ca0505..80e744c4f1 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -68,7 +68,6 @@ Default %(DisableSpecificWarnings) false - true $(OutDir)$(TargetName).lib diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index e7e16a4171..83f6afc4dc 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -80,7 +80,6 @@ Default %(DisableSpecificWarnings) false - true _DEBUG;%(PreprocessorDefinitions) -- GitLab From 4480ea1cd80c107b0cf3c01b476e6ca9322c101a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 27 Mar 2024 10:55:25 +0100 Subject: [PATCH 33/44] reset head-tracking subframe index between SBA and object rendering --- lib_dec/ivas_osba_dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 65e05f78be..13ec5c2c43 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -149,7 +149,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( { return error; } - +#ifdef NONBE_FIX_ISM_XOVER_BR + ivas_combined_orientation_set_to_start_index(st_ivas->hCombinedOrientationData); +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -- GitLab From 69b390142ee9d61e610485bb00b12a77ee274ad5 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 27 Mar 2024 11:36:30 +0100 Subject: [PATCH 34/44] fix formatting --- lib_dec/ivas_osba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 8a27cee282..4b5846cbc2 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -150,7 +150,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( return error; } #ifdef NONBE_FIX_ISM_XOVER_BR - ivas_combined_orientation_set_to_start_index(st_ivas->hCombinedOrientationData); + ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT -- GitLab From b97f2f818468f5be03ecbf60106fd8ece1cd7ca1 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 13:04:48 +0200 Subject: [PATCH 35/44] simplify function ivas_osba_ism_mode_select --- Workspace_msvc/lib_com.vcxproj.filters | 3 +++ lib_com/ivas_osba_com.c | 18 ++++-------------- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_init_dec.c | 6 +++--- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 4 ++-- lib_enc/ivas_osba_enc.c | 2 +- 8 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index a719959802..ba58ea201f 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -469,6 +469,9 @@ common_ivas_c + + common_ivas_c + diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c index b59193561d..e3b997dc36 100644 --- a/lib_com/ivas_osba_com.c +++ b/lib_com/ivas_osba_com.c @@ -40,37 +40,27 @@ #endif /*! r : ISM format mode */ -int16_t ivas_osba_ism_mode_select( +ISM_MODE ivas_osba_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism /* i : number of input ISM's */ ) { - int16_t ism_mode = 0; + ISM_MODE ism_mode = ISM_MODE_NONE; switch ( nchan_ism ) { case 1: if ( ivas_total_brate >= IVAS_96k ) { - ism_mode = 1; + ism_mode = ISM_SBA_MODE_DISC; } break; case 2: - if ( ivas_total_brate >= IVAS_128k ) - { - ism_mode = 1; - } - break; case 3: - if ( ivas_total_brate >= IVAS_128k ) - { - ism_mode = 1; - } - break; case 4: if ( ivas_total_brate >= IVAS_128k ) { - ism_mode = 1; + ism_mode = ISM_SBA_MODE_DISC; } break; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 998ade3c89..c9fae094fe 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5617,7 +5617,7 @@ void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); -int16_t ivas_osba_ism_mode_select( +ISM_MODE ivas_osba_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism /* i : number of input ISM's */ ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 33210b88db..d473f18bd1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -469,7 +469,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_24k4 || ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) + if ( ivas_total_brate < IVAS_24k4 || ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC ) ) #else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) #endif @@ -485,7 +485,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR - if ( !ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) != ISM_SBA_MODE_DISC ) #else if ( ivas_total_brate < IVAS_256k ) #endif @@ -527,7 +527,7 @@ ivas_error ivas_dec_setup( } } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 0e06fc239a..da91343efe 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -147,7 +147,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9f1891a35e..54307f0c01 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -675,7 +675,7 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ISM_MODE_NONE; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) == ISM_SBA_MODE_DISC ) #else if ( ivas_total_brate >= IVAS_256k ) #endif diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 9d53324722..95de7363c5 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -502,7 +502,7 @@ void ivas_mct_core_enc( nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) || ivas_total_brate < IVAS_24k4 ) ) + if ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) == ISM_SBA_MODE_DISC|| ivas_total_brate < IVAS_24k4 ) ) #else if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) #endif @@ -583,7 +583,7 @@ void ivas_mct_core_enc( #ifdef DEBUGGING format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); #ifdef NONBE_FIX_ISM_XOVER_BR - format_bits += ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) || ivas_total_brate < IVAS_24k4 ) ); + format_bits += ( ivas_format == SBA_ISM_FORMAT && ( ivas_osba_ism_mode_select( ivas_total_brate, nchan_ism ) == ISM_SBA_MODE_DISC || ivas_total_brate < IVAS_24k4 ) ); #else format_bits += ( ivas_format == SBA_ISM_FORMAT && nChannels > FOA_CHANNELS ); #endif diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 3bc0870819..51b5fd6b67 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -201,7 +201,7 @@ ivas_error ivas_osba_enc_reconfig( spar_reconfig_flag = 0; old_ism_mode = st_ivas->ism_mode; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) ) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) == ISM_SBA_MODE_DISC ) #else if ( ivas_total_brate >= IVAS_256k ) #endif -- GitLab From 00d5fbaf06eba51396a32fbbf92f8d5e3b9ea0d0 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 13:24:05 +0200 Subject: [PATCH 36/44] style and formatting changes --- lib_com/ivas_osba_com.c | 2 +- lib_com/ivas_prot.h | 7 ++++--- lib_dec/ivas_corecoder_dec_reconfig.c | 1 + lib_dec/ivas_sba_dec.c | 3 ++- lib_enc/ivas_init_enc.c | 1 + lib_enc/ivas_osba_enc.c | 4 ++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c index e3b997dc36..fcb4f8aeac 100644 --- a/lib_com/ivas_osba_com.c +++ b/lib_com/ivas_osba_com.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c9fae094fe..f5390fd843 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3020,10 +3020,11 @@ void ivas_mct_core_enc( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t switch_bw, /* i : flag bandwidth switch occurance */ const int16_t lfe_bits, /* i : bits spent for LFE */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR - , - const int16_t nchan_ism /* i : number of input ISM's */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int16_t nchan_ism /* i : number of input ISM's */ +#else + const int16_t sba_order /* i : Ambisonic (SBA) order */ #endif ); diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 9344dc42de..5f5e787c94 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -354,6 +354,7 @@ ivas_error ivas_corecoder_dec_reconfig( /*-----------------------------------------------------------------* * Set CNA/CNG flags *-----------------------------------------------------------------*/ + #ifdef NONBE_FIX_ISM_XOVER_BR if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) #else diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index da91343efe..fec7b40162 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -147,7 +147,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC ) #else if ( ivas_total_brate >= IVAS_256k ) #endif @@ -577,6 +577,7 @@ ivas_error ivas_sba_dec_reconfigure( #endif } } + #ifdef NONBE_FIX_ISM_XOVER_BR if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 54307f0c01..6558079c64 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -736,6 +736,7 @@ ivas_error ivas_init_encoder( else { /* allocate and initialize MCT core coder */ + #ifdef NONBE_FIX_ISM_XOVER_BR { int16_t n_all; diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 51b5fd6b67..2133c3f123 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -201,10 +201,9 @@ ivas_error ivas_osba_enc_reconfig( spar_reconfig_flag = 0; old_ism_mode = st_ivas->ism_mode; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) == ISM_SBA_MODE_DISC ) + st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); #else if ( ivas_total_brate >= IVAS_256k ) -#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } @@ -212,6 +211,7 @@ ivas_error ivas_osba_enc_reconfig( { st_ivas->ism_mode = ISM_MODE_NONE; } +#endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -- GitLab From 9aac32390e40bfb388d8b22a4afe8b33c68048a7 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 13:35:01 +0200 Subject: [PATCH 37/44] add switch description to options.h --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 43520d7b21..0f225c1ce0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,7 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define NONBE_FIX_ISM_XOVER_BR +#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ #define NONBE_FIX_1045_ISM_BITRATE_SWITCHING /* Eri: Difference between ROM/File HRTF in ISM bitrate switching */ #define NONBE_FIX_1067_QUATERNIONSLERP_INACCURACIES /* Philips: issue 1067: QuaternionSlerp inaccuracies in corner cases */ #define NONBE_FIX_1065_ISM_MD_HANDLE /* VA: issue 1065: Allocate only the necessary number of ISM MD decoder handles. */ -- GitLab From e520e222cd40e598a0eca19a62ac3fc26fae9336 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 14:32:02 +0200 Subject: [PATCH 38/44] fix formatting --- lib_com/ivas_prot.h | 5 ----- lib_dec/ivas_init_dec.c | 44 ++++++++++++++++++------------------- lib_enc/ivas_mct_core_enc.c | 16 +++++--------- lib_enc/ivas_mct_enc.c | 7 +----- 4 files changed, 29 insertions(+), 43 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index da4c57c852..2d063fff0f 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3021,12 +3021,7 @@ void ivas_mct_core_enc( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t switch_bw, /* i : flag bandwidth switch occurance */ const int16_t lfe_bits, /* i : bits spent for LFE */ -#ifdef NONBE_FIX_ISM_XOVER_BR - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int16_t nchan_ism /* i : number of input ISM's */ -#else const int16_t sba_order /* i : Ambisonic (SBA) order */ -#endif ); void ivas_mdct_quant_coder( diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5260e92f78..b0be37aeb3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -300,7 +300,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); + k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -474,7 +474,7 @@ ivas_error ivas_dec_setup( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif { return error; @@ -498,14 +498,14 @@ ivas_error ivas_dec_setup( st_ivas->nCPE = ( n / 2 ) + ( n % 2 ); } #else - st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; + st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif } } #ifdef NONBE_FIX_ISM_XOVER_BR if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC ) #else - if ( ivas_total_brate >= IVAS_256k ) + if ( ivas_total_brate >= IVAS_256k ) #endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; @@ -535,10 +535,10 @@ ivas_error ivas_dec_setup( return error; } #else - if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } #endif } @@ -624,7 +624,7 @@ ivas_error ivas_dec_setup( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif { return error; @@ -642,7 +642,7 @@ ivas_error ivas_dec_setup( /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; - k = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; + k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ) - SID_FORMAT_NBITS; while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { nchan_ism++; @@ -663,7 +663,7 @@ ivas_error ivas_dec_setup( { k -= nchan_ism; /* SID metadata flags */ idx = st_ivas->bit_stream[k]; - st_ivas->ism_mode = ( ISM_MODE )( idx + 1 ); + st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); } if ( st_ivas->ini_frame == 0 ) @@ -674,7 +674,7 @@ ivas_error ivas_dec_setup( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1336,7 +1336,7 @@ ivas_error ivas_init_decoder( #ifdef NONBE_FIX_1065_ISM_MD_HANDLE if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1417,7 +1417,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); @@ -1572,7 +1572,7 @@ ivas_error ivas_init_decoder( st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 ); } @@ -1596,7 +1596,7 @@ ivas_error ivas_init_decoder( st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); } #else - st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; + st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif st_ivas->element_mode_init = IVAS_CPE_MDCT; } @@ -2068,8 +2068,8 @@ ivas_error ivas_init_decoder( if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2541,7 +2541,7 @@ void ivas_initialize_handles_dec( st_ivas->hDiracDecBin[i] = NULL; } #else - st_ivas->hDiracDecBin = NULL; + st_ivas->hDiracDecBin = NULL; #endif st_ivas->hDirACRend = NULL; st_ivas->hSpatParamRendCom = NULL; @@ -2739,7 +2739,7 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); #else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); #endif /* Crend handle */ @@ -2747,7 +2747,7 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); #endif /* Reverb handle */ @@ -2902,7 +2902,7 @@ void ivas_init_dec_get_num_cldfb_instances( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0]->useTdDecorr ) #else - if ( st_ivas->hDiracDecBin->useTdDecorr ) + if ( st_ivas->hDiracDecBin->useTdDecorr ) #endif { *numCldfbAnalyses += 2; diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index b691db8cb0..7c71c5837f 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -80,7 +80,7 @@ static void FindChannelRatio( if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { chRatio = nrg[i] * sum_nrg; - chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, ( uint16_t )( BITRATE_MCT_RATIO_RANGE * chRatio + 0.5f ) ) ); + chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * chRatio + 0.5f ) ) ); } else if ( sts[i]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { @@ -129,7 +129,7 @@ static void AdjustChannelRatios( for ( i = 0; i < nChannels; i++ ) { cur_ratio = temp_brs[i] / sum_ratio; - force_ch_bit_ratios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, ( uint16_t )( BITRATE_MCT_RATIO_RANGE * cur_ratio + 0.5f ) ) ); + force_ch_bit_ratios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * cur_ratio + 0.5f ) ) ); } /* adjust the ratios further based on received chBitRatios[]*/ @@ -147,7 +147,7 @@ static void AdjustChannelRatios( tar_ratio = (float) force_ch_bit_ratios[i] / ( sum_tar_ratio + FLT_MIN ); tar_ratio = min( tar_ratio, cur_ratio ); - chBitRatios[i] = ( int16_t )( tar_ratio * sum_tar_ratio ); + chBitRatios[i] = (int16_t) ( tar_ratio * sum_tar_ratio ); chBitRatios[i] = max( 1, chBitRatios[i] ); assert( chBitRatios[i] < ( BITRATE_MCT_RATIO_RANGE - 1 ) ); ratio_diff += force_ch_bit_ratios[i] - chBitRatios[i]; @@ -169,7 +169,7 @@ static void AdjustChannelRatios( for ( i = 0; i < nChannels; i++ ) { cur_ratio = chBitRatios[i] / sum_ratio; - chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, ( uint16_t )( BITRATE_MCT_RATIO_RANGE * cur_ratio + 0.5f ) ) ); + chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * cur_ratio + 0.5f ) ) ); } return; @@ -191,10 +191,6 @@ void ivas_mct_core_enc( const int16_t switch_bw, /* i : flag bandwidth switch occurance */ const int16_t lfe_bits, /* i : bits spent for LFE */ const int16_t sba_order /* i : Ambisonic (SBA) order */ -#ifdef NONBE_FIX_ISM_XOVER_BR - , - const int16_t nchan_ism /* i : number of input ISM's */ -#endif ) { int16_t ch, ch_core, nSubframes, L_subframeTCX; @@ -277,7 +273,7 @@ void ivas_mct_core_enc( hBstr = sts[0]->hBstr; - for ( ch = 0; ch < ( int16_t )( hMCT->nchan_out_woLFE * 0.5 ); ch++ ) + for ( ch = 0; ch < (int16_t) ( hMCT->nchan_out_woLFE * 0.5 ); ch++ ) { ch_core = ch * CPE_CHANNELS; @@ -488,7 +484,7 @@ void ivas_mct_core_enc( FindChannelRatio( sts, chBitRatios, nChannels ); - nAvailBits = ( int16_t )( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); + nAvailBits = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); /* subtract IVAS format signaling bits */ diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index f35ffa810f..83c5f57c17 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -248,12 +248,7 @@ ivas_error ivas_mct_enc( } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order -#ifdef NONBE_FIX_ISM_XOVER_BR - , - st_ivas->hEncoderConfig->nchan_ism -#endif - ); + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE, ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) -- GitLab From c38cbf11f0f90b084838e39e15e5b34735268d3b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 15:24:06 +0200 Subject: [PATCH 39/44] style and formatting changes --- lib_dec/ivas_osba_dec.c | 1 + lib_dec/ivas_sba_dec.c | 1 + lib_enc/ivas_init_enc.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 971e0ef942..f41674ccfa 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -154,6 +154,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( { return error; } + #ifdef NONBE_FIX_ISM_XOVER_BR ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index fec7b40162..eb97ff3c86 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -456,6 +456,7 @@ ivas_error ivas_sba_dec_reconfigure( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ + #ifdef NONBE_FIX_ISM_XOVER_BR n_all = st_ivas->nchan_transport; #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 6558079c64..870541c816 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -675,13 +675,13 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ISM_MODE_NONE; #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ) == ISM_SBA_MODE_DISC ) + st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); #else if ( ivas_total_brate >= IVAS_256k ) -#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } +#endif if ( ( error = ivas_ism_metadata_enc_create( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) { -- GitLab From bd1e5ef6c3f9493913a55f42c97648a0b040b006 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Apr 2024 16:12:09 +0200 Subject: [PATCH 40/44] style changes --- lib_dec/ivas_sba_dec.c | 1 + lib_enc/ivas_osba_enc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index eb97ff3c86..328a232f5c 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -558,6 +558,7 @@ ivas_error ivas_sba_dec_reconfigure( } #endif } + #ifdef NONBE_FIX_ISM_XOVER_BR n_all = st_ivas->nchan_transport; #endif diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 2133c3f123..25c4752903 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -215,6 +215,7 @@ ivas_error ivas_osba_enc_reconfig( nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; + #ifdef NONBE_FIX_ISM_XOVER_BR if ( old_ism_mode == ISM_MODE_NONE ) { -- GitLab From 9e947ac303c2355b5d13e1c436abd4e5c70d3905 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 2 May 2024 15:10:11 +0200 Subject: [PATCH 41/44] merge options.h from main --- lib_com/options.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c68329e51b..436a5d8bf1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,13 +167,7 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -<<<<<<< HEAD #define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ -#define NONBE_FIX_1045_ISM_BITRATE_SWITCHING /* Eri: Difference between ROM/File HRTF in ISM bitrate switching */ -#define NONBE_FIX_1067_QUATERNIONSLERP_INACCURACIES /* Philips: issue 1067: QuaternionSlerp inaccuracies in corner cases */ -#define NONBE_FIX_1065_ISM_MD_HANDLE /* VA: issue 1065: Allocate only the necessary number of ISM MD decoder handles. */ -======= ->>>>>>> main #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ #define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */ -- GitLab From 371f593c060cfb34bc8680d2e295b972b8d63a13 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 3 May 2024 23:28:19 +0200 Subject: [PATCH 42/44] some fixes and clean up under NONBE_FIX_ISM_XOVER_BR --- lib_dec/ivas_init_dec.c | 9 +++++++-- lib_dec/ivas_sba_dec.c | 25 +++++++++++++---------- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 5 +++++ lib_enc/ivas_osba_enc.c | 40 +++++++++++++------------------------ 5 files changed, 41 insertions(+), 40 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5ed5bd4a90..9e1551841a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -468,6 +468,11 @@ ivas_error ivas_dec_setup( st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; num_bits_read += SBA_ORDER_BITS; } +#else + if ( ivas_total_brate < IVAS_256k ) + { + st_ivas->sba_order = 3; + } #endif if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate ) { @@ -495,7 +500,7 @@ ivas_error ivas_dec_setup( int16_t n; n = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n / 2 ) + ( n % 2 ); + st_ivas->nCPE = (n+1)>>1; } #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; @@ -1589,7 +1594,7 @@ ivas_error ivas_init_decoder( int16_t n_all; n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + st_ivas->nCPE = ( n_all + 1 ) >> 1; } #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5cc39c2a40..8839441b83 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -70,7 +70,11 @@ void ivas_sba_set_cna_cng_flag( st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; } +#ifdef NONBE_FIX_ISM_XOVER_BR + else if ( st_ivas->nchan_transport == 2 && st_ivas->ivas_format != SBA_ISM_FORMAT ) +#else else if ( st_ivas->nchan_transport == 2 ) +#endif { for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -125,7 +129,7 @@ ivas_error ivas_sba_dec_reconfigure( ISM_MODE ism_mode_old; int16_t granularity_new; #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t n_all; + int16_t nchan_transport; #endif ism_mode_old = st_ivas->ism_mode; @@ -458,7 +462,7 @@ ivas_error ivas_sba_dec_reconfigure( *-----------------------------------------------------------------*/ #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -530,10 +534,8 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 ); - } + nchan_transport += st_ivas->nchan_ism; + st_ivas->nCPE = ( nchan_transport + 1) >> 1; #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif @@ -552,7 +554,7 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif nchan_transport_old += st_ivas->nchan_ism; @@ -561,8 +563,9 @@ ivas_error ivas_sba_dec_reconfigure( else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + nchan_transport = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( nchan_transport + 1) >> 1; + nchan_transport_old += st_ivas->nchan_ism; #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; nCPE_old = st_ivas->nCPE; @@ -574,8 +577,8 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef NONBE_FIX_ISM_XOVER_BR if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, - sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all, - ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport, + ( st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 870541c816..0371378d73 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -742,7 +742,7 @@ ivas_error ivas_init_encoder( int16_t n_all; n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + st_ivas->nCPE = ( n_all + 1 ) >> 1; } #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 7c71c5837f..d4aad15afa 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -504,6 +504,11 @@ void ivas_mct_core_enc( { nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; } +#else + if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 ) + { + nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; + } #endif } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 25c4752903..e263b309ca 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -181,13 +181,14 @@ ivas_error ivas_osba_enc_reconfig( int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; -#ifdef NONBE_FIX_ISM_XOVER_BR - int16_t n_all, n_all_old = 0; -#endif + error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t nchan_transport; +#endif if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) { @@ -216,20 +217,6 @@ ivas_error ivas_osba_enc_reconfig( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -#ifdef NONBE_FIX_ISM_XOVER_BR - if ( old_ism_mode == ISM_MODE_NONE ) - { - n_all_old = nchan_transport_old; - } - else if ( old_ism_mode == ISM_SBA_MODE_DISC ) - { - n_all_old = nchan_transport_old + st_ivas->hEncoderConfig->nchan_ism; - } - else - { - assert( 0 && "This should not happen!" ); - } -#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands; @@ -357,14 +344,14 @@ ivas_error ivas_osba_enc_reconfig( *-----------------------------------------------------------------*/ #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR { - int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 ); + nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( nchan_transport + 1) >> 1; } #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; @@ -372,17 +359,18 @@ ivas_error ivas_osba_enc_reconfig( } else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) { -#ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport; -#else + nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = st_ivas->nchan_transport; #endif } else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { #ifdef NONBE_FIX_ISM_XOVER_BR - n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 ); + nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; + nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( nchan_transport + 1) >> 1; #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; nCPE_old = st_ivas->nCPE; @@ -392,7 +380,7 @@ ivas_error ivas_osba_enc_reconfig( } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate / n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / nchan_transport, ( ivas_total_brate / nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) #endif -- GitLab From 790602975d11e1d72ff9b0450af2f83a3e233816 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 3 May 2024 23:36:50 +0200 Subject: [PATCH 43/44] apply clang-format --- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_sba_dec.c | 4 ++-- lib_enc/ivas_osba_enc.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9e1551841a..84892a4496 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -500,7 +500,7 @@ ivas_error ivas_dec_setup( int16_t n; n = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = (n+1)>>1; + st_ivas->nCPE = ( n + 1 ) >> 1; } #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 8839441b83..a559ea3894 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -535,7 +535,7 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport += st_ivas->nchan_ism; - st_ivas->nCPE = ( nchan_transport + 1) >> 1; + st_ivas->nCPE = ( nchan_transport + 1 ) >> 1; #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; #endif @@ -564,7 +564,7 @@ ivas_error ivas_sba_dec_reconfigure( { #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( nchan_transport + 1) >> 1; + st_ivas->nCPE = ( nchan_transport + 1 ) >> 1; nchan_transport_old += st_ivas->nchan_ism; #else st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index e263b309ca..5ae0619cd7 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -351,7 +351,7 @@ ivas_error ivas_osba_enc_reconfig( #ifdef NONBE_FIX_ISM_XOVER_BR { nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( nchan_transport + 1) >> 1; + st_ivas->nCPE = ( nchan_transport + 1 ) >> 1; } #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; @@ -370,7 +370,7 @@ ivas_error ivas_osba_enc_reconfig( #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism; nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( nchan_transport + 1) >> 1; + st_ivas->nCPE = ( nchan_transport + 1 ) >> 1; #else st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1; nCPE_old = st_ivas->nCPE; @@ -380,7 +380,7 @@ ivas_error ivas_osba_enc_reconfig( } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / nchan_transport, ( ivas_total_brate / nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / nchan_transport, ( ivas_total_brate / nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) #endif -- GitLab From 35eb186c84ccf862b6af6b531ca0bf638d63e73e Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Sun, 5 May 2024 22:56:16 +0200 Subject: [PATCH 44/44] revert change from define to fix clang errors --- lib_dec/ivas_sba_dec.c | 6 ------ lib_enc/ivas_osba_enc.c | 4 ---- 2 files changed, 10 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a559ea3894..459e0b2707 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -575,13 +575,7 @@ ivas_error ivas_sba_dec_reconfigure( } } -#ifdef NONBE_FIX_ISM_XOVER_BR - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, - sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport, - ( st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 5ae0619cd7..38f927b109 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -379,11 +379,7 @@ ivas_error ivas_osba_enc_reconfig( #endif } -#ifdef NONBE_FIX_ISM_XOVER_BR - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / nchan_transport, ( ivas_total_brate / nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) -#endif { return error; } -- GitLab