From 866ef9cffbb30d43baa9419350aac6a95f9a4020 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sat, 9 Aug 2025 21:12:25 +0200 Subject: [PATCH 1/2] Port MR 1638 from float to main --- lib_com/options.h | 1 + lib_dec/ivas_init_dec_fx.c | 59 ++++++++++++++++++++++++++++++--- lib_dec/ivas_output_config_fx.c | 6 +++- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c58d6533d..bc302004f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,6 +126,7 @@ #define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #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_fx.c b/lib_dec/ivas_init_dec_fx.c index fc69b8a50..a2e9ad0a1 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -56,8 +56,12 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, Word16 *num_bits_re 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 Word16 sba_order ); #endif +#endif static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas ); @@ -262,24 +266,50 @@ 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 Word16 sba_order ) +#endif { AUDIO_CONFIG output_config; + output_config = IVAS_AUDIO_CONFIG_HOA3; - switch ( sba_order ) + move32(); + + SWITCH( sba_order ) { case SBA_FOA_ORDER: output_config = IVAS_AUDIO_CONFIG_FOA; - break; + move32(); + BREAK; case SBA_HOA2_ORDER: output_config = IVAS_AUDIO_CONFIG_HOA2; - break; + move32(); + BREAK; case SBA_HOA3_ORDER: output_config = IVAS_AUDIO_CONFIG_HOA3; - break; + move32(); + BREAK; default: +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + output_config = IVAS_AUDIO_CONFIG_INVALID; + move32(); + BREAK; +#else assert( 0 ); +#endif } + return output_config; } #endif @@ -381,7 +411,11 @@ ivas_error ivas_dec_setup( #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( 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 @@ -702,7 +736,11 @@ ivas_error ivas_dec_setup( #ifdef NONBE_FIX_1052_SBA_EXT IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) && EQ_32( 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 @@ -1364,7 +1402,11 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( 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 move16(); hDecoderConfig->nchan_out = add( hDecoderConfig->nchan_out, st_ivas->nchan_ism ); move16(); @@ -1402,6 +1444,13 @@ ivas_error ivas_init_decoder_fx( st_ivas->intern_config = st_ivas->transport_config; move32(); } +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( 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 ); @@ -1422,6 +1471,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config ); move16(); } +#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER test(); IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { @@ -1434,6 +1484,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); move16(); } +#endif /* Only initialize transport setup if it is used */ IF( NE_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_INVALID ) ) diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index de1066cd5..bb604732f 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -407,7 +407,11 @@ void ivas_renderer_select( *internal_config = IVAS_AUDIO_CONFIG_FOA; move16(); } - ELSE +#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER + ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) +#else + IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) +#endif { *internal_config = IVAS_AUDIO_CONFIG_HOA3; move16(); -- GitLab From 0133e48440af5d1a368a4f72bd92fe369b55e38d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 10 Aug 2025 10:20:47 +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 bc302004f..81f280e9c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,7 +126,7 @@ #define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #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