Commit dd004cdd authored by vaclav's avatar vaclav
Browse files

more optimization

parent a34ed96e
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -1487,6 +1487,16 @@ ivas_error ivas_init_decoder(
        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 );
    }
#ifdef FIX_1419_MONO_STEREO_UMX
    else if ( st_ivas->ivas_format == MONO_FORMAT )
    {
        st_ivas->intern_config = IVAS_AUDIO_CONFIG_MONO;
    }
    else if ( st_ivas->ivas_format == STEREO_FORMAT )
    {
        st_ivas->intern_config = IVAS_AUDIO_CONFIG_STEREO;
    }
#endif
    else
    {
        ivas_output_init( &( st_ivas->hOutSetup ), output_config );
@@ -1499,13 +1509,6 @@ ivas_error ivas_init_decoder(
        st_ivas->hOutSetup.output_config = st_ivas->intern_config;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
    }
#ifdef FIX_1419_MONO_STEREO_UMX

    if ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT )
    {
        st_ivas->transport_config = ( st_ivas->ivas_format == MONO_FORMAT ) ? IVAS_AUDIO_CONFIG_MONO : IVAS_AUDIO_CONFIG_STEREO;
    }
#endif

    /* Only initialize transport setup if it is used */
    if ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID )
+10 −0
Original line number Diff line number Diff line
@@ -1959,6 +1959,13 @@ int16_t ivas_jbm_dec_get_num_tc_channels(

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;

#ifdef FIX_1435_MOVE_STEREO_PANNING
    if ( st_ivas->ivas_format == MONO_FORMAT )
    {
        num_tc = 1;
    }
    else if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 )
#else
#ifndef FIX_1419_MONO_STEREO_UMX /* since we support more output formats for mono, this is no longer sensible; leave it at the default from above */
    if ( st_ivas->ivas_format == MONO_FORMAT )
    {
@@ -1967,6 +1974,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
    else if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 )
#else
    if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 )
#endif
#endif
    {
        num_tc = 1;
@@ -2075,10 +2083,12 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
            }
        }
    }
#ifndef FIX_1435_MOVE_STEREO_PANNING
    else if ( st_ivas->ivas_format == MONO_FORMAT && st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX )
    {
        num_tc = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN;
    }
#endif

    return num_tc;
}
+21 −4
Original line number Diff line number Diff line
@@ -2480,6 +2480,9 @@ static ivas_error ivas_dec_setup_all(

    if ( hIvasDec->mode == IVAS_DEC_MODE_EVS )
    {
#ifdef FIX_1435_MOVE_STEREO_PANNING
        *nTransportChannels = 1;
#else
        if ( hIvasDec->st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX )
        {
            *nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN;
@@ -2488,6 +2491,7 @@ static ivas_error ivas_dec_setup_all(
        {
            *nTransportChannels = 1;
        }
#endif
    }
    else
    {
@@ -5165,13 +5169,16 @@ static ivas_error evs_dec_main(
    DEC_CORE_HANDLE *hCoreCoder;
#ifndef FIX_1435_MOVE_STEREO_PANNING
    float mixer_left, mixer_rigth;
#endif
#ifdef FIX_1419_MONO_STEREO_UMX /* required now that mono can render to a higher number of output channels */
    float *p_output[MAX_TRANSPORT_CHANNELS];
#else
    float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN];
#endif
    int16_t ch, nOutSamples;
#else
    float *p_output[1];
    int16_t nOutSamples;
#endif
    ivas_error error;

    hCoreCoder = st_ivas->hSCE[0]->hCoreCoder;
@@ -5180,6 +5187,9 @@ static ivas_error evs_dec_main(

    mdct_switching_dec( hCoreCoder[0] );

#ifdef FIX_1435_MOVE_STEREO_PANNING
    p_output[0] = st_ivas->p_output_f[0];
#else
#ifdef FIX_1419_MONO_STEREO_UMX
    for ( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ )
#else
@@ -5194,6 +5204,7 @@ static ivas_error evs_dec_main(
        }
#endif
    }
#endif

    /* run the main EVS decoding routine */
    if ( hCoreCoder[0]->codec_mode == MODE1 )
@@ -5250,23 +5261,29 @@ static ivas_error evs_dec_main(
    }
#endif
#ifdef FIX_1419_MONO_STEREO_UMX
    if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->nchan_out == 1 )
    if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )
#else
    if ( st_ivas->hDecoderConfig->Opt_tsm )
#endif
    {
        /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */
        int16_t pcm_buf_local[L_FRAME48k];

#ifdef FIX_1419_MONO_STEREO_UMX
#ifdef DEBUGGING
        st_ivas->noClipping +=
#endif
            ivas_syn_output( &p_output[0], nOutSamples, 1, pcm_buf_local );
        mvs2r( pcm_buf_local, p_output[0], nOutSamples );
#else
        for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
        {
#ifdef DEBUGGING
            st_ivas->noClipping +=
#endif
                ivas_syn_output( &p_output[ch], nOutSamples, 1, pcm_buf_local );

            mvs2r( pcm_buf_local, p_output[ch], nOutSamples );
        }
#endif
    }

    return IVAS_ERR_OK;