Commit 5ac0ce84 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

fix MC non-BE-ness

parent e401e0bd
Loading
Loading
Loading
Loading
Loading
+302 −175
Original line number Diff line number Diff line
@@ -1332,21 +1332,41 @@ void ivas_param_mc_dec_digest_tc(
{
    PARAM_MC_DEC_HANDLE hParamMC;
    int16_t ch;
    int16_t slot_idx;
#ifndef OBJ_EDITING_API
    int16_t i;
#endif
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    int16_t is_next_band, skip_next_band;
#endif
    int16_t slot_idx, param_band_idx;
    int16_t nchan_transport;

#ifndef OBJ_EDITING_API
    int16_t nchan_out_transport, nchan_out_cldfb, i, param_band_idx;
    int16_t nchan_out_transport, nchan_out_cldfb;
    int16_t nchan_out_cov;
#endif

    /*CLDFB*/
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
#ifndef OBJ_EDITING_API
    float *pCx, *pCx_imag;
#endif
    float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
#else
    float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
#endif

#ifndef OBJ_EDITING_API
    float real_part, imag_part;
    /* format converter */
    int16_t channel_active[MAX_OUTPUT_CHANNELS];
    IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;
    int16_t channel_active[MAX_OUTPUT_CHANNELS];
#endif


    hParamMC = st_ivas->hParamMC;
    assert( hParamMC );

@@ -1356,6 +1376,8 @@ void ivas_param_mc_dec_digest_tc(
    set_s( channel_active, 0, MAX_CICP_CHANNELS );
#endif
    nchan_transport = st_ivas->nchan_transport;


#ifndef OBJ_EDITING_API
    nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;

@@ -1401,7 +1423,20 @@ void ivas_param_mc_dec_digest_tc(
    mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes );

    ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator );
#endif

#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    /* loop over two bands at a time */
    for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
    {
        /* don't process next band if it exceeds the limit */
        skip_next_band = ( ( param_band_idx + 1 ) == hParamMC->num_param_bands_synth ) ? 1 : 0;

        set_zero( cx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
#else
    for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ )
    {
        set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
@@ -1414,6 +1449,10 @@ void ivas_param_mc_dec_digest_tc(
        {
            if ( st_ivas->hDecoderConfig->Opt_tsm )
            {
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                if ( param_band_idx == 0 ) /* only run cldfbAna once */
                {
#endif
                    float RealBuffer[CLDFB_NO_CHANNELS_MAX];
                    float ImagBuffer[CLDFB_NO_CHANNELS_MAX];

@@ -1425,164 +1464,38 @@ void ivas_param_mc_dec_digest_tc(
                        mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands );
                        mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands );
                    }
        }
#ifndef OBJ_EDITING_API
        if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex )
        {
            ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], cx, cx_imag, hParamMC, nchan_transport );
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                }
#endif
            }
#ifndef OBJ_EDITING_API
    /* map from complex input covariance to real values */
    for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ )
    {
        /* Cx for transport channels */
        for ( i = 0; i < nchan_transport * nchan_transport; i++ )
        {
            real_part = cx[param_band_idx][i];
            imag_part = cx_imag[param_band_idx][i];

            /* (a-ib)(c+id) = ac + bd + i(ad-bc) */
            if ( param_band_idx < hParamMC->max_param_band_abs_cov )
            {
                cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part );
            }
            else
            if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex )
            {
                cx[param_band_idx][i] = real_part;
            }
        }
    }

    /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/
    if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) )
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
                {
        for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
                    if ( is_next_band && skip_next_band )
                    {
            v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport );
            mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport );
        }
    }


    /* generate mixing matrices */
    ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
#endif
    pop_wmops();

    return;
                        continue;
                    }

#ifdef OBJ_EDITING_API
/*-------------------------------------------------------------------------
 * ivas_param_mc_dec_prepare_renderer()
 *
 *
 *------------------------------------------------------------------------*/

void ivas_param_mc_dec_prepare_renderer(
    Decoder_Struct *st_ivas,  /* i/o: IVAS decoder handle                                       */
    const uint8_t nCldfbSlots /* i  : number of CLFBS slots in the transport channels           */
)
{
    PARAM_MC_DEC_HANDLE hParamMC;
    int16_t i;

#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    int16_t is_next_band, skip_next_band;
#endif
    
    int16_t param_band_idx;
    int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb;
    int16_t nchan_out_cov;
    /*CLDFB*/
                    ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
                                                                               &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    float *pCx, *pCx_imag;
    float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
                                                                               is_next_band ? cx_next_band : cx,
                                                                               is_next_band ? cx_imag_next_band : cx_imag,
                                                                               param_band_idx + is_next_band,
#else
    float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
                                                                       cx,
                                                                       cx_imag,
#endif
    float real_part, imag_part;
    /* format converter */
    int16_t channel_active[MAX_OUTPUT_CHANNELS];
    IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;

    hParamMC = st_ivas->hParamMC;
    assert( hParamMC );

    push_wmops( "param_mc_dec_digest_tc" );

    set_s( channel_active, 0, MAX_CICP_CHANNELS );
    nchan_transport = st_ivas->nchan_transport;
    nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    {
        nchan_out_cldfb = BINAURAL_CHANNELS;
        set_s( channel_active, 1, nchan_out_cldfb );
        nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }
    else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB )
    {
        nchan_out_cov = nchan_out_transport;
        nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }
    else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO )
    {
        nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
        nchan_out_cldfb = nchan_out_cov;
        set_s( channel_active, 1, nchan_out_cov );
        hSynthesisOutputSetup = &st_ivas->hOutSetup;
    }
    else
    {
        nchan_out_cov = nchan_out_transport;
        nchan_out_cldfb = nchan_out_transport;
        set_s( channel_active, 1, nchan_out_cov );
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }

    /* adapt transient position */
    if ( hParamMC->hMetadataPMC->bAttackPresent )
    {
        hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) );
    }
    /* adapt subframes */
    hParamMC->num_slots = nCldfbSlots;
    hParamMC->slots_rendered = 0;
    hParamMC->subframes_rendered = 0;
    ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes );
    st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes;
    mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes );

    ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator );


                                                                               hParamMC,
                                                                               nchan_transport );
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    /* loop over two bands at a time */
    for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
    {
        /* don't process next band if it exceeds the limit */
        skip_next_band = ( ( param_band_idx + 1 ) == hParamMC->num_param_bands_synth ) ? 1 : 0;

        set_zero( cx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
#else
        for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ )
        {
            set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
            set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
                }
#endif
            }
        }
#ifndef OBJ_EDITING_API

        /* map from complex input covariance to real values */
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
@@ -1672,6 +1585,11 @@ void ivas_param_mc_dec_prepare_renderer(
                                               nchan_out_cov );
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
        }
#endif

#endif

#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    }
#endif

@@ -1679,7 +1597,7 @@ void ivas_param_mc_dec_prepare_renderer(

    return;
}
#endif


/*-------------------------------------------------------------------------
 * ivas_param_mc_dec_render()
@@ -3121,3 +3039,212 @@ static void ivas_param_mc_bs_decode_parameter_values(

    return;
}



#ifdef OBJ_EDITING_API
/*-------------------------------------------------------------------------
 * ivas_param_mc_dec_prepare_renderer()
 *
 *
 *------------------------------------------------------------------------*/

void ivas_param_mc_dec_prepare_renderer(
    Decoder_Struct *st_ivas,  /* i/o: IVAS decoder handle                                       */
    const uint8_t nCldfbSlots /* i  : number of CLFBS slots in the transport channels           */
)
{
    PARAM_MC_DEC_HANDLE hParamMC;
    int16_t i;

#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    int16_t is_next_band, skip_next_band;
#endif
    
    int16_t param_band_idx;
    int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb;
    int16_t nchan_out_cov;
    /*CLDFB*/
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    float *pCx, *pCx_imag;
    float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
#else
    float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
    float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
#endif
    float real_part, imag_part;
    /* format converter */
    int16_t channel_active[MAX_OUTPUT_CHANNELS];
    IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;

    hParamMC = st_ivas->hParamMC;
    assert( hParamMC );

    push_wmops( "param_mc_dec_digest_tc" );

    set_s( channel_active, 0, MAX_CICP_CHANNELS );
    nchan_transport = st_ivas->nchan_transport;
    nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    {
        nchan_out_cldfb = BINAURAL_CHANNELS;
        set_s( channel_active, 1, nchan_out_cldfb );
        nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }
    else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB )
    {
        nchan_out_cov = nchan_out_transport;
        nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }
    else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO )
    {
        nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
        nchan_out_cldfb = nchan_out_cov;
        set_s( channel_active, 1, nchan_out_cov );
        hSynthesisOutputSetup = &st_ivas->hOutSetup;
    }
    else
    {
        nchan_out_cov = nchan_out_transport;
        nchan_out_cldfb = nchan_out_transport;
        set_s( channel_active, 1, nchan_out_cov );
        hSynthesisOutputSetup = &st_ivas->hTransSetup;
    }

    /* adapt transient position */
    if ( hParamMC->hMetadataPMC->bAttackPresent )
    {
        hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) );
    }
    /* adapt subframes */
    hParamMC->num_slots = nCldfbSlots;
    hParamMC->slots_rendered = 0;
    hParamMC->subframes_rendered = 0;
    ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes );
    st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes;
    mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes );

    ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator );


#ifdef FIX_835_PARAMMC_BUFFER_VALUES
    /* loop over two bands at a time */
    for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
    {
        /* don't process next band if it exceeds the limit */
        skip_next_band = ( ( param_band_idx + 1 ) == hParamMC->num_param_bands_synth ) ? 1 : 0;

        set_zero( cx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        set_zero( cx_imag_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
#else
        for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ )
        {
            set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
            set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
        }
#endif

        /* map from complex input covariance to real values */
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
        for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
        {
            if ( is_next_band && skip_next_band )
            {
                continue;
            }
#else
    for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ )
    {
#endif
            /* Cx for transport channels */
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
            pCx = is_next_band ? &cx_next_band[0] : &cx[0];
            pCx_imag = is_next_band ? &cx_imag_next_band[0] : &cx_imag[0];
#endif
            for ( i = 0; i < nchan_transport * nchan_transport; i++ )
            {
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                real_part = pCx[i];
                imag_part = pCx_imag[i];
#else
                real_part = cx[param_band_idx][i];
                imag_part = cx_imag[param_band_idx][i];
#endif

                /* (a-ib)(c+id) = ac + bd + i(ad-bc) */
                if ( param_band_idx < hParamMC->max_param_band_abs_cov )
                {
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                    pCx[i] = sqrtf( real_part * real_part + imag_part * imag_part );
#else
                    cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part );
#endif
                }
                else
                {
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                    pCx[i] = real_part;
#else
                    cx[param_band_idx][i] = real_part;
#endif
                }
            }
        }

        /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/
        if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) )
        {
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
            v_add( cx, cx_next_band, cx, nchan_transport * nchan_transport );
            mvr2r( cx, cx_next_band, nchan_transport * nchan_transport );
#else
            for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
            {
                v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport );
                mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport );
            }
#endif
        }


#ifdef FIX_835_PARAMMC_BUFFER_VALUES
        for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
        {
            if ( is_next_band && skip_next_band )
            {
                continue;
            }
#endif
            /* generate mixing matrices */
            ivas_param_mc_get_mixing_matrices( hParamMC,
                                               hSynthesisOutputSetup,
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
                                               is_next_band ? cx_next_band : cx,
                                               param_band_idx + is_next_band,
#else
                                               cx,
#endif
                                               hParamMC->h_output_synthesis_cov_state.mixing_matrix,
                                               hParamMC->h_output_synthesis_cov_state.mixing_matrix_res,
                                               nchan_out_transport,
                                               hParamMC->synthesis_conf,
                                               nchan_transport,
                                               nchan_out_cov );
#ifdef FIX_835_PARAMMC_BUFFER_VALUES
        }
    }
#endif

    pop_wmops();

    return;
}
#endif