From 69ced9c47ac830ff301cb19e6aec31919ce9e6ea Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 28 May 2025 13:16:04 +0200 Subject: [PATCH 01/25] port float MR 1501 --- lib_com/ivas_dirac_com_fx.c | 5 +++++ lib_com/options.h | 3 ++- lib_dec/ivas_init_dec_fx.c | 17 ++++++++++++++++- lib_enc/ivas_mct_core_enc_fx.c | 8 ++++++++ lib_enc/ivas_spar_encoder_fx.c | 11 ++++++++++- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 017181d07..21717bb29 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -397,8 +397,13 @@ void ivas_get_dirac_sba_max_md_bits_fx( /* OSBA needs an additional 2-bits safety margin to avoid acelp crashes */ IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { +#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B + ( *metadata_max_bits ) = sub((*metadata_max_bits), 7); + move16(); +#else ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 3 ); move16(); +#endif } } ELSE IF( LE_32( sba_total_brate, IVAS_32k ) ) diff --git a/lib_com/options.h b/lib_com/options.h index 79443ece8..5d2aa1a78 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -129,7 +129,8 @@ #define NONBE_FIX_1014_1015_1016_OSBA_JBM_STEREO /* FhG: issues #1014, #1015, #1016: fix tc buffer info update in the discrete ism renderer */ #define NONBE_FIX_987_PARAMC_BINAURAL_REVERB_RENDERING /* FhG: issue 987: solution b: downmix HOA3 to stereo a input for the reverberator */ #define NONBE_FIX_1006_PAST_DMX_NRG_ERROR /* Eri/FhG: Issue 1006: Bug fix in ivas_stereo_dft_dec not replicated in ivas_stereo_dft_dec_dmx */ - +#define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ +#define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index f00ea4676..43060b5ae 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -457,14 +457,19 @@ ivas_error ivas_dec_setup( move16(); test(); +#ifndef NONBE_FIX_SBA_SIGNALING_BITS_B IF( LT_32( ivas_total_brate, IVAS_24k4 ) || GE_32( ivas_total_brate, IVAS_256k ) ) { +#endif /* read Ambisonic (SBA) planar flag */ st_ivas->sba_planar = st_ivas->bit_stream[num_bits_read]; move16(); num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); - } +#ifndef NONBE_FIX_SBA_SIGNALING_BITS_B + } +#endif + /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/ st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); @@ -472,11 +477,21 @@ ivas_error ivas_dec_setup( num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); /* read Ambisonic (SBA) order */ +#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B + /* read the real Ambisonic order when the above bits are used to signal OSBA format */ + if (ivas_total_brate < IVAS_24k4) + { + st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; + st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; + num_bits_read += SBA_ORDER_BITS; + } +#else if ( LT_32( ivas_total_brate, IVAS_256k ) ) { st_ivas->sba_order = 3; move16(); } +#endif test(); IF( st_ivas->ini_frame > 0 && NE_32( ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ) diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 71890120b..f71580964 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -700,10 +700,18 @@ void ivas_mct_core_enc_fx( nAvailBits = sub( nAvailBits, IVAS_FORMAT_SIGNALING_NBITS_EXTENDED ); nAvailBits = sub( nAvailBits, SBA_ORDER_BITS + SBA_PLANAR_BITS ); test(); +#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B + /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ + if (ivas_format == SBA_ISM_FORMAT) + { + nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; + } +#else if ( EQ_32( ivas_format, SBA_ISM_FORMAT ) && GT_16( nChannels, 4 ) ) { nAvailBits = sub( nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS ); } +#endif } FOR( ( cpe_id = 0, i = 0 ); cpe_id < nCPE; cpe_id++ ) diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index 3b380f2eb..77e3136a5 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -371,9 +371,18 @@ ivas_error ivas_spar_enc_fx( /* hack to indicate OSBA bitstream at VLBR */ push_indice( st0->hBstr, IND_SMODE, 0, SBA_ORDER_BITS ); - } +#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B + + /* additionally code the real SBA order */ + push_indice(st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS); +#endif + } ELSE { +#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B + /* Write SBA planar flag */ + push_indice(st0->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS); +#endif /* Write SBA order */ push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); } -- GitLab From 2e16c4e3e1de1046f509c152f404c4a41eb35e43 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 28 May 2025 13:23:51 +0200 Subject: [PATCH 02/25] fix formatting --- lib_com/ivas_dirac_com_fx.c | 4 ++-- lib_dec/ivas_init_dec_fx.c | 18 +++++++++--------- lib_enc/ivas_mct_core_enc_fx.c | 10 +++++----- lib_enc/ivas_spar_encoder_fx.c | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 21717bb29..72cc90f85 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -398,8 +398,8 @@ void ivas_get_dirac_sba_max_md_bits_fx( IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - ( *metadata_max_bits ) = sub((*metadata_max_bits), 7); - move16(); + ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 7 ); + move16(); #else ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 3 ); move16(); diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 43060b5ae..8a7dd1449 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -466,10 +466,10 @@ ivas_error ivas_dec_setup( move16(); num_bits_read = add( num_bits_read, SBA_PLANAR_BITS ); #ifndef NONBE_FIX_SBA_SIGNALING_BITS_B - } + } #endif - /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/ + /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/ st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; move16(); st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); @@ -478,13 +478,13 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - /* read the real Ambisonic order when the above bits are used to signal OSBA format */ - if (ivas_total_brate < IVAS_24k4) - { - st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; - st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; - num_bits_read += SBA_ORDER_BITS; - } + /* read the real Ambisonic order when the above bits are used to signal OSBA format */ + if ( ivas_total_brate < IVAS_24k4 ) + { + st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; + st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; + num_bits_read += SBA_ORDER_BITS; + } #else if ( LT_32( ivas_total_brate, IVAS_256k ) ) { diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index f71580964..04ec6eb23 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -701,11 +701,11 @@ void ivas_mct_core_enc_fx( nAvailBits = sub( nAvailBits, SBA_ORDER_BITS + SBA_PLANAR_BITS ); test(); #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ - if (ivas_format == SBA_ISM_FORMAT) - { - nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; - } + /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ + if ( ivas_format == SBA_ISM_FORMAT ) + { + nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; + } #else if ( EQ_32( ivas_format, SBA_ISM_FORMAT ) && GT_16( nChannels, 4 ) ) { diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index 77e3136a5..be83c9427 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -373,15 +373,15 @@ ivas_error ivas_spar_enc_fx( push_indice( st0->hBstr, IND_SMODE, 0, SBA_ORDER_BITS ); #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - /* additionally code the real SBA order */ - push_indice(st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS); + /* additionally code the real SBA order */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); #endif - } + } ELSE { #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - /* Write SBA planar flag */ - push_indice(st0->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS); + /* Write SBA planar flag */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); #endif /* Write SBA order */ push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); -- GitLab From 0f139e40b41709fb1a7ece55f14f58e7726b7a79 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 3 Jun 2025 15:47:05 +0200 Subject: [PATCH 03/25] port float MR 1347 --- Workspace_msvc/lib_com.vcxproj | 1 + Workspace_msvc/lib_com.vcxproj.filters | 1 + lib_com/ivas_prot_fx.h | 6 +++++ lib_com/options.h | 1 + lib_dec/ivas_corecoder_dec_reconfig_fx.c | 14 ++++++++--- lib_dec/ivas_init_dec_fx.c | 27 ++++++++++++++++++-- lib_dec/ivas_osba_dec_fx.c | 5 ++++ lib_dec/ivas_sba_dec_fx.c | 32 +++++++++++++++++++++++- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 4 +++ lib_enc/ivas_init_enc_fx.c | 9 +++++++ lib_enc/ivas_osba_enc_fx.c | 28 +++++++++++++++++++++ 11 files changed, 122 insertions(+), 6 deletions(-) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 8c91d3972..8e37844b9 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -212,6 +212,7 @@ + diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 8860ccd56..f247d199e 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -512,6 +512,7 @@ common_ivas_c + common_ivas_c diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 06494a4a7..3aa07e05a 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3850,6 +3850,12 @@ void ivas_osba_data_close_fx( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); +ISM_MODE ivas_osba_ism_mode_select( + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism /* i : number of input ISM's */ +); + + void ivas_set_ism_importance_interformat_fx( const Word32 ism_total_brate, /* i/o: ISms total bitrate */ const Word16 nchan_transport, /* i : number of transported channels */ diff --git a/lib_com/options.h b/lib_com/options.h index 5d2aa1a78..3bed6ee39 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -131,6 +131,7 @@ #define NONBE_FIX_1006_PAST_DMX_NRG_ERROR /* Eri/FhG: Issue 1006: Bug fix in ivas_stereo_dft_dec not replicated in ivas_stereo_dft_dec_dmx */ #define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ #define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */ +#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 8333f146f..0fdebf30f 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -342,8 +342,12 @@ ivas_error ivas_corecoder_dec_reconfig_fx( } ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + IF( NE_32( ( error = mct_dec_reconfigure_fx(st_ivas, (UWord16) NE_16( nchan_transport_real, nchan_transport_old))), IVAS_ERR_OK)) +#else IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( st_ivas->nchan_transport, nchan_transport_old ) ) ), IVAS_ERR_OK ) ) - { +#endif + { return error; } } @@ -444,8 +448,12 @@ ivas_error ivas_corecoder_dec_reconfig_fx( *-----------------------------------------------------------------*/ test(); - IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) ) - { +#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 ); } diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 8a7dd1449..195774c7c 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -512,13 +512,27 @@ ivas_error ivas_dec_setup( /*correct number of CPEs for discrete ISM coding*/ test(); IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n; + + n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr(add(st_ivas->nchan_ism, 1), 1); + } +#else { st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); move16(); } +#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( GE_32( ivas_total_brate, IVAS_256k ) ) +#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; move32(); @@ -1791,10 +1805,19 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - st_ivas->nCPE_old = st_ivas->nCPE; - move16(); + st_ivas->nCPE_old = st_ivas->nCPE; + move16(); +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add(n_all, 1), 1 ); + } +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); move16(); +#endif st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index a8754d84f..c4f57d4ba 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -160,6 +160,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( 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( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 687991c89..1473216a1 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -59,6 +59,9 @@ void ivas_sba_set_cna_cng_flag( test(); test(); test(); +#ifdef NONBE_FIX_ISM_XOVER_BR + test(); +#endif IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 1 ) ) { /* skip as done in init function */ @@ -72,7 +75,11 @@ void ivas_sba_set_cna_cng_flag( st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; move16(); } +#ifdef NONBE_FIX_ISM_XOVER_BR + else if (EQ_16(st_ivas->nchan_transport, 2) && NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT)) +#else ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) +#endif { FOR( n = 0; n < CPE_CHANNELS; n++ ) { @@ -124,6 +131,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( ivas_error error; ISM_MODE ism_mode_old; Word16 granularity_new; +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t nchan_transport; +#endif ism_mode_old = st_ivas->ism_mode; hDecoderConfig = st_ivas->hDecoderConfig; @@ -146,7 +156,11 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( 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) +#else IF( GE_32( ivas_total_brate, IVAS_256k ) ) +#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; move16(); @@ -498,6 +512,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = st_ivas->nchan_transport; +#endif IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { test(); @@ -572,8 +589,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( { return error; } - +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add(nchan_transport, 1), 1); +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ +#endif move16(); } ELSE IF( EQ_16( ism_mode_old, ISM_SBA_MODE_DISC ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) @@ -592,12 +613,20 @@ ivas_error ivas_sba_dec_reconfigure_fx( st_ivas->hHrtfTD = NULL; } } +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = st_ivas->nchan_transport; +#endif nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ st_ivas->ism_mode = ISM_MODE_NONE; move16(); } ELSE IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = add(st_ivas->nchan_transport, st_ivas->nchan_ism); + st_ivas->nCPE = shr( add(nchan_transport, 1), 1); + nchan_transport_old = add(nchan_transport_old, st_ivas->nchan_ism); +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ move16(); nCPE_old = st_ivas->nCPE; @@ -605,6 +634,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( nchan_transport_old = st_ivas->nchan_transport; move16(); nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ +#endif } } diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 6a2748e1c..9bb02755e 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -695,7 +695,11 @@ ivas_error ivas_corecoder_enc_reconfig_fx( } ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { +#ifndef NONBE_FIX_ISM_XOVER_BR + IF( ( error = mct_enc_reconfigure_fx( st_ivas, nchan_transport_old_real != nchan_transport_old ) ) != IVAS_ERR_OK) +#else IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 7d88b1264..014fd4082 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1502,7 +1502,16 @@ ivas_error ivas_init_encoder_fx( ELSE { /* allocate and initialize MCT core coder */ +#ifdef NONBE_FIX_ISM_XOVER_BR + { + int16_t n_all; + + n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr(add(n_all, 1), 1); + } +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */ +#endif FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index dbff29d68..1d97c0827 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -188,6 +188,9 @@ ivas_error ivas_osba_enc_reconfig( hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; move32(); +#ifdef NONBE_FIX_ISM_XOVER_BR + int16_t nchan_transport; +#endif IF( NE_32( ivas_total_brate, hEncoderConfig->last_ivas_total_brate ) ) { @@ -202,6 +205,9 @@ ivas_error ivas_osba_enc_reconfig( move16(); old_ism_mode = st_ivas->ism_mode; move32(); +#ifdef NONBE_FIX_ISM_XOVER_BR + st_ivas->ism_mode = ivas_osba_ism_mode_select(ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism); +#else IF( GE_32( ivas_total_brate, IVAS_256k ) ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; @@ -212,6 +218,7 @@ ivas_error ivas_osba_enc_reconfig( st_ivas->ism_mode = ISM_MODE_NONE; move32(); } +#endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; @@ -361,19 +368,39 @@ ivas_error ivas_osba_enc_reconfig( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = st_ivas->nchan_transport; +#endif + test(); test(); IF( old_ism_mode == ISM_MODE_NONE && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + { + nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr(add(nchan_transport,1),1); + } +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); move16(); +#endif } ELSE IF( EQ_32( old_ism_mode, ISM_SBA_MODE_DISC ) && st_ivas->ism_mode == ISM_MODE_NONE ) { nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); + +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport = st_ivas->nchan_transport; +#endif } ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { +#ifdef NONBE_FIX_ISM_XOVER_BR + nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); + nchan_transport = add(st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism); + st_ivas->nCPE = shr(add(nchan_transport , 1) , 1 ); +#else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); move16(); nCPE_old = st_ivas->nCPE; @@ -381,6 +408,7 @@ ivas_error ivas_osba_enc_reconfig( nchan_transport_old = st_ivas->nchan_transport; move16(); nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); +#endif } Word16 tmp_e; Word32 bitrate_per_chan = L_deposit_h( BASOP_Util_Divide3216_Scale( ivas_total_brate, st_ivas->nchan_transport, &tmp_e ) ); -- GitLab From 11171e5995695a2443c95e382b60055287159249 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 09:34:23 +0200 Subject: [PATCH 04/25] fix formatting --- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 10 ++++----- lib_dec/ivas_init_dec_fx.c | 26 ++++++++++++------------ lib_dec/ivas_osba_dec_fx.c | 2 +- lib_dec/ivas_sba_dec_fx.c | 22 ++++++++++---------- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 2 +- lib_enc/ivas_init_enc_fx.c | 10 ++++----- lib_enc/ivas_osba_enc_fx.c | 22 ++++++++++---------- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 0fdebf30f..5e8331ac1 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -343,11 +343,11 @@ ivas_error ivas_corecoder_dec_reconfig_fx( ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - IF( NE_32( ( error = mct_dec_reconfigure_fx(st_ivas, (UWord16) NE_16( nchan_transport_real, nchan_transport_old))), IVAS_ERR_OK)) + IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( nchan_transport_real, nchan_transport_old ) ) ), IVAS_ERR_OK ) ) #else IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( st_ivas->nchan_transport, nchan_transport_old ) ) ), IVAS_ERR_OK ) ) #endif - { + { return error; } } @@ -449,11 +449,11 @@ ivas_error ivas_corecoder_dec_reconfig_fx( test(); #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) + 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) + 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_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 195774c7c..9ad0f9093 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -514,12 +514,12 @@ ivas_error ivas_dec_setup( IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n; + { + int16_t n; - n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr(add(st_ivas->nchan_ism, 1), 1); - } + n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add( st_ivas->nchan_ism, 1 ), 1 ); + } #else { st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); @@ -529,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) == ISM_SBA_MODE_DISC) + if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif @@ -1805,15 +1805,15 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - st_ivas->nCPE_old = st_ivas->nCPE; - move16(); + st_ivas->nCPE_old = st_ivas->nCPE; + move16(); #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; + { + int16_t n_all; - n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add(n_all, 1), 1 ); - } + n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); + } #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); move16(); diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index c4f57d4ba..cf3caf44d 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -161,7 +161,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( } #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 diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 1473216a1..03dc31c93 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -60,7 +60,7 @@ void ivas_sba_set_cna_cng_flag( test(); test(); #ifdef NONBE_FIX_ISM_XOVER_BR - test(); + test(); #endif IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 1 ) ) { @@ -76,7 +76,7 @@ void ivas_sba_set_cna_cng_flag( move16(); } #ifdef NONBE_FIX_ISM_XOVER_BR - else if (EQ_16(st_ivas->nchan_transport, 2) && NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT)) + else if ( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) #endif @@ -132,7 +132,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( ISM_MODE ism_mode_old; Word16 granularity_new; #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t nchan_transport; + int16_t nchan_transport; #endif ism_mode_old = st_ivas->ism_mode; @@ -157,7 +157,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( 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( GE_32( ivas_total_brate, IVAS_256k ) ) #endif @@ -513,7 +513,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( *-----------------------------------------------------------------*/ #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { @@ -590,8 +590,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( return error; } #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add(nchan_transport, 1), 1); + nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ #endif @@ -614,7 +614,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } } #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ st_ivas->ism_mode = ISM_MODE_NONE; @@ -623,9 +623,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( ELSE IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = add(st_ivas->nchan_transport, st_ivas->nchan_ism); - st_ivas->nCPE = shr( add(nchan_transport, 1), 1); - nchan_transport_old = add(nchan_transport_old, st_ivas->nchan_ism); + nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); + st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ move16(); diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 9bb02755e..cfb1ea01f 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -696,7 +696,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { #ifndef NONBE_FIX_ISM_XOVER_BR - IF( ( error = mct_enc_reconfigure_fx( st_ivas, nchan_transport_old_real != nchan_transport_old ) ) != IVAS_ERR_OK) + IF( ( error = mct_enc_reconfigure_fx( st_ivas, nchan_transport_old_real != nchan_transport_old ) ) != IVAS_ERR_OK ) #else IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 014fd4082..cafd811a8 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1503,12 +1503,12 @@ ivas_error ivas_init_encoder_fx( { /* allocate and initialize MCT core coder */ #ifdef NONBE_FIX_ISM_XOVER_BR - { - int16_t n_all; + { + int16_t n_all; - n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr(add(n_all, 1), 1); - } + n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); + } #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */ #endif diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 1d97c0827..516698c56 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -189,7 +189,7 @@ ivas_error ivas_osba_enc_reconfig( ivas_total_brate = hEncoderConfig->ivas_total_brate; move32(); #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t nchan_transport; + int16_t nchan_transport; #endif IF( NE_32( ivas_total_brate, hEncoderConfig->last_ivas_total_brate ) ) @@ -206,7 +206,7 @@ ivas_error ivas_osba_enc_reconfig( old_ism_mode = st_ivas->ism_mode; move32(); #ifdef NONBE_FIX_ISM_XOVER_BR - st_ivas->ism_mode = ivas_osba_ism_mode_select(ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism); + st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) { @@ -369,7 +369,7 @@ ivas_error ivas_osba_enc_reconfig( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif test(); @@ -377,10 +377,10 @@ ivas_error ivas_osba_enc_reconfig( IF( old_ism_mode == ISM_MODE_NONE && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - { - nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr(add(nchan_transport,1),1); - } + { + nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + } #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); move16(); @@ -391,15 +391,15 @@ ivas_error ivas_osba_enc_reconfig( nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport = st_ivas->nchan_transport; + nchan_transport = st_ivas->nchan_transport; #endif } ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); - nchan_transport = add(st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism); - st_ivas->nCPE = shr(add(nchan_transport , 1) , 1 ); + nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); + nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); move16(); -- GitLab From 014598d2fc40e6582427ed62c2371d55c9ab45ce Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 10:23:40 +0200 Subject: [PATCH 05/25] add file lib_com/ivas_osba_com_fx.c --- lib_com/ivas_osba_com_fx.c | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 lib_com/ivas_osba_com_fx.c diff --git a/lib_com/ivas_osba_com_fx.c b/lib_com/ivas_osba_com_fx.c new file mode 100644 index 000000000..29b9c61c4 --- /dev/null +++ b/lib_com/ivas_osba_com_fx.c @@ -0,0 +1,71 @@ +/****************************************************************************************************** + + (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 + 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_fx.h" +#include "prot_fx.h" +#include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif + +/*! r : ISM format mode */ +ISM_MODE ivas_osba_ism_mode_select( + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism /* i : number of input ISM's */ +) +{ + ISM_MODE ism_mode = ISM_MODE_NONE; + + switch ( nchan_ism ) + { + case 1: + if ( ivas_total_brate >= IVAS_96k ) + { + ism_mode = ISM_SBA_MODE_DISC; + } + break; + + + case 2: + case 3: + case 4: + if ( ivas_total_brate >= IVAS_128k ) + { + ism_mode = ISM_SBA_MODE_DISC; + } + break; + } + + return ism_mode; +} -- GitLab From ac4dca69709116ad4bc611d1506487eb86a95d7b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 10:43:44 +0200 Subject: [PATCH 06/25] fix compile error --- lib_dec/ivas_init_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 9ad0f9093..39af786b5 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -515,10 +515,10 @@ ivas_error ivas_dec_setup( #ifdef NONBE_FIX_ISM_XOVER_BR { - int16_t n; + Word16 n; n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add( st_ivas->nchan_ism, 1 ), 1 ); + st_ivas->nCPE = shr( add( n, 1 ), 1 ); } #else { -- GitLab From e4aec20b17828cc5ca61cd03c56edd0f1d9ebd6c Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 12:55:13 +0200 Subject: [PATCH 07/25] replace one ifndef by ifndef in lib_enc/ivas_corecoder_enc_reconfig_fx.c --- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index cfb1ea01f..6a1a73b0b 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -695,8 +695,8 @@ ivas_error ivas_corecoder_enc_reconfig_fx( } ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { -#ifndef NONBE_FIX_ISM_XOVER_BR - IF( ( error = mct_enc_reconfigure_fx( st_ivas, nchan_transport_old_real != nchan_transport_old ) ) != IVAS_ERR_OK ) +#ifdef NONBE_FIX_ISM_XOVER_BR + IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16(nchan_transport_old_real, nchan_transport_old ) ) ) != IVAS_ERR_OK ) #else IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) #endif -- GitLab From 4e4bb936270a4d753481c615e7ed627a67749629 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 13:03:47 +0200 Subject: [PATCH 08/25] fix data types and comparisons --- lib_dec/ivas_sba_dec_fx.c | 4 ++-- lib_enc/ivas_init_enc_fx.c | 4 ++++ lib_enc/ivas_osba_enc_fx.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 03dc31c93..d03b8ba31 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -132,7 +132,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( ISM_MODE ism_mode_old; Word16 granularity_new; #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t nchan_transport; + Word16 nchan_transport; #endif ism_mode_old = st_ivas->ism_mode; @@ -157,7 +157,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( 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 ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index cafd811a8..52f0a808d 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1441,11 +1441,15 @@ ivas_error ivas_init_encoder_fx( st_ivas->ism_mode = ISM_MODE_NONE; move16(); +#ifdef NONBE_FIX_ISM_XOVER_BR + st_ivas->ism_mode = ivas_osba_ism_mode_select(ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism); +#else IF( GE_32( ivas_total_brate, IVAS_256k ) ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; move16(); } +#endif IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 516698c56..83a14d39d 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -189,7 +189,7 @@ ivas_error ivas_osba_enc_reconfig( ivas_total_brate = hEncoderConfig->ivas_total_brate; move32(); #ifdef NONBE_FIX_ISM_XOVER_BR - int16_t nchan_transport; + Word16 nchan_transport; #endif IF( NE_32( ivas_total_brate, hEncoderConfig->last_ivas_total_brate ) ) -- GitLab From 05e4bff9c0e27b495b335510a2e05aed06cb562a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 13:16:46 +0200 Subject: [PATCH 09/25] fix formatting --- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 2 +- lib_enc/ivas_init_enc_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 6a1a73b0b..6628dfcae 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -696,7 +696,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16(nchan_transport_old_real, nchan_transport_old ) ) ) != IVAS_ERR_OK ) + IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16( nchan_transport_old_real, nchan_transport_old ) ) ) != IVAS_ERR_OK ) #else IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 52f0a808d..0f605ff89 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1442,7 +1442,7 @@ ivas_error ivas_init_encoder_fx( move16(); #ifdef NONBE_FIX_ISM_XOVER_BR - st_ivas->ism_mode = ivas_osba_ism_mode_select(ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism); + st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) { -- GitLab From abc9a004b339bd91c6436f989c93b6f632985538 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 16:32:12 +0200 Subject: [PATCH 10/25] rewrite some comparisons using BASOP --- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 3 ++- lib_dec/ivas_init_dec_fx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 5e8331ac1..463b61983 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -449,7 +449,8 @@ ivas_error ivas_corecoder_dec_reconfig_fx( test(); #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 ) + test(); + if ( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) #endif diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 39af786b5..5177539eb 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -529,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 ) == ISM_SBA_MODE_DISC ) + if ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif -- GitLab From 4d8c17b5401117d8dcc583d96225d28e13b21d94 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 4 Jun 2025 17:00:18 +0200 Subject: [PATCH 11/25] fix condition for MCT enc channel number change --- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index 6628dfcae..25ba9b1a6 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -696,7 +696,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16( nchan_transport_old_real, nchan_transport_old ) ) ) != IVAS_ERR_OK ) + IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16( nchan_transport_old_real, nchan_transport_real ) ) ) != IVAS_ERR_OK ) #else IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) #endif -- GitLab From faeb8a8269cd69b47b4c3e2b7850c874c24951a8 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 5 Jun 2025 09:17:56 +0200 Subject: [PATCH 12/25] fix formatting --- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 463b61983..cd8fc6552 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -449,7 +449,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx( test(); #ifdef NONBE_FIX_ISM_XOVER_BR - test(); + test(); if ( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) -- GitLab From 393f94ffee76af9fb56c567850cf5c007be65725 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 5 Jun 2025 10:58:14 +0200 Subject: [PATCH 13/25] update copyright year in ivas_osba_com_fx.c --- lib_com/ivas_osba_com_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_osba_com_fx.c b/lib_com/ivas_osba_com_fx.c index 29b9c61c4..a795b6628 100644 --- a/lib_com/ivas_osba_com_fx.c +++ b/lib_com/ivas_osba_com_fx.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2025 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 -- GitLab From 8b99d4d6d44763a09803f0797906b613ef15434a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 5 Jun 2025 11:23:49 +0200 Subject: [PATCH 14/25] apply some basop specific fixes --- lib_dec/ivas_init_dec_fx.c | 6 +++--- lib_dec/ivas_sba_dec_fx.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 5177539eb..3a0c0bc7b 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -456,8 +456,8 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[res_dec - 1], 1 ), st_ivas->bit_stream[res_dec - 2] ), 1 ); move16(); - test(); #ifndef NONBE_FIX_SBA_SIGNALING_BITS_B + test(); IF( LT_32( ivas_total_brate, IVAS_24k4 ) || GE_32( ivas_total_brate, IVAS_256k ) ) { #endif @@ -479,7 +479,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B /* read the real Ambisonic order when the above bits are used to signal OSBA format */ - if ( ivas_total_brate < IVAS_24k4 ) + if ( LT_16( ivas_total_brate, IVAS_24k4 ) ) { st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; @@ -529,7 +529,7 @@ ivas_error ivas_dec_setup( } #ifdef NONBE_FIX_ISM_XOVER_BR - if ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) + IF ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index d03b8ba31..9110c8981 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -76,7 +76,7 @@ void ivas_sba_set_cna_cng_flag( move16(); } #ifdef NONBE_FIX_ISM_XOVER_BR - else if ( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + ELSE IF ( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) #endif @@ -157,7 +157,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - if ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) + IF ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif -- GitLab From 4fa524e8dc8502f3986ecb34cbb3a24116429c50 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 5 Jun 2025 12:44:04 +0200 Subject: [PATCH 15/25] fix formatting --- lib_dec/ivas_init_dec_fx.c | 4 ++-- lib_dec/ivas_sba_dec_fx.c | 4 ++-- lib_enc/ivas_mct_core_enc_fx.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 3a0c0bc7b..37b6f9d0e 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -457,7 +457,7 @@ ivas_error ivas_dec_setup( move16(); #ifndef NONBE_FIX_SBA_SIGNALING_BITS_B - test(); + test(); IF( LT_32( ivas_total_brate, IVAS_24k4 ) || GE_32( ivas_total_brate, IVAS_256k ) ) { #endif @@ -529,7 +529,7 @@ ivas_error ivas_dec_setup( } #ifdef NONBE_FIX_ISM_XOVER_BR - IF ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) + IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 9110c8981..ce653ca69 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -76,7 +76,7 @@ void ivas_sba_set_cna_cng_flag( move16(); } #ifdef NONBE_FIX_ISM_XOVER_BR - ELSE IF ( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) #endif @@ -157,7 +157,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { #ifdef NONBE_FIX_ISM_XOVER_BR - IF ( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) + IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) #else IF( GE_32( ivas_total_brate, IVAS_256k ) ) #endif diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 04ec6eb23..0e54e08c3 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -699,14 +699,14 @@ void ivas_mct_core_enc_fx( { nAvailBits = sub( nAvailBits, IVAS_FORMAT_SIGNALING_NBITS_EXTENDED ); nAvailBits = sub( nAvailBits, SBA_ORDER_BITS + SBA_PLANAR_BITS ); - test(); #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ - if ( ivas_format == SBA_ISM_FORMAT ) + if ( EQ_16( ivas_format, SBA_ISM_FORMAT ) ) { nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; } #else + test(); if ( EQ_32( ivas_format, SBA_ISM_FORMAT ) && GT_16( nChannels, 4 ) ) { nAvailBits = sub( nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS ); -- GitLab From 3bcd795b3f7e4a4ca64f6e2e4c7cb6009e20a42d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 5 Jun 2025 15:47:26 +0200 Subject: [PATCH 16/25] fix one comparison in BASOP --- lib_dec/ivas_init_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 37b6f9d0e..f28871b3a 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -479,7 +479,7 @@ ivas_error ivas_dec_setup( /* read Ambisonic (SBA) order */ #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B /* read the real Ambisonic order when the above bits are used to signal OSBA format */ - if ( LT_16( ivas_total_brate, IVAS_24k4 ) ) + if ( LT_32( ivas_total_brate, IVAS_24k4 ) ) { st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1]; st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; -- GitLab From 60f3de3c8e2478db3521fb04cdfa45bde701ffd7 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 18 Jun 2025 14:49:55 +0200 Subject: [PATCH 17/25] replace shr( add( n, 1 ), 1 ) by shr_r(n ,1) --- lib_dec/ivas_init_dec_fx.c | 2 +- lib_dec/ivas_sba_dec_fx.c | 4 ++-- lib_enc/ivas_init_enc_fx.c | 2 +- lib_enc/ivas_osba_enc_fx.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index f28871b3a..198b986c1 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -518,7 +518,7 @@ ivas_error ivas_dec_setup( Word16 n; n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add( n, 1 ), 1 ); + st_ivas->nCPE = shr_r( n, 1 ); } #else { diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index ce653ca69..4d713562c 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -591,7 +591,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + st_ivas->nCPE = shr_r( nchan_transport, 1 ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ #endif @@ -624,7 +624,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( { #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); - st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + st_ivas->nCPE = shr_r( nchan_transport, 1 ); nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 0f605ff89..17b0778d2 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1511,7 +1511,7 @@ ivas_error ivas_init_encoder_fx( int16_t n_all; n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); + st_ivas->nCPE = shr_r( n_all, 1 ); } #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */ diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 83a14d39d..66231d6f7 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -379,7 +379,7 @@ ivas_error ivas_osba_enc_reconfig( #ifdef NONBE_FIX_ISM_XOVER_BR { nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + st_ivas->nCPE = shr_r( nchan_transport, 1 ); } #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); @@ -399,7 +399,7 @@ ivas_error ivas_osba_enc_reconfig( #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); - st_ivas->nCPE = shr( add( nchan_transport, 1 ), 1 ); + st_ivas->nCPE = shr_r( nchan_transport, 1 ); #else st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); move16(); -- GitLab From 3293689eb8b95953b555b140a29498615bb8ac43 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 18 Jun 2025 15:19:06 +0200 Subject: [PATCH 18/25] fix compile error --- lib_dec/ivas_osba_dec_fx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index cf3caf44d..71896bfb7 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -163,8 +163,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( #ifdef NONBE_FIX_ISM_XOVER_BR ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT +g IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig; -- GitLab From aae3d311e72f443d591378ae82aa88f0ea5b0e86 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 18 Jun 2025 15:51:04 +0200 Subject: [PATCH 19/25] fix formatting --- lib_dec/ivas_osba_dec_fx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 71896bfb7..cc1e95d43 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -163,8 +163,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( #ifdef NONBE_FIX_ISM_XOVER_BR ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #endif -g - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + g IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig; Word16 cldfb_slots; -- GitLab From 69c465d3151e1643581b6264788dfa9f109c1872 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 18 Jun 2025 16:23:30 +0200 Subject: [PATCH 20/25] fix compile error --- lib_dec/ivas_osba_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index cc1e95d43..85806e02d 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -163,7 +163,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( #ifdef NONBE_FIX_ISM_XOVER_BR ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #endif - g IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig; Word16 cldfb_slots; -- GitLab From f8e692cb8e59a15a600ca8084afade07ca94f627 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 20 Jun 2025 15:22:00 +0200 Subject: [PATCH 21/25] fix subtraction in ivas_mct_core_enc_fx --- lib_enc/ivas_mct_core_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 0e54e08c3..abe355319 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -703,7 +703,7 @@ void ivas_mct_core_enc_fx( /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ if ( EQ_16( ivas_format, SBA_ISM_FORMAT ) ) { - nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; + nAvailBits = sub(nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS); } #else test(); -- GitLab From fda99d13590ed70c8f1be4147c365870f76da3cf Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 20 Jun 2025 15:23:39 +0200 Subject: [PATCH 22/25] fix formatting --- lib_enc/ivas_mct_core_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index abe355319..1c698aadb 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -703,7 +703,7 @@ void ivas_mct_core_enc_fx( /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ if ( EQ_16( ivas_format, SBA_ISM_FORMAT ) ) { - nAvailBits = sub(nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS); + nAvailBits = sub( nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS ); } #else test(); -- GitLab From e043491c67a1fab23921d7568ee5b00f548de897 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 5 Aug 2025 11:59:45 +0200 Subject: [PATCH 23/25] fix compilation issues --- lib_dec/ivas_init_dec_fx.c | 1 - lib_enc/ivas_mct_core_enc_fx.c | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index dba72101a..0b9b4bd70 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -478,7 +478,6 @@ ivas_error ivas_dec_setup( #ifndef NONBE_FIX_SBA_SIGNALING_BITS_B test(); -#ifndef NONBE_FIX_SBA_SIGNALING_BITS_B IF( LT_32( ivas_total_brate, IVAS_24k4 ) || GE_32( ivas_total_brate, IVAS_256k ) ) { #endif diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index cd87eb065..2daeb21e8 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -699,19 +699,11 @@ void ivas_mct_core_enc_fx( { nAvailBits = sub( nAvailBits, IVAS_FORMAT_SIGNALING_NBITS_EXTENDED ); nAvailBits = sub( nAvailBits, SBA_ORDER_BITS + SBA_PLANAR_BITS ); -#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B - /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ - if ( EQ_16( ivas_format, SBA_ISM_FORMAT ) ) - { - nAvailBits = sub( nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS ); - } -#else - test(); #ifdef NONBE_FIX_SBA_SIGNALING_BITS_B /*MCT is used at bitrates > 80 kbps and additional 1 bit is present at these bitrates*/ if ( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { - nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS; + nAvailBits = sub( nAvailBits, IVAS_COMBINED_FORMAT_SIGNALLING_BITS ); } #else if ( EQ_32( ivas_format, SBA_ISM_FORMAT ) && GT_16( nChannels, 4 ) ) -- GitLab From 4e59bf0de60b0f530c0af89be8f7862235d1a39f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 5 Aug 2025 12:56:20 +0200 Subject: [PATCH 24/25] various fixes to instrumentation --- lib_com/ivas_osba_com_fx.c | 12 +++++++----- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 3 ++- lib_dec/ivas_init_dec_fx.c | 2 +- lib_dec/ivas_sba_dec_fx.c | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_osba_com_fx.c b/lib_com/ivas_osba_com_fx.c index a795b6628..79ce8443a 100644 --- a/lib_com/ivas_osba_com_fx.c +++ b/lib_com/ivas_osba_com_fx.c @@ -47,24 +47,26 @@ ISM_MODE ivas_osba_ism_mode_select( { ISM_MODE ism_mode = ISM_MODE_NONE; - switch ( nchan_ism ) + SWITCH( nchan_ism ) { case 1: - if ( ivas_total_brate >= IVAS_96k ) + if ( GE_32( ivas_total_brate, IVAS_96k ) ) { ism_mode = ISM_SBA_MODE_DISC; + move32(); } - break; + BREAK; case 2: case 3: case 4: - if ( ivas_total_brate >= IVAS_128k ) + if ( GE_32( ivas_total_brate, IVAS_128k ) ) { ism_mode = ISM_SBA_MODE_DISC; + move32(); } - break; + BREAK; } return ism_mode; diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index cd8fc6552..c8ad991af 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -450,7 +450,8 @@ ivas_error ivas_corecoder_dec_reconfig_fx( test(); #ifdef NONBE_FIX_ISM_XOVER_BR test(); - if ( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + test(); + IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) #else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) #endif diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 0b9b4bd70..2f57d3a98 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1834,7 +1834,7 @@ ivas_error ivas_init_decoder_fx( move16(); #ifdef NONBE_FIX_ISM_XOVER_BR { - int16_t n_all; + Word16 n_all; n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 77f8f34c0..0afec8a42 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -514,6 +514,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; + move16(); #endif IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { @@ -618,6 +619,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } #ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; + move16(); #endif nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ st_ivas->ism_mode = ISM_MODE_NONE; -- GitLab From 46b60697580444c36a6049e8db66b121ade705ea Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 5 Aug 2025 12:58:16 +0200 Subject: [PATCH 25/25] missing #ifdef ... #endif --- lib_com/ivas_prot_fx.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index c2ce92b91..0b0c1a755 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3885,11 +3885,12 @@ void ivas_osba_data_close_fx( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); +#ifdef NONBE_FIX_ISM_XOVER_BR ISM_MODE ivas_osba_ism_mode_select( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 nchan_ism /* i : number of input ISM's */ ); - +#endif void ivas_set_ism_importance_interformat_fx( const Word32 ism_total_brate, /* i/o: ISms total bitrate */ -- GitLab