From fb8f2ec871d7506e5f8c392207f53d63acee8bc1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 9 Aug 2025 20:48:25 +0200 Subject: [PATCH 1/2] Port MR 1638 from float to ivas-float-update --- lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 46 ++++++++++++++++++++++++++++++++++++ lib_dec/ivas_output_config.c | 6 ++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 266562ab1..501a37ff4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -200,6 +200,7 @@ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */ #define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ +#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 73cf078c0..199d22c53 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -58,8 +58,12 @@ 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_1052_SBA_EXT +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER +static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const int16_t sba_order ); +#else static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order ); #endif +#endif static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas ); @@ -242,10 +246,25 @@ static ivas_error ivas_dec_init_split_rend( #ifdef NONBE_FIX_1052_SBA_EXT +#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 ) +#endif { AUDIO_CONFIG output_config; + output_config = IVAS_AUDIO_CONFIG_HOA3; + switch ( sba_order ) { case SBA_FOA_ORDER: @@ -258,8 +277,14 @@ 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; } #endif @@ -346,7 +371,11 @@ ivas_error ivas_dec_setup( #ifdef NONBE_FIX_1052_SBA_EXT 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 ); } #endif @@ -614,7 +643,11 @@ ivas_error ivas_dec_setup( #ifdef NONBE_FIX_1052_SBA_EXT 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 ); } #endif @@ -1177,7 +1210,11 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) #endif { +#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; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT @@ -1208,6 +1245,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 ); @@ -1224,6 +1268,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; @@ -1232,6 +1277,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 4d7f9acfe..bb7ee68de 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -330,7 +330,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; } -- GitLab From 879a461a4ed0916b3cdc356f46efb092ad333ca0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 10 Aug 2025 10:21:36 +0200 Subject: [PATCH 2/2] editorial to trigger pipeline --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 501a37ff4..6f13c8398 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -200,7 +200,7 @@ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */ #define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ -#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ +#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ /* #################### End BASOP porting switches ############################ */ -- GitLab