Commit b3afc6c1 authored by vaclav's avatar vaclav
Browse files

review of error returns

parent 18f00132
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4930,7 +4930,7 @@ ivas_error ivas_td_binaural_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

void ivas_td_binaural_renderer(
ivas_error ivas_td_binaural_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float output[][L_FRAME48k],                                 /* i/o: SCE channels / Binaural synthesis       */
    const int16_t output_frame                                  /* i  : output frame length                     */
+8 −2
Original line number Diff line number Diff line
@@ -215,7 +215,10 @@ ivas_error ivas_dec(
            /* Binaural rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
                ivas_td_binaural_renderer( st_ivas, output, output_frame );
                if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
            {
@@ -451,7 +454,10 @@ ivas_error ivas_dec(
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
                ivas_td_binaural_renderer( st_ivas, output, output_frame );
                if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                ivas_binaural_add_LFE( st_ivas, output_frame, output );
            }
+5 −4
Original line number Diff line number Diff line
@@ -671,13 +671,14 @@ ivas_error ivas_mc_dec_config(
 *-------------------------------------------------------------------------*/

static ivas_error ivas_mc_dec_reconfig(
    Decoder_Struct *st_ivas /* i/o: IVAS encoder structure      */
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
)
{
    int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old;
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
    int32_t new_brate_SCE, new_brate_CPE, ivas_total_brate;
    RENDERER_TYPE renderer_type_old;
    Decoder_State *st;
    ivas_error error;
    MC_MODE mc_mode, last_mc_mode;

@@ -877,7 +878,7 @@ static ivas_error ivas_mc_dec_reconfig(
       set correct mct_chan_mode and init missing static mem (IGF, HQ)  and some config (TNS)  do it here since it is _very_ MC specific */
    if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS )
    {
        Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1];
        st = st_ivas->hCPE[1]->hCoreCoder[1];

        if ( st_ivas->nchan_transport == 3 )
        {
@@ -927,7 +928,7 @@ static ivas_error ivas_mc_dec_reconfig(
#ifdef DEBUGGING
        assert( st_ivas->hCPE[1] != NULL );
#endif
        Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1];
        st = st_ivas->hCPE[1]->hCoreCoder[1];
        st->mct_chan_mode = MCT_CHAN_MODE_LFE;
        st->hTcxCfg->fIsTNSAllowed = 0;
    }
@@ -957,7 +958,7 @@ static ivas_error ivas_mc_dec_reconfig(

    if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS )
    {
        Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1];
        st = st_ivas->hCPE[1]->hCoreCoder[1];

        /* TCX-LTP */
        if ( st->hTcxLtpDec == NULL )
+10 −9
Original line number Diff line number Diff line
@@ -65,16 +65,17 @@ ivas_error ivas_td_binaural_open(
 * and renders the current frame.
 *---------------------------------------------------------------------*/

void ivas_td_binaural_renderer(
ivas_error ivas_td_binaural_renderer(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure            */
    float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */
    const int16_t output_frame  /* i  : output frame length               */
)
{
    return ivas_td_binaural_renderer_unwrap(
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    ivas_td_binaural_renderer_unwrap( st_ivas->hReverb,
        st_ivas->hReverb,
#else
    ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame,
        st_ivas->hRenderConfig, st_ivas->ini_frame,
#ifdef FIX_197_CREND_INTERFACE
        st_ivas->hCrendWrapper,
#else
+27 −4
Original line number Diff line number Diff line
@@ -1400,10 +1400,12 @@ static ivas_error ivas_rend_initCrend(
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" );
    }

    if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" );
    }

    if ( hHrtf == NULL )
    {
        if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK )
@@ -1903,14 +1905,17 @@ ivas_error ivas_rend_initCrendWrapper(
    CREND_WRAPPER_HANDLE *pCrend )
{
    int16_t i;

    if ( pCrend == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" );
    }

    if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" );
    }

    ( *pCrend )->binaural_latency_ns = 0;
    ( *pCrend )->hCrend = NULL;
    ( *pCrend )->hHrtfCrend = NULL;
@@ -2173,6 +2178,7 @@ ivas_error ivas_rend_openCrend(
#else
    pCrend->hCrend = hCrend;
#endif

    return IVAS_ERR_OK;
}

@@ -2355,9 +2361,17 @@ static ivas_error ivas_rend_crendConvolver(
    float *pFreq_filt_re, *pFreq_filt_im;
    float pOut[L_FRAME48k * 2];
    float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k];
    ivas_error error;

    if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    getAudioConfigNumChannels( inConfig, &nchan_in );
    getAudioConfigNumChannels( outConfig, &nchan_out );
    if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES;

@@ -2528,7 +2542,11 @@ ivas_error ivas_rend_crendProcess(
#endif

    inConfigType = getAudioConfigType( inRendConfig );
    getAudioConfigNumChannels( outRendConfig, &nchan_out );

    if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );
#ifdef FIX_197_CREND_INTERFACE
@@ -2554,7 +2572,12 @@ ivas_error ivas_rend_crendProcess(
                /* get current subframe quaternion and convert to euler angles */
                Quat2Euler( hHeadTrackData->Quaternions[subframe_idx], &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) );
                ivas_orient_trk_SetAbsoluteOrientation( pCrend->hCrend->hTrack, pCrend->hCrend->m_fYaw, pCrend->hCrend->m_fPitch, pCrend->hCrend->m_fRoll );
                ivas_orient_trk_Process( pCrend->hCrend->hTrack );

                if ( ( error = ivas_orient_trk_Process( pCrend->hCrend->hTrack ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                ivas_orient_trk_GetTrackedOrientation( pCrend->hCrend->hTrack, &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) );
            }

Loading