Commit b7231701 authored by vaclav's avatar vaclav
Browse files

updates

parent a6869b2a
Loading
Loading
Loading
Loading
+41 −42
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 );
        }

@@ -941,25 +972,7 @@ ivas_error ivas_init_decoder(
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
        {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER

            st_ivas->hOutSetup.ambisonics_order = st_ivas->sba_order;
            switch ( st_ivas->sba_order )
            {
                case 1:
                    hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_FOA );
                    break;

                case 2:
                    hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA2 );
                    break;

                case 3:
                    hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
                    break;

                default:
                    assert( 0 && "Invalid SBA 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
@@ -988,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 );
@@ -1001,37 +1021,16 @@ 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 )
    {
#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
        st_ivas->hOutSetup.ambisonics_order = st_ivas->sba_order;
        switch ( st_ivas->sba_order )
        {
            case 1:
                st_ivas->intern_config = IVAS_AUDIO_CONFIG_FOA;
                break;

            case 2:
                st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA2;
                break;

            case 3:
                st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3;
                break;

            default:
                assert( 0 && "Invalid SBA order!" );
        }
        st_ivas->hOutSetup.output_config = st_ivas->intern_config;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
#else
        st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
        st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3;
        st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
#endif
    }

#endif
    /* Only initialize transport setup if it is used */
    if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
    {
+4 −3
Original line number Diff line number Diff line
@@ -326,8 +326,9 @@ 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
            {