Commit 561caa3e authored by vaclav's avatar vaclav
Browse files

define NONBE_FIX_1052_SBA_EXT_FIX

parent 8dbfff75
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@
#define NONBE_FIX_SBA_SIGNALING_BITS_B                  /* FhG: issue 1061: option B: signal sba order additionally in OSBA */

#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */

/* ##################### End NON-BE switches ########################### */

+74 −1
Original line number Diff line number Diff line
@@ -60,8 +60,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_1052_SBA_EXT_FIX
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

#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
@@ -245,6 +249,7 @@ static ivas_error ivas_dec_init_split_rend(
#endif

#ifdef NONBE_FIX_1052_SBA_EXT
#ifndef NONBE_FIX_1052_SBA_EXT_FIX
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
{
    AUDIO_CONFIG output_config;
@@ -265,6 +270,8 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_ord
    }
    return output_config;
}

#endif
#endif

/*-------------------------------------------------------------------*
@@ -353,12 +360,14 @@ ivas_error ivas_dec_setup(
            /* read Ambisonic (SBA) order */
            st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
            st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
#ifndef NONBE_FIX_1052_SBA_EXT_FIX
#ifdef NONBE_FIX_1052_SBA_EXT
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
                st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
                st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
            }
#endif
#endif

            num_bits_read += SBA_ORDER_BITS;
@@ -630,6 +639,7 @@ ivas_error ivas_dec_setup(
                break;
        }

#ifndef NONBE_FIX_1052_SBA_EXT_FIX
#ifdef NONBE_FIX_1052_SBA_EXT
        if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
@@ -637,7 +647,7 @@ ivas_error ivas_dec_setup(
            st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
        }
#endif

#endif
        if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT )
        {
            int16_t nchan_transport_old, nchan_transport;
@@ -1190,7 +1200,15 @@ ivas_error ivas_init_decoder(

    if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
    {
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        if ( st_ivas->ivas_format == SBA_FORMAT )
        {
            hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
        }
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#else
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
        {
            hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
            hDecoderConfig->nchan_out += st_ivas->nchan_ism;
@@ -1213,7 +1231,24 @@ ivas_error ivas_init_decoder(

    st_ivas->intern_config = output_config;

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == MC_FORMAT )
    {
        ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
        st_ivas->intern_config = st_ivas->transport_config;
    }
    else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == SBA_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 );
    }
    else
    {
        ivas_output_init( &( st_ivas->hOutSetup ), output_config );
    }
#else
    ivas_output_init( &( st_ivas->hOutSetup ), output_config );
#endif

    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
    {
@@ -1436,7 +1471,11 @@ ivas_error ivas_init_decoder(
            return error;
        }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
#else
        if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
#endif
        {
            if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
            {
@@ -3230,3 +3269,37 @@ static ivas_error doSanityChecks_IVAS(

    return IVAS_ERR_OK;
}


#ifdef NONBE_FIX_1052_SBA_EXT_FIX
/*-------------------------------------------------------------------*
 * 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   */
)
{
    AUDIO_CONFIG audio_config;

    switch ( sba_order )
    {
        case SBA_FOA_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_FOA;
            break;
        case SBA_HOA2_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_HOA2;
            break;
        case SBA_HOA3_ORDER:
            audio_config = IVAS_AUDIO_CONFIG_HOA3;
            break;
        default:
            audio_config = IVAS_AUDIO_CONFIG_INVALID;
    }

    return audio_config;
}
#endif
+8 −0
Original line number Diff line number Diff line
@@ -346,7 +346,15 @@ void ivas_renderer_select(

        if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
        {
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
                /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
            }
            else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
#else
            if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
#endif
            {
                *internal_config = output_config;
            }
+13 −0
Original line number Diff line number Diff line
@@ -1568,7 +1568,11 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
#else
    if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#endif
    {
        ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf );
    }
@@ -1577,7 +1581,12 @@ void ivas_spar_dec_upmixer_sf(
    {
        md_idx = hSpar->render_to_md_map[ts + slot_idx_start];
        ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat );

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
        if ( hDecoderConfig->ivas_total_brate < IVAS_24k4 && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) )
#else
        if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#endif
        {
            for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
            {
@@ -1666,7 +1675,11 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO && !( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA ) )
#else
    if ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO )
#endif
    {
        ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im );
    }