Commit c6dff318 authored by vaclav's avatar vaclav
Browse files

add error returns

parent ae4bfda4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -786,9 +786,9 @@ float ism_dequant_meta(
);

ivas_error set_ism_metadata(
    ISM_METADATA_HANDLE hIsmMeta,                               /* i/o: ISM metadata handle */
    float azimuth,                                              /* i  : azimuth */
    float elevation                                            /* i  : elevation */
    ISM_METADATA_HANDLE hIsmMeta,                               /* o  : ISM metadata handle                         */
    const float azimuth,                                        /* i  : azimuth value                               */
    const float elevation                                       /* i  : elevation value                             */
);

ivas_error create_ism_metadata_enc(
@@ -3150,6 +3150,7 @@ ivas_error ivas_cldfb_dec_reconfig(
    int16_t numCldfbAnalyses_old,                               /* i  : number of CLDFB analysis instances in previous frame  */
    const int16_t numCldfbSyntheses_old                         /* i  : number of CLDFB synthesis instances in previous frame */
);

/*! r: Ambisonic (SBA) order */
int16_t ivas_sba_get_order(
    const int16_t nb_channels,                                  /* i  : Number of ambisonic channels            */
+56 −11
Original line number Diff line number Diff line
@@ -62,14 +62,34 @@ static ivas_error ivas_ism_bitrate_switching(
    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;

    ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
    if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    st_ivas->nSCE = st_ivas->nchan_transport;

    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS );
    /*-----------------------------------------------------------------*
     * Allocate, initialize, and configure SCE/CPE/MCT handles
     *-----------------------------------------------------------------*/

    ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old );
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */
    /*-----------------------------------------------------------------*
     * HP20 memories
     *-----------------------------------------------------------------*/

    if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
         * Initialize the needed renderer struct and destroy the unnecessary renderer struct
         *-----------------------------------------------------------------*/

    /* select the renderer */
    ivas_renderer_select( st_ivas );
@@ -102,7 +122,10 @@ static ivas_error ivas_ism_bitrate_switching(
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

            /* Open the TD Binaural renderer */
            ivas_td_binaural_open( st_ivas );
            if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else
        {
@@ -112,7 +135,11 @@ static ivas_error ivas_ism_bitrate_switching(
                free( st_ivas->hIsmRendererData );
                st_ivas->hIsmRendererData = NULL;
            }
            ivas_ism_renderer_open( st_ivas );

            if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
@@ -132,6 +159,7 @@ static ivas_error ivas_ism_bitrate_switching(
            {
                return error;
            }

            st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
#else
            ivas_crend_open( st_ivas );
@@ -144,13 +172,23 @@ static ivas_error ivas_ism_bitrate_switching(
        /* switching from Discrete ISM to ParamISM */

        /* Allocate and initialize the ParamISM struct */
        ivas_param_ism_dec_open( st_ivas );
        if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            /* Close the TD Binaural renderer */
            if ( st_ivas->hBinRendererTd != NULL )
@@ -176,8 +214,15 @@ static ivas_error ivas_ism_bitrate_switching(
        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            /* close the crend binaural renderer */
#ifdef FIX_197_CREND_INTERFACE
+9 −2
Original line number Diff line number Diff line
@@ -455,7 +455,10 @@ ivas_error ivas_ism_metadata_dec(

    if ( !bfi )
    {
        ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata );
        if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        for ( ch = 0; ch < *nchan_transport; ch++ )
        {
@@ -525,6 +528,7 @@ ivas_error create_ism_metadata_dec(
)
{
    int16_t ch;
    ivas_error error;

    /* allocate ISm metadata handles */
    for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ )
@@ -541,7 +545,10 @@ ivas_error create_ism_metadata_dec(
        ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] );
    }

    ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
    if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    return IVAS_ERR_OK;
}
+18 −5
Original line number Diff line number Diff line
@@ -730,6 +730,7 @@ static ivas_error ivas_mc_dec_reconfig(
            {
                ivas_param_mc_dec_close( &st_ivas->hParamMC );
                st_ivas->hParamMC = NULL;

                /* remove ls conversion if it was allocated by ParamMC */
                ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
            }
@@ -774,7 +775,10 @@ static ivas_error ivas_mc_dec_reconfig(
        }
        else
        {
            ivas_param_mc_dec_reconfig( st_ivas );
            if ( ( error = ivas_param_mc_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        /* De-allocate McMasa-related handles */
@@ -966,15 +970,24 @@ static ivas_error ivas_mc_dec_reconfig(
        }
    }

    /* re-configure hp20 memories */
    ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old );

    /*-----------------------------------------------------------------*
     * CLDFB instances
     * re-configure HP20 memories
     *-----------------------------------------------------------------*/

    ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old );
    if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * CLDFB instances
     *-----------------------------------------------------------------*/

    if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * Allocate the LFE handle that is coded seperately after the allocation of the core coders
+12 −4
Original line number Diff line number Diff line
@@ -349,20 +349,28 @@ ivas_error ivas_sba_dec_reconfigure(
     * Allocate, initialize, and configure SCE/CPE/MCT handles
     *-----------------------------------------------------------------*/

    ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS );
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * HP20 memories
     *-----------------------------------------------------------------*/

    ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old );
    if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * CLDFB instances
     *-----------------------------------------------------------------*/

    ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old );

    if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    return error;
}
Loading