Commit 066dfc28 authored by vaclav's avatar vaclav
Browse files

add FIX_1052_EXT_OUTPUT_SBA

parent a9c7f053
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@
#define FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI      /* FhG: move setting of pointers for parameter decoding so they are skipped in lost frames when they are not needed */
#define FIX_1043_JBM_MD_BUFFER                          /* VA: issue 1043: JBM MD handle allocation is avoided in non-JBM EXT operations */
#define FIX_1052_EXT_OUTPUT                             /* issue 1052: define EXT decoder output configuration for all IVAS formats */ 
#define FIX_1052_EXT_OUTPUT_SBA

/* #################### End BE switches ################################## */

+55 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ 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 FIX_1052_EXT_OUTPUT_SBA
static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const int16_t sba_order );

#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );

@@ -1158,6 +1162,12 @@ ivas_error ivas_init_decoder(
        {
            hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config );
        }
#ifdef FIX_1052_EXT_OUTPUT
        else if ( st_ivas->ivas_format == SBA_FORMAT )
        {
            hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
        }
#endif
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#else
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
@@ -1190,6 +1200,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 FIX_1052_EXT_OUTPUT_SBA
    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 );
    }
#endif
    else
    {
        ivas_output_init( &( st_ivas->hOutSetup ), output_config );
@@ -1418,7 +1435,11 @@ ivas_error ivas_init_decoder(
            return error;
        }

#ifdef FIX_1052_EXT_OUTPUT_SBA
        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 )
            {
@@ -3193,3 +3214,37 @@ static ivas_error doSanityChecks_IVAS(

    return IVAS_ERR_OK;
}


#ifdef FIX_1052_EXT_OUTPUT_SBA
/*-------------------------------------------------------------------*
 * 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
@@ -349,7 +349,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 FIX_1052_EXT_OUTPUT_SBA
            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
@@ -1556,7 +1556,11 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef FIX_1052_EXT_OUTPUT_SBA
    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 );
    }
@@ -1565,7 +1569,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 FIX_1052_EXT_OUTPUT_SBA
        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++ )
            {
@@ -1654,7 +1663,11 @@ void ivas_spar_dec_upmixer_sf(
        }
    }

#ifdef FIX_1052_EXT_OUTPUT_SBA
    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 );
    }