Commit ffd5f0b3 authored by multrus's avatar multrus
Browse files

Merge branch '1657_basop_osbaExt' into 'main'

[non-BE] Port MR 1638 from float to main

Closes #1657

See merge request !2030
parents a1f42da7 0133e484
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 ############################ */
+55 −4
Original line number Diff line number Diff line
@@ -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 ) )
+5 −1
Original line number Diff line number Diff line
@@ -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();