Commit 47f0d920 authored by vaclav's avatar vaclav
Browse files

avoid ternary operator in ivas_core_dec()

parent 3c15228a
Loading
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -93,12 +93,13 @@ ivas_error ivas_core_dec(
    int16_t last_element_mode;
    int16_t nchan_out;
    float *save_hb_synth;
    IVAS_FORMAT ivas_format;
    ivas_error error;

    error = IVAS_ERR_OK;

    push_wmops( "ivas_core_dec" );

    error = IVAS_ERR_OK;

    /*------------------------------------------------------------------*
     * General initialization
     *-----------------------------------------------------------------*/
@@ -106,6 +107,12 @@ ivas_error ivas_core_dec(
    use_cldfb_for_dft = 0;
    tdm_LRTD_flag = -1;

    ivas_format = UNDEFINED_FORMAT;
    if ( st_ivas != NULL )
    {
        ivas_format = st_ivas->ivas_format;
    }

    if ( hSCE != NULL )
    {
        sts = hSCE->hCoreCoder;
@@ -218,7 +225,7 @@ ivas_error ivas_core_dec(
    } /* n_channels loop */

    /* MDCT stereo -> DFT stereo switching */
    if ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_MDCT && hCPE->element_mode == IVAS_CPE_DFT )
    if ( last_element_mode == IVAS_CPE_MDCT && sts[0]->element_mode == IVAS_CPE_DFT )
    {
        int16_t ovl, fade_len;
        if ( sts[0]->L_frame != sts[0]->last_L_frame )
@@ -341,7 +348,7 @@ ivas_error ivas_core_dec(
        if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT )
        {
            /* TCX decoder */
            stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format
            stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, ivas_format
#ifndef DISCRETE_ISM_DTX_CNG
                                 ,
                                 st_ivas == NULL ? 0 : st_ivas->ism_mode
@@ -452,9 +459,9 @@ ivas_error ivas_core_dec(
        }

#ifdef FIX_ISM_DTX_CLICKS
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK )
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ivas_format, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode ) ) != IVAS_ERR_OK )
#else
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK )
        if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
@@ -468,7 +475,7 @@ ivas_error ivas_core_dec(
        }

        /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */
        if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_DFT ) ) )
        if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || last_element_mode == IVAS_CPE_DFT ) )
        {
            mvr2r( sts[0]->previoussynth, sts[1]->previoussynth, st->hTcxDec->L_frameTCX );
        }
@@ -598,7 +605,7 @@ ivas_error ivas_core_dec(

            /* Smooth transitions when switching between different technologies */
            if ( !( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE ) && st->last_core == ACELP_CORE ) &&
                 ( st->extl != st->last_extl || ( st->extl == st->last_extl && ( st->core ^ st->last_core ) == HQ_CORE ) ) && !( st->extl == SWB_CNG && st->last_extl == SWB_TBE ) && ( st->element_mode != IVAS_CPE_TD || ( hCPE->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) ) )
                 ( st->extl != st->last_extl || ( st->extl == st->last_extl && ( st->core ^ st->last_core ) == HQ_CORE ) ) && !( st->extl == SWB_CNG && st->last_extl == SWB_TBE ) && ( st->element_mode != IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) ) )
            {
                /* switching between BWE and TBE technologies */
                incr = (int16_t) ( L_FRAME / ( tmps + 0.5f ) );
@@ -644,7 +651,7 @@ ivas_error ivas_core_dec(
            }

            if ( ( st->element_mode != IVAS_CPE_TD && !use_cldfb_for_dft ) /* IVAS-19: the logic seems to be not consistent between TD and DFT stereo and SCE -> verification needed also whether 1) it is correct here and 2) the DFT->(LR)TD transition is correct */
                 || ( hCPE->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) )
                 || ( st->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) )
            {
                /* Delay hb_synth */
                delay_signal( hb_synth[n], output_frame, st->hb_prev_synth_buffer, tmps );
@@ -697,7 +704,7 @@ ivas_error ivas_core_dec(
        }
        else /* IVAS_CPE_DFT */
        {
            if ( hCPE->last_element_mode == IVAS_CPE_MDCT )
            if ( last_element_mode == IVAS_CPE_MDCT )
            {
                stereo_mdct2dft_update( hCPE, output[0], synth[0] );
            }