From 30f63cb951cf36ed6cd3223ffc56e0568f01a442 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 12:13:53 +0100 Subject: [PATCH 01/27] make OSBA X-over BR configurable with IVAS_OSBA_DISCRETE_ISM_MIN_BR --- lib_com/ivas_cnst.h | 4 +++- lib_com/options.h | 2 ++ 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, 24 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index af3fbb8932..9b4864b954 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 94b49b8481..100e6060bb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -178,6 +178,8 @@ #define NONBE_FIX_967_ISM_MONO_DMX /* FhG: issue 967: accumulating energies in ISM mono DMX */ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ #define NONBE_FIX_977_OSBA_GAIN_MISMATCH /* Dlb : issue 977 : Output gain mismatch for different bit rates in OSBA */ +#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 d24e043648..5f7ca13e4a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -495,8 +495,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 6ddcb37778..88417f12f2 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 e1aa7113af..1ae59ca4ab 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 bcff38b21d..46b470c164 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -201,8 +201,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 1ed3253e2e55567319a4de6acb01e57b06298059 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 15:54:05 +0100 Subject: [PATCH 02/27] 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 5f7ca13e4a..e56cd9022a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -466,7 +466,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 69762f033c9ae6ef800ff42cb75d66f7dff1233d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 26 Jan 2024 16:13:46 +0100 Subject: [PATCH 03/27] 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 9b4864b954..d8986ddd40 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 58b01315efa892fbc4878e524cbe14e41f9f1fa9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 09:58:37 +0100 Subject: [PATCH 04/27] 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 e56cd9022a..7bd853c69e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -454,7 +454,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]; @@ -467,7 +471,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 88417f12f2..173645e965 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 c20d09e332..b6199c1ce6 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -495,7 +495,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 d2bddaeb84bceff8d5febde1546fb487340489de Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 10:43:50 +0100 Subject: [PATCH 05/27] 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 7bd853c69e..6cd4df5898 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -325,7 +325,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++; @@ -500,7 +500,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 @@ -643,7 +652,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++; @@ -664,7 +673,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 ) @@ -1396,7 +1405,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 ); @@ -1551,7 +1560,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 ); } @@ -1567,7 +1576,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 173645e965..95a2e1947b 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 1ae59ca4ab..f8b8f8e04d 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 46b470c164..1c8f50a199 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -344,16 +344,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 7a6945a50054f31f1aa5bbaa2fd41f588d0144ac Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 11:50:42 +0100 Subject: [PATCH 06/27] 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 d8986ddd40..9b4864b954 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 0916a51a472a10f0cb23e6ae923b9d52bdbef4b8 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 12:07:25 +0100 Subject: [PATCH 07/27] 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 6cd4df5898..21e49548c6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -325,7 +325,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++; @@ -652,7 +652,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++; @@ -673,7 +673,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 ) @@ -1405,7 +1405,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 ); @@ -1560,7 +1560,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 95a2e1947b..e455103648 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 b6199c1ce6..b57d830cd6 100755 --- 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( #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 1c8f50a199..0ef5bd2622 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -206,7 +206,7 @@ ivas_error ivas_osba_enc_reconfig( #else if ( ivas_total_brate >= IVAS_256k ) #endif - { + { st_ivas->ism_mode = ISM_SBA_MODE_DISC; } else @@ -354,7 +354,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; @@ -371,7 +371,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 ca410db48cee3fe0dcdaec37ed1f093e45985efb Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Jan 2024 13:47:58 +0100 Subject: [PATCH 08/27] 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 b57d830cd6..aba61d0c16 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -496,7 +496,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 43b87e626012abe10110c495ac38e2c31a05899e Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 30 Jan 2024 16:54:05 +0100 Subject: [PATCH 09/27] 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 6b6b204451..38e9518e61 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -361,9 +361,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 b27a002513..c3bcf9f3e3 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3015,6 +3015,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( @@ -5644,7 +5648,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 21e49548c6..0a135b17be 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -455,7 +455,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 @@ -471,7 +471,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 @@ -513,7 +513,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 e455103648..3250fd55a8 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 f8b8f8e04d..8761cffecc 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 aba61d0c16..5d4b9af472 100755 --- 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; @@ -496,7 +500,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 59bec00e27..ecbfae69d6 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -250,7 +250,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 0ef5bd2622..da2d07c2d3 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( 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 07bab5a0e7320e271ea17c14b6bd654f4af17b2d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 30 Jan 2024 17:48:20 +0100 Subject: [PATCH 10/27] 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 0a135b17be..101088aabb 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -455,7 +455,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 @@ -513,7 +513,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 5d4b9af472..00f189fb76 100755 --- 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 ecbfae69d6..f2d11aae24 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -255,7 +255,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 09ef7da9d0d245c19d5ba7f32d2577fcf927908b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 08:52:02 +0100 Subject: [PATCH 11/27] 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 2940b45f76d85e7b3a60bf74e2dbf39138c0f2e9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 09:08:53 +0100 Subject: [PATCH 12/27] 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 f1c424c7eabb751dfbdb4457d038ffb4fbae89e1 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 31 Jan 2024 09:18:23 +0100 Subject: [PATCH 13/27] 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 9b187a62c60e24a147ce3cdd86421831ea7bd015 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 13:22:19 +0100 Subject: [PATCH 14/27] implement experimental signaling of the ISM mode in OSBA format --- lib_com/ivas_cnst.h | 3 +++ lib_dec/ivas_init_dec.c | 32 ++++++++++++++++++++++++-------- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_sba_dec.c | 4 ++++ lib_enc/ivas_spar_encoder.c | 17 +++++++++++++++-- 6 files changed, 48 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 38e9518e61..99f28205a3 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1148,6 +1148,9 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 +#ifdef NONBE_FIX_ISM_XOVER_BR +#define NO_BITS_SBA_ISM_NO_OBJ 3 +#endif #define MASA2TOTAL_THR 0.98f #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 101088aabb..1f0388d52c 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -325,7 +325,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++; @@ -451,11 +451,27 @@ ivas_error ivas_dec_setup( } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { + +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t osba_mode_bit = st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1]; +#endif + /* the number of objects is written at the end of the bitstream, in the SBA metadata */ +#ifdef NONBE_FIX_ISM_XOVER_BR + st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 3] + 1; +#else 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; +#endif + +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( osba_mode_bit ) + { + st_ivas->ism_mode = ISM_SBA_MODE_DISC; + } +#endif #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 || osba_mode_bit ) #else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) #endif @@ -471,7 +487,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 ( !osba_mode_bit ) #else if ( ivas_total_brate < IVAS_256k ) #endif @@ -513,7 +529,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 ( osba_mode_bit ) #else if ( ivas_total_brate >= IVAS_256k ) #endif @@ -652,7 +668,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++; @@ -673,7 +689,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 ) @@ -1405,7 +1421,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 ); @@ -1560,7 +1576,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_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index bde79fcb5f..121ac0429c 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -208,7 +208,7 @@ ivas_error ivas_ism_metadata_dec( if ( ism_mode == ISM_SBA_MODE_DISC ) { /* number of objects was read in ivas_dec_setup() */ - st0->next_bit_pos += NO_BITS_MASA_ISM_NO_OBJ; + st0->next_bit_pos += NO_BITS_SBA_ISM_NO_OBJ; } else if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index dc394dda02..ed46487490 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -428,7 +428,7 @@ ivas_error ivas_jbm_dec_tc( } else { - nb_bits_metadata[1] += NO_BITS_MASA_ISM_NO_OBJ; + nb_bits_metadata[1] += NO_BITS_SBA_ISM_NO_OBJ; sba_ch_idx = 0; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index ec6a150bec..c982b35dc4 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -141,6 +141,9 @@ ivas_error ivas_sba_dec_reconfigure( ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); +#ifdef NONBE_FIX_ISM_XOVER_BR + if ( !(st_ivas->ivas_format == SBA_ISM_FORMAT ) ) +#else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { #ifdef NONBE_FIX_ISM_XOVER_BR @@ -157,6 +160,7 @@ ivas_error ivas_sba_dec_reconfigure( } } else +#endif { st_ivas->ism_mode = ISM_MODE_NONE; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index ec31fe9c67..00c6e6564a 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -366,8 +366,21 @@ ivas_error ivas_spar_enc( if ( hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t i1; + + i1 = hEncoderConfig->nchan_ism - 1; + + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + i1 |= ( 1 << 2 ); + } + /* write the number of objects in ISM_SBA format*/ - push_indice( hMetaData, IND_ISM_NUM_OBJECTS, hEncoderConfig->nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); + push_indice( hMetaData, IND_ISM_NUM_OBJECTS, i1, NO_BITS_SBA_ISM_NO_OBJ ); +#else + push_indice( hMetaData, IND_ISM_NUM_OBJECTS, hEncoderConfig->nchan_ism, NO_BITS_SBA_ISM_NO_OBJ ); +#endif } /* front VAD */ @@ -601,7 +614,7 @@ static ivas_error ivas_spar_enc_process( ivas_total_brate = hEncoderConfig->ivas_total_brate; num_del_samples = hSpar->hFbMixer->fb_cfg->fb_latency; - input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); + input_frame = ( int16_t )( input_Fs / FRAMES_PER_SEC ); sba_order = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order, hEncoderConfig->ivas_total_brate ); assert( nchan_inp <= hEncoderConfig->nchan_inp ); -- GitLab From 4de843aee15fe191c82094603581bf64cadfd747 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 13:29:40 +0100 Subject: [PATCH 15/27] fix formatting --- lib_dec/ivas_init_dec.c | 12 ++++++------ lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_spar_encoder.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1f0388d52c..8ecaa96e2b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -325,7 +325,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++; @@ -467,7 +467,7 @@ ivas_error ivas_dec_setup( if ( osba_mode_bit ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; - } + } #endif #ifdef NONBE_FIX_ISM_XOVER_BR @@ -668,7 +668,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++; @@ -689,7 +689,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 ) @@ -1421,7 +1421,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 ); @@ -1576,7 +1576,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 c982b35dc4..2b6afe8f6f 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -142,7 +142,7 @@ ivas_error ivas_sba_dec_reconfigure( nchan_hp20_old = getNumChanSynthesis( st_ivas ); #ifdef NONBE_FIX_ISM_XOVER_BR - if ( !(st_ivas->ivas_format == SBA_ISM_FORMAT ) ) + if ( !( st_ivas->ivas_format == SBA_ISM_FORMAT ) ) #else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 00c6e6564a..532fe7e705 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -614,7 +614,7 @@ static ivas_error ivas_spar_enc_process( ivas_total_brate = hEncoderConfig->ivas_total_brate; num_del_samples = hSpar->hFbMixer->fb_cfg->fb_latency; - input_frame = ( int16_t )( input_Fs / FRAMES_PER_SEC ); + input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); sba_order = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order, hEncoderConfig->ivas_total_brate ); assert( nchan_inp <= hEncoderConfig->nchan_inp ); -- GitLab From 7b0fc78ac059c653980ee8a410fac6a2995ecb56 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 13:37:35 +0100 Subject: [PATCH 16/27] move ivas_osba_ism_mode_select to ivas_osba_enc --- Workspace_msvc/lib_com.vcxproj | 1 - Workspace_msvc/lib_com.vcxproj.filters | 3 - lib_com/ivas_osba_com.c | 79 -------------------------- lib_com/ivas_prot.h | 3 + lib_enc/ivas_osba_enc.c | 42 ++++++++++++++ 5 files changed, 45 insertions(+), 83 deletions(-) delete mode 100644 lib_com/ivas_osba_com.c diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 994e336f61..1081724287 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -205,7 +205,6 @@ - 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/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c deleted file mode 100644 index 4bac48c61d..0000000000 --- a/lib_com/ivas_osba_com.c +++ /dev/null @@ -1,79 +0,0 @@ -/****************************************************************************************************** - - (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; -} diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c3bcf9f3e3..815a50c796 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5648,10 +5648,13 @@ void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); +#ifdef NONBE_FIX_ISM_XOVER_BR 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 */ ); +#endif + /*----------------------------------------------------------------------------------* * OMASA prototypes *---------------------------------------------------------------------------------*/ diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index da2d07c2d3..f44e9ec352 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -519,3 +519,45 @@ static void ivas_osba_render_ism_to_sba( return; } + +#ifdef NONBE_FIX_ISM_XOVER_BR +/*! 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; +} + +#endif -- GitLab From d8db2b47d19e99f8c74a1b730d7c005c0f6deddd Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 13:47:47 +0100 Subject: [PATCH 17/27] add description to define 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 f7d5354fee..56cb228c14 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,7 @@ #define NONBE_FIX_967_ISM_MONO_DMX /* FhG: issue 967: accumulating energies in ISM mono DMX */ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ #define NONBE_FIX_977_OSBA_GAIN_MISMATCH /* Dlb : issue 977 : Output gain mismatch for different bit rates in OSBA */ -#define NONBE_FIX_ISM_XOVER_BR +#define NONBE_FIX_ISM_XOVER_BR /* FhG: select coding method for OSBA ojects depending on the number of objects and bitrate */ /* ##################### End NON-BE switches ########################### */ -- GitLab From 3e2bc87b29ca1f5635a972a1a32ef0e6feb01645 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 15:43:59 +0100 Subject: [PATCH 18/27] fix creash with bitrate switching --- lib_dec/ivas_init_dec.c | 25 +++++++++---------------- lib_dec/ivas_sba_dec.c | 6 +----- lib_dec/ivas_stat_dec.h | 3 +++ 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 145ba3f722..402604e4c8 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++; @@ -467,7 +467,7 @@ ivas_error ivas_dec_setup( { #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t osba_mode_bit = st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1]; + st_ivas->osba_mode_bit = st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1]; #endif /* the number of objects is written at the end of the bitstream, in the SBA metadata */ @@ -478,14 +478,7 @@ ivas_error ivas_dec_setup( #endif #ifdef NONBE_FIX_ISM_XOVER_BR - if ( osba_mode_bit ) - { - st_ivas->ism_mode = ISM_SBA_MODE_DISC; - } -#endif - -#ifdef NONBE_FIX_ISM_XOVER_BR - if ( ivas_total_brate < IVAS_24k4 || osba_mode_bit ) + if ( ivas_total_brate < IVAS_24k4 || st_ivas->osba_mode_bit ) #else if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k ) #endif @@ -501,7 +494,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_ISM_XOVER_BR - if ( !osba_mode_bit ) + if ( !st_ivas->osba_mode_bit ) #else if ( ivas_total_brate < IVAS_256k ) #endif @@ -543,7 +536,7 @@ ivas_error ivas_dec_setup( } } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( osba_mode_bit ) + if ( st_ivas->osba_mode_bit ) #else if ( ivas_total_brate >= IVAS_256k ) #endif @@ -682,7 +675,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++; @@ -703,7 +696,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 ) @@ -1452,7 +1445,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 ); @@ -1607,7 +1600,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 66924af20e..8a5939d4aa 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -141,13 +141,10 @@ ivas_error ivas_sba_dec_reconfigure( ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); -#ifdef NONBE_FIX_ISM_XOVER_BR - if ( !( st_ivas->ivas_format == SBA_ISM_FORMAT ) ) -#else 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 ( st_ivas->osba_mode_bit ) #else if ( ivas_total_brate >= IVAS_256k ) #endif @@ -160,7 +157,6 @@ ivas_error ivas_sba_dec_reconfigure( } } else -#endif { st_ivas->ism_mode = ISM_MODE_NONE; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4deb6748e2..0a954431ca 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1102,6 +1102,9 @@ typedef struct Decoder_Struct int16_t sba_planar; /* Ambisonic (SBA) planar flag */ int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t osba_mode_bit; +#endif /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ -- GitLab From 2674f05c3f1186fa49f56592cdb9a0824221d656 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 11 Mar 2024 15:54:06 +0100 Subject: [PATCH 19/27] fix formatting --- lib_dec/ivas_init_dec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 402604e4c8..9c41e74965 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++; @@ -675,7 +675,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++; @@ -696,7 +696,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 ) @@ -1445,7 +1445,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 ); @@ -1600,7 +1600,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 ); } -- GitLab From e56a7052f20ef647410ca19c7f54c891aaef70b6 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 09:27:28 +0100 Subject: [PATCH 20/27] implement new command line switch for discrete coding of objects --- apps/encoder.c | 38 ++++++++++++++++++++++++++----------- lib_com/ivas_prot.h | 6 ++++-- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 5 +++-- lib_enc/ivas_mct_enc.c | 3 ++- lib_enc/ivas_osba_enc.c | 20 ++++++++++++------- lib_enc/ivas_stat_enc.h | 4 ++++ lib_enc/lib_enc.c | 8 ++++++++ 8 files changed, 62 insertions(+), 24 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index b00f4f75fd..e0382f037f 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -58,8 +58,7 @@ static #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ -typedef union _EncInputFormatConfig -{ +typedef union _EncInputFormatConfig { /* MONO details */ bool stereoToMonoDownmix; @@ -131,6 +130,9 @@ typedef struct const char *ca_config_file; bool mimeOutput; IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; +#ifdef NONBE_FIX_ISM_XOVER_BR + bool lbr_disc_obj; +#endif #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; const char *forcedModeFile; @@ -431,7 +433,13 @@ int main( } break; case IVAS_ENC_INPUT_SBA_ISM: - if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca +#ifdef NONBE_FIX_ISM_XOVER_BR + , + arg.lbr_disc_obj +#endif + + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); @@ -1183,16 +1191,24 @@ static bool parseCmdlIVAS_enc( } } +#ifdef NONBE_FIX_ISM_XOVER_BR + else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) ) + { + arg->lbr_disc_obj = true; + fprintf( stdout, "Encoding objects separately\n" ); + ++i; + } +#endif /*-----------------------------------------------------------------* - * MIME output file format - *-----------------------------------------------------------------*/ + * MIME output file format + *-----------------------------------------------------------------*/ - else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) - { - arg->mimeOutput = true; - fprintf( stdout, "Output bitstream file format: MIME\n" ); - ++i; - } + else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) + { + arg->mimeOutput = true; + fprintf( stdout, "Output bitstream file format: MIME\n" ); + ++i; + } /*-----------------------------------------------------------------* diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8c115e11cf..26f049920e 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3018,7 +3018,8 @@ 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 */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects ats bitrates < 256 kbps */ #endif ); @@ -5626,7 +5627,8 @@ void ivas_osba_data_close( #ifdef NONBE_FIX_ISM_XOVER_BR 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 */ + const int16_t nchan_ism, /* i : number of input ISM's */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects at BRs lower than 256 kbps */ ); #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9f1891a35e..c62b26fbe3 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, st_ivas->hEncoderConfig->lbr_disc_obj ) ) #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 451d4fce90..e8ff64a372 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -193,7 +193,8 @@ 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 */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects ats bitrates < 256 kbps */ #endif ) { @@ -502,7 +503,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, lbr_disc_obj ) || 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 f35ffa810f..c614242563 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -251,7 +251,8 @@ ivas_error ivas_mct_enc( 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 + st_ivas->hEncoderConfig->nchan_ism, + st_ivas->hEncoderConfig->lbr_disc_obj #endif ); diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 9961c8ea57..061cc9f87e 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_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, st_ivas->hEncoderConfig->lbr_disc_obj ) ) #else if ( ivas_total_brate >= IVAS_256k ) #endif @@ -506,34 +506,40 @@ static void ivas_osba_render_ism_to_sba( #ifdef NONBE_FIX_ISM_XOVER_BR /*! 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 */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism, /* i : number of input ISM's */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects at BRs lower than 256 kbps */ ) { int16_t ism_mode = 0; + if ( !lbr_disc_obj && ivas_total_brate < IVAS_256k ) + { + return 0; + } + 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; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 3962ac055f..b62a6d507d 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1175,6 +1175,10 @@ typedef struct encoder_config_structure IVAS_FORMAT ivas_format; /* IVAS format */ int16_t is_binaural; /* flag indicating if input is binaural audio */ +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t lbr_disc_obj; +#endif + int16_t element_mode_init; /* element mode used at initialization */ int16_t stereo_dmx_evs; /* flag to indicate that stereo downmix for EVS encoder */ int16_t nchan_ism; /* number of ISM channels */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 4a4be81734..d85b39286e 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -548,6 +548,10 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef NONBE_FIX_ISM_XOVER_BR + , + const bool lbr_disc_obj /* i : Code objects separately in OSBA */ +#endif ) { Encoder_Struct *st_ivas; @@ -568,6 +572,10 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( st_ivas->hEncoderConfig->sba_planar = isPlanar; st_ivas->hEncoderConfig->sba_order = order; +#ifdef NONBE_FIX_ISM_XOVER_BR + st_ivas->hEncoderConfig->lbr_disc_obj = lbr_disc_obj; +#endif + /* Input in ACN/SN3D in all cases (3D and planar): get number of channels */ /*Input file will always contain all channels for a given order irrespective of planar flag*/ st_ivas->hEncoderConfig->nchan_inp = ivas_sba_get_nchan( st_ivas->hEncoderConfig->sba_order, 0 ) + numObjects; -- GitLab From d08a034c1000078c9cb60086a4f5d9db15c7c71e Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 09:33:35 +0100 Subject: [PATCH 21/27] fix formatting --- apps/encoder.c | 35 ++++++++++++++++++----------------- lib_enc/ivas_mct_core_enc.c | 4 ++-- lib_enc/ivas_osba_enc.c | 14 +++++++------- lib_enc/lib_enc.c | 4 ++-- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index e0382f037f..9047b00b55 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -58,7 +58,8 @@ static #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ -typedef union _EncInputFormatConfig { +typedef union _EncInputFormatConfig +{ /* MONO details */ bool stereoToMonoDownmix; @@ -433,13 +434,13 @@ int main( } break; case IVAS_ENC_INPUT_SBA_ISM: - if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca + if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca #ifdef NONBE_FIX_ISM_XOVER_BR - , - arg.lbr_disc_obj + , + arg.lbr_disc_obj #endif - - ) ) != IVAS_ERR_OK ) + + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); @@ -1193,22 +1194,22 @@ static bool parseCmdlIVAS_enc( #ifdef NONBE_FIX_ISM_XOVER_BR else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) ) - { + { arg->lbr_disc_obj = true; - fprintf( stdout, "Encoding objects separately\n" ); - ++i; + fprintf( stdout, "Encoding objects separately\n" ); + ++i; } #endif /*-----------------------------------------------------------------* - * MIME output file format - *-----------------------------------------------------------------*/ + * MIME output file format + *-----------------------------------------------------------------*/ - else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) - { - arg->mimeOutput = true; - fprintf( stdout, "Output bitstream file format: MIME\n" ); - ++i; - } + else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) + { + arg->mimeOutput = true; + fprintf( stdout, "Output bitstream file format: MIME\n" ); + ++i; + } /*-----------------------------------------------------------------* diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index e8ff64a372..2420b91889 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -193,8 +193,8 @@ 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 lbr_disc_obj /* i : flag to enable discrete objects ats bitrates < 256 kbps */ + const int16_t nchan_ism, /* i : number of input ISM's */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects ats bitrates < 256 kbps */ #endif ) { diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 061cc9f87e..14e21c7706 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -506,17 +506,17 @@ static void ivas_osba_render_ism_to_sba( #ifdef NONBE_FIX_ISM_XOVER_BR /*! 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 */ - const int16_t lbr_disc_obj /* i : flag to enable discrete objects at BRs lower than 256 kbps */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism, /* i : number of input ISM's */ + const int16_t lbr_disc_obj /* i : flag to enable discrete objects at BRs lower than 256 kbps */ ) { int16_t ism_mode = 0; - if ( !lbr_disc_obj && ivas_total_brate < IVAS_256k ) - { - return 0; - } + if ( !lbr_disc_obj && ivas_total_brate < IVAS_256k ) + { + return 0; + } switch ( nchan_ism ) { diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index d85b39286e..f3d4e3dc66 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -549,8 +549,8 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_PCA_ON /* i : PCA option flag */ #ifdef NONBE_FIX_ISM_XOVER_BR - , - const bool lbr_disc_obj /* i : Code objects separately in OSBA */ + , + const bool lbr_disc_obj /* i : Code objects separately in OSBA */ #endif ) { -- GitLab From d43300560fb34129c329874c47f6aca9c7e04c01 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 09:58:36 +0100 Subject: [PATCH 22/27] fix compile error --- lib_enc/lib_enc.c | 2 +- lib_enc/lib_enc.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index f3d4e3dc66..7470598364 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -550,7 +550,7 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( const bool Opt_PCA_ON /* i : PCA option flag */ #ifdef NONBE_FIX_ISM_XOVER_BR , - const bool lbr_disc_obj /* i : Code objects separately in OSBA */ + const bool lbr_disc_obj /* i : Code objects separately in OSBA */ #endif ) { diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 2f40c1ab1b..bf116152eb 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -223,6 +223,10 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( const IVAS_ENC_SBA_ORDER order, /* i : order of the Ambisonics input */ const bool isPlanar, /* i : if true, input is treated as planar Ambisonics */ const bool Opt_PCA_ON /* i : PCA option flag */ +#ifdef NONBE_FIX_ISM_XOVER_BR + , + const bool lbr_disc_obj /* i : Code objects separately in OSBA */ +#endif ); /*! r: error code */ -- GitLab From b38b44fb9689c6218b572c5312249bb6ac4032d7 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 10:59:55 +0100 Subject: [PATCH 23/27] fix formatting --- lib_enc/lib_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 7470598364..f3d4e3dc66 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -550,7 +550,7 @@ ivas_error IVAS_ENC_ConfigureForSBAObjects( const bool Opt_PCA_ON /* i : PCA option flag */ #ifdef NONBE_FIX_ISM_XOVER_BR , - const bool lbr_disc_obj /* i : Code objects separately in OSBA */ + const bool lbr_disc_obj /* i : Code objects separately in OSBA */ #endif ) { -- GitLab From b3e8610727dd9b8f8e4a2adf64708fb7227c7660 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 11:28:16 +0100 Subject: [PATCH 24/27] fix bug in command line parsing --- apps/encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/encoder.c b/apps/encoder.c index 9047b00b55..190f69bd76 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -1193,7 +1193,7 @@ static bool parseCmdlIVAS_enc( } #ifdef NONBE_FIX_ISM_XOVER_BR - else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) ) + else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) == 0) { arg->lbr_disc_obj = true; fprintf( stdout, "Encoding objects separately\n" ); -- GitLab From 733ab386e7bff2bcb3ededfd0391446f60a3f421 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 12:09:13 +0100 Subject: [PATCH 25/27] fix formating --- apps/encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/encoder.c b/apps/encoder.c index 190f69bd76..24bf464034 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -1193,7 +1193,7 @@ static bool parseCmdlIVAS_enc( } #ifdef NONBE_FIX_ISM_XOVER_BR - else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) == 0) + else if ( strcmp( argv_to_upper, "-LBR_DISC_OBJ" ) == 0 ) { arg->lbr_disc_obj = true; fprintf( stdout, "Encoding objects separately\n" ); -- GitLab From 807f43163a470ba4e070ca20185f881a2688d80b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 15:12:34 +0100 Subject: [PATCH 26/27] fix sanitizer errors --- apps/encoder.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 24bf464034..3e42eed9da 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -58,8 +58,7 @@ static #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ -typedef union _EncInputFormatConfig -{ +typedef union _EncInputFormatConfig { /* MONO details */ bool stereoToMonoDownmix; @@ -891,6 +890,9 @@ static void initArgStruct( EncArguments *arg ) arg->is_binaural = false; arg->inputFormatConfig.stereoToMonoDownmix = false; arg->max_bwidth_user = false; +#ifdef NONBE_FIX_ISM_XOVER_BR + arg->lbr_disc_obj = false; +#endif arg->maxBandwidth = IVAS_ENC_BANDWIDTH_UNDEFINED; arg->bandwithProfileFile = NULL; arg->dtxConfig = IVAS_ENC_GetDefaultDtxConfig(); -- GitLab From 23ebdf0a0a5183c2125a41ade439ca5bebc38094 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 13 Mar 2024 15:15:19 +0100 Subject: [PATCH 27/27] fix formatting --- apps/encoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/encoder.c b/apps/encoder.c index 3e42eed9da..8ca293719f 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -58,7 +58,8 @@ static #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ -typedef union _EncInputFormatConfig { +typedef union _EncInputFormatConfig +{ /* MONO details */ bool stereoToMonoDownmix; -- GitLab