Commit 8431ddc1 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

Merge branch '1128-osba-ext-output-wrong-for-foa-hoa2-inputs' into 'main'

[non BE] Resolve "OSBA EXT output wrong for FOA/HOA2 inputs"

See merge request !1638
parents 758e94af bd98ba32
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 ######################### */
+44 −0
Original line number Diff line number Diff line
@@ -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 )
    {
+5 −1
Original line number Diff line number Diff line
@@ -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;
            }