diff --git a/lib_com/options.h b/lib_com/options.h index b530fac825a39908c1ce7e8371531650fc4088f3..73f344208df16718584689c66710ea0acb3c543a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,8 @@ #define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */ #define NONBE_1131_ACELP_OOB /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */ +#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ + /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 66d677a65a45370ba645d3e068f82de70e6cc874..bc61b273240e468c5137f28d8180a48a9043769f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -54,13 +54,29 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); + +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER +/*-------------------------------------------------------------------* + * ivas_set_audio_config_from_sba_order() + * + * + *-------------------------------------------------------------------*/ + +/*! r: audio configuration */ +static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) +#else static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order ); static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order ) +#endif { AUDIO_CONFIG output_config; + output_config = IVAS_AUDIO_CONFIG_HOA3; + switch ( sba_order ) { case SBA_FOA_ORDER: @@ -73,11 +89,18 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_ord output_config = IVAS_AUDIO_CONFIG_HOA3; break; default: +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + output_config = IVAS_AUDIO_CONFIG_INVALID; + break; +#else assert( 0 ); +#endif } + return output_config; } + /*-------------------------------------------------------------------* * ivas_dec_setup() * @@ -158,7 +181,11 @@ ivas_error ivas_dec_setup( st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read]; if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); +#else st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order ); +#endif st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); } @@ -402,7 +429,11 @@ ivas_error ivas_dec_setup( if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); +#else st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order ); +#endif st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); } @@ -940,7 +971,11 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) ); +#else hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); +#endif hDecoderConfig->nchan_out += st_ivas->nchan_ism; } else if ( st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) @@ -966,6 +1001,13 @@ ivas_error ivas_init_decoder( ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config ); st_ivas->intern_config = st_ivas->transport_config; } +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); + ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config ); + } +#endif else { ivas_output_init( &( st_ivas->hOutSetup ), output_config ); @@ -979,6 +1021,7 @@ ivas_error ivas_init_decoder( st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config ); } +#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; @@ -987,6 +1030,7 @@ ivas_error ivas_init_decoder( st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); } +#endif /* Only initialize transport setup if it is used */ if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 7284155d9eab659341c722d0536d06216ebfc2c4..d221d11961e004149553bfd16797c0f06c4d4ed1 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -326,7 +326,11 @@ void ivas_renderer_select( { *internal_config = IVAS_AUDIO_CONFIG_FOA; } - else +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) +#else + if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) +#endif { *internal_config = IVAS_AUDIO_CONFIG_HOA3; }