diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 31e924d06520f7efcaa100a0aca7d5c3ed4403bc..c48c528535b8ca3c30a74902945badf5fdd17c91 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 692a6dbbaa7a2cb2a5b24c34bef52767702f3b54..67aafdc6e4e7355554213a24725719086dfba9c1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,6 +111,7 @@ #define NON_BE_FIX_1041_USE_OLD_CNG_LSPS_IF_NONSTAB /* FhG: fix bug in TD MDCT-Stereo concealment */ #define NONBE_FIX_1063_DIV_BY_ZERO_SUMNRG /* VoiceAge: issue 1063: division by zero for angle_rot feature in the UNCLR classifier */ #define FIX_1060_USAN_ARRAY_BOUNDS /* FhG: issue 1060: USAN array-bounds errors */ +#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 3fe15331c60b3e9dc6740a9e4d97b2011f5e6e87..e119b37c4dea95acc6ca2da02297abff2e7a1197 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -477,14 +477,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 ) ); @@ -492,11 +497,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 ( 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]; + 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 71890120bfdece03191de1ec21b2313a6f278756..4eacd287bdc56699d66360b9f58c2df8727b3f41 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 ( EQ_32( 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 8143a8c33389b5f70e273554410ced1b7ebd2dff..d7f34022bb0d80d1927c2fc88e3d86b0c842de85 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 ); }