diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index d0342295a7f34d0dc2715d08f9218aa34b873fd0..223f837a2e1685afeedb952a5137dab7b902b3a6 100644
--- a/Workspace_msvc/lib_com.vcxproj
+++ b/Workspace_msvc/lib_com.vcxproj
@@ -205,6 +205,7 @@
+
diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters
index b37c6ffb5f64cce4d0be9ab275e35086e0bb6a36..b7c9cc3bdb54a4ed12f99cf0334067da83e0728a 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
+
@@ -549,4 +552,4 @@
{b95b7bed-a666-4a00-9332-2b528638503e}
-
\ No newline at end of file
+
diff --git a/lib_com/ivas_osba_com.c b/lib_com/ivas_osba_com.c
new file mode 100644
index 0000000000000000000000000000000000000000..fcb4f8aeac3ef5b40a6d526230885ccc9a98601c
--- /dev/null
+++ b/lib_com/ivas_osba_com.c
@@ -0,0 +1,69 @@
+/******************************************************************************************************
+
+ (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.h"
+#include "prot.h"
+#include "ivas_rom_com.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+
+/*! r : ISM format mode */
+ISM_MODE ivas_osba_ism_mode_select(
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate */
+ const int16_t nchan_ism /* i : number of input ISM's */
+)
+{
+ 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;
+}
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 75255089fae044cd474e18dbc68768db15afdf16..2570b0fb0b9ccba62ae6ee6928e4f7ce4e18b24b 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -5612,7 +5612,10 @@ void ivas_osba_data_close(
SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */
);
-
+ISM_MODE ivas_osba_ism_mode_select(
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate */
+ const int16_t nchan_ism /* i : number of input ISM's */
+);
/*----------------------------------------------------------------------------------*
* OMASA prototypes
*---------------------------------------------------------------------------------*/
diff --git a/lib_com/options.h b/lib_com/options.h
index 54ae56fbe83956e29fa13df906562452c8a31c5b..7dd0ba57d3ee910d474c827457a4edd6ea2fba2d 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -172,6 +172,7 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */
+#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
#define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */
#define NONBE_FIX_SBA_SIGNALING_BITS_B /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c
index fd7ce6c8037640251469e0ae619931b6c30f26e0..5f5e787c9407a72f4d6061cc9294fd8e1d4d911d 100644
--- a/lib_dec/ivas_corecoder_dec_reconfig.c
+++ b/lib_dec/ivas_corecoder_dec_reconfig.c
@@ -270,7 +270,11 @@ ivas_error ivas_corecoder_dec_reconfig(
}
else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ if ( ( error = mct_dec_reconfigure( st_ivas, nchan_transport_real != nchan_transport_old ) ) != IVAS_ERR_OK )
+#else
if ( ( error = mct_dec_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK )
+#endif
{
return error;
}
@@ -351,7 +355,11 @@ ivas_error ivas_corecoder_dec_reconfig(
* Set CNA/CNG flags
*-----------------------------------------------------------------*/
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
+#else
if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
+#endif
{
ivas_sba_set_cna_cng_flag( st_ivas );
}
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index 1bc65f8e29a87bb7504b6660d0b0c4dd26081782..3ed0c0d21c368e45e8a24594bbf1a6e3b8fc771d 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -474,7 +474,6 @@ ivas_error ivas_dec_setup(
st_ivas->sba_order = 3;
}
#endif
-
if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -496,11 +495,23 @@ 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 + 1 ) >> 1;
+ }
+#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
+#endif
}
}
-
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC )
+#else
if ( ivas_total_brate >= IVAS_256k )
+#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
}
@@ -1582,7 +1593,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 + 1 ) >> 1;
+ }
+#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_osba_dec.c b/lib_dec/ivas_osba_dec.c
index 37ddcd37d29b235a163628b5b70395e57bf6e0a5..f41674ccfa377ab018e751dfa88eab44af5f7f26 100644
--- a/lib_dec/ivas_osba_dec.c
+++ b/lib_dec/ivas_osba_dec.c
@@ -155,6 +155,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
return error;
}
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData );
+#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c
index 1f1a04221fced6c4842877ae57a5cabce1a23478..110b45b15ff39221701ad10762f723d445ca9059 100644
--- a/lib_dec/ivas_sba_dec.c
+++ b/lib_dec/ivas_sba_dec.c
@@ -70,7 +70,11 @@ void ivas_sba_set_cna_cng_flag(
st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1;
st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1;
}
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ else if ( st_ivas->nchan_transport == 2 && st_ivas->ivas_format != SBA_ISM_FORMAT )
+#else
else if ( st_ivas->nchan_transport == 2 )
+#endif
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
@@ -124,6 +128,9 @@ ivas_error ivas_sba_dec_reconfigure(
ivas_error error;
ISM_MODE ism_mode_old;
int16_t granularity_new;
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ int16_t nchan_transport;
+#endif
ism_mode_old = st_ivas->ism_mode;
hDecoderConfig = st_ivas->hDecoderConfig;
@@ -143,7 +150,11 @@ ivas_error ivas_sba_dec_reconfigure(
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC )
+#else
if ( ivas_total_brate >= IVAS_256k )
+#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
}
@@ -450,6 +461,9 @@ ivas_error ivas_sba_dec_reconfigure(
* Allocate, initialize, and configure SCE/CPE/MCT handles
*-----------------------------------------------------------------*/
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport = st_ivas->nchan_transport;
+#endif
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
{
if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
@@ -519,7 +533,12 @@ ivas_error ivas_sba_dec_reconfigure(
return error;
}
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport += st_ivas->nchan_ism;
+ st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
+#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 )
{
@@ -533,15 +552,26 @@ ivas_error ivas_sba_dec_reconfigure(
{
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
}
+
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport = st_ivas->nchan_transport;
+#endif
nchan_transport_old += st_ivas->nchan_ism;
+
st_ivas->ism_mode = ISM_MODE_NONE;
}
else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport = st_ivas->nchan_transport + st_ivas->nchan_ism;
+ st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
+ nchan_transport_old += st_ivas->nchan_ism;
+#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
nCPE_old = st_ivas->nCPE;
nchan_transport_old = st_ivas->nchan_transport;
nchan_transport_old += st_ivas->nchan_ism;
+#endif
}
}
diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c
index be39e263b904b27eae16ba70a5bba8e0a3c99379..c7768972f61aae109dfc34a4a87cabb59f9f6916 100644
--- a/lib_enc/ivas_corecoder_enc_reconfig.c
+++ b/lib_enc/ivas_corecoder_enc_reconfig.c
@@ -446,7 +446,11 @@ ivas_error ivas_corecoder_enc_reconfig(
}
else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ if ( ( error = mct_enc_reconfigure( st_ivas, nchan_transport_old_real != nchan_transport_real ) ) != IVAS_ERR_OK )
+#else
if ( ( error = mct_enc_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK )
+#endif
{
return error;
}
diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c
index a394f1609011619c4f1f25eea95279f8646622f2..0371378d73e0d2e5e621732fc6128260989115c3 100644
--- a/lib_enc/ivas_init_enc.c
+++ b/lib_enc/ivas_init_enc.c
@@ -674,10 +674,14 @@ ivas_error ivas_init_encoder(
{
st_ivas->ism_mode = ISM_MODE_NONE;
+#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 ( ivas_total_brate >= IVAS_256k )
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
}
+#endif
if ( ( error = ivas_ism_metadata_enc_create( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK )
{
@@ -732,8 +736,17 @@ 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 + 1 ) >> 1;
+ }
+#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 a2b857b9d8558a72b5bbc8ed74de1a8d864f9bcb..38f927b10925938601ee6e68ede3219d3138fb3e 100644
--- a/lib_enc/ivas_osba_enc.c
+++ b/lib_enc/ivas_osba_enc.c
@@ -182,9 +182,13 @@ ivas_error ivas_osba_enc_reconfig(
ivas_error error;
ENCODER_CONFIG_HANDLE hEncoderConfig;
+
error = IVAS_ERR_OK;
hEncoderConfig = st_ivas->hEncoderConfig;
ivas_total_brate = hEncoderConfig->ivas_total_brate;
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ int16_t nchan_transport;
+#endif
if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate )
{
@@ -197,6 +201,9 @@ ivas_error ivas_osba_enc_reconfig(
spar_reconfig_flag = 0;
old_ism_mode = st_ivas->ism_mode;
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism );
+#else
if ( ivas_total_brate >= IVAS_256k )
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
@@ -205,9 +212,11 @@ ivas_error ivas_osba_enc_reconfig(
{
st_ivas->ism_mode = ISM_MODE_NONE;
}
+#endif
nchan_transport_old = st_ivas->nchan_transport;
nCPE_old = st_ivas->nCPE;
nSCE_old = st_ivas->nSCE;
+
st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order );
analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order );
nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands;
@@ -334,20 +343,40 @@ 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
if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ {
+ nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
+ st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
+ }
+#else
st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
+#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;
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport = st_ivas->nchan_transport;
+#endif
}
else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
+#ifdef NONBE_FIX_ISM_XOVER_BR
+ nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism;
+ nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
+ st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
+#else
st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
nCPE_old = st_ivas->nCPE;
nchan_transport_old = st_ivas->nchan_transport;
nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism;
+#endif
}
if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK )