static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)

{

    int e, b, k;



    float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;

    float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;

    float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;

    float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;

    int8_t *opd_hist = ps->opd_hist;

    int8_t *ipd_hist = ps->ipd_hist;

    int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;

    int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;

    int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;

    int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;

    const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;

    TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;



    //Remapping

    if (ps->num_env_old) {

        memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));

        memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));

        memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));

        memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));

        memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));

        memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));

        memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));

        memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));

    }



    if (is34) {

        remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);

        remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);

        if (ps->enable_ipdopd) {

            remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);

            remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);

        }

        if (!ps->is34bands_old) {

            map_val_20_to_34(H11[0][0]);

            map_val_20_to_34(H11[1][0]);

            map_val_20_to_34(H12[0][0]);

            map_val_20_to_34(H12[1][0]);

            map_val_20_to_34(H21[0][0]);

            map_val_20_to_34(H21[1][0]);

            map_val_20_to_34(H22[0][0]);

            map_val_20_to_34(H22[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    } else {

        remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);

        remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);

        if (ps->enable_ipdopd) {

            remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);

            remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);

        }

        if (ps->is34bands_old) {

            map_val_34_to_20(H11[0][0]);

            map_val_34_to_20(H11[1][0]);

            map_val_34_to_20(H12[0][0]);

            map_val_34_to_20(H12[1][0]);

            map_val_34_to_20(H21[0][0]);

            map_val_34_to_20(H21[1][0]);

            map_val_34_to_20(H22[0][0]);

            map_val_34_to_20(H22[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    }



    //Mixing

    for (e = 0; e < ps->num_env; e++) {

        for (b = 0; b < NR_PAR_BANDS[is34]; b++) {

            float h11, h12, h21, h22;

            h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];

            h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];

            h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];

            h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];



            if (!PS_BASELINE && ps->enable_ipdopd && 2*b <= NR_PAR_BANDS[is34]) {

                //The spec say says to only run this smoother when enable_ipdopd

                //is set but the reference decoder appears to run it constantly

                float h11i, h12i, h21i, h22i;

                float ipd_adj_re, ipd_adj_im;

                int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];

                int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];

                float opd_re = pd_re_smooth[opd_idx];

                float opd_im = pd_im_smooth[opd_idx];

                float ipd_re = pd_re_smooth[ipd_idx];

                float ipd_im = pd_im_smooth[ipd_idx];

                opd_hist[b] = opd_idx & 0x3F;

                ipd_hist[b] = ipd_idx & 0x3F;



                ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;

                ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;

                h11i = h11 * opd_im;

                h11  = h11 * opd_re;

                h12i = h12 * ipd_adj_im;

                h12  = h12 * ipd_adj_re;

                h21i = h21 * opd_im;

                h21  = h21 * opd_re;

                h22i = h22 * ipd_adj_im;

                h22  = h22 * ipd_adj_re;

                H11[1][e+1][b] = h11i;

                H12[1][e+1][b] = h12i;

                H21[1][e+1][b] = h21i;

                H22[1][e+1][b] = h22i;

            }

            H11[0][e+1][b] = h11;

            H12[0][e+1][b] = h12;

            H21[0][e+1][b] = h21;

            H22[0][e+1][b] = h22;

        }

        for (k = 0; k < NR_BANDS[is34]; k++) {

            float h[2][4];

            float h_step[2][4];

            int start = ps->border_position[e];

            int stop  = ps->border_position[e+1];

            float width = 1.f / (stop - start);

            b = k_to_i[k];

            h[0][0] = H11[0][e][b];

            h[0][1] = H12[0][e][b];

            h[0][2] = H21[0][e][b];

            h[0][3] = H22[0][e][b];

            if (!PS_BASELINE && ps->enable_ipdopd) {

            //Is this necessary? ps_04_new seems unchanged

            if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {

                h[1][0] = -H11[1][e][b];

                h[1][1] = -H12[1][e][b];

                h[1][2] = -H21[1][e][b];

                h[1][3] = -H22[1][e][b];

            } else {

                h[1][0] = H11[1][e][b];

                h[1][1] = H12[1][e][b];

                h[1][2] = H21[1][e][b];

                h[1][3] = H22[1][e][b];

            }

            }

            //Interpolation

            h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width;

            h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width;

            h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width;

            h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width;

            if (!PS_BASELINE && ps->enable_ipdopd) {

                h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width;

                h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width;

                h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width;

                h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width;

            }

            ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](

                l[k] + start + 1, r[k] + start + 1,

                h, h_step, stop - start);

        }

    }

}

static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)

{

    int e, b, k;



    float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;

    float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;

    float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;

    float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;

    int8_t *opd_hist = ps->opd_hist;

    int8_t *ipd_hist = ps->ipd_hist;

    int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;

    int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;

    int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;

    int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;

    const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;

    TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;



    

    if (ps->num_env_old) {

        memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));

        memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));

        memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));

        memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));

        memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));

        memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));

        memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));

        memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));

    }



    if (is34) {

        remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);

        remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);

        if (ps->enable_ipdopd) {

            remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);

            remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);

        }

        if (!ps->is34bands_old) {

            map_val_20_to_34(H11[0][0]);

            map_val_20_to_34(H11[1][0]);

            map_val_20_to_34(H12[0][0]);

            map_val_20_to_34(H12[1][0]);

            map_val_20_to_34(H21[0][0]);

            map_val_20_to_34(H21[1][0]);

            map_val_20_to_34(H22[0][0]);

            map_val_20_to_34(H22[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    } else {

        remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);

        remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);

        if (ps->enable_ipdopd) {

            remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);

            remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);

        }

        if (ps->is34bands_old) {

            map_val_34_to_20(H11[0][0]);

            map_val_34_to_20(H11[1][0]);

            map_val_34_to_20(H12[0][0]);

            map_val_34_to_20(H12[1][0]);

            map_val_34_to_20(H21[0][0]);

            map_val_34_to_20(H21[1][0]);

            map_val_34_to_20(H22[0][0]);

            map_val_34_to_20(H22[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    }



    

    for (e = 0; e < ps->num_env; e++) {

        for (b = 0; b < NR_PAR_BANDS[is34]; b++) {

            float h11, h12, h21, h22;

            h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];

            h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];

            h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];

            h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];



            if (!PS_BASELINE && ps->enable_ipdopd && 2*b <= NR_PAR_BANDS[is34]) {

                

                

                float h11i, h12i, h21i, h22i;

                float ipd_adj_re, ipd_adj_im;

                int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];

                int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];

                float opd_re = pd_re_smooth[opd_idx];

                float opd_im = pd_im_smooth[opd_idx];

                float ipd_re = pd_re_smooth[ipd_idx];

                float ipd_im = pd_im_smooth[ipd_idx];

                opd_hist[b] = opd_idx & 0x3F;

                ipd_hist[b] = ipd_idx & 0x3F;



                ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;

                ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;

                h11i = h11 * opd_im;

                h11  = h11 * opd_re;

                h12i = h12 * ipd_adj_im;

                h12  = h12 * ipd_adj_re;

                h21i = h21 * opd_im;

                h21  = h21 * opd_re;

                h22i = h22 * ipd_adj_im;

                h22  = h22 * ipd_adj_re;

                H11[1][e+1][b] = h11i;

                H12[1][e+1][b] = h12i;

                H21[1][e+1][b] = h21i;

                H22[1][e+1][b] = h22i;

            }

            H11[0][e+1][b] = h11;

            H12[0][e+1][b] = h12;

            H21[0][e+1][b] = h21;

            H22[0][e+1][b] = h22;

        }

        for (k = 0; k < NR_BANDS[is34]; k++) {

            float h[2][4];

            float h_step[2][4];

            int start = ps->border_position[e];

            int stop  = ps->border_position[e+1];

            float width = 1.f / (stop - start);

            b = k_to_i[k];

            h[0][0] = H11[0][e][b];

            h[0][1] = H12[0][e][b];

            h[0][2] = H21[0][e][b];

            h[0][3] = H22[0][e][b];

            if (!PS_BASELINE && ps->enable_ipdopd) {

            

            if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {

                h[1][0] = -H11[1][e][b];

                h[1][1] = -H12[1][e][b];

                h[1][2] = -H21[1][e][b];

                h[1][3] = -H22[1][e][b];

            } else {

                h[1][0] = H11[1][e][b];

                h[1][1] = H12[1][e][b];

                h[1][2] = H21[1][e][b];

                h[1][3] = H22[1][e][b];

            }

            }

            

            h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width;

            h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width;

            h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width;

            h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width;

            if (!PS_BASELINE && ps->enable_ipdopd) {

                h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width;

                h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width;

                h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width;

                h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width;

            }

            ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](

                l[k] + start + 1, r[k] + start + 1,

                h, h_step, stop - start);

        }

    }

}

            if (!PS_BASELINE && ps->enable_ipdopd && 2*b <= NR_PAR_BANDS[is34]) {
static void FUNC_0(PSContext *VAR_0, float (*VAR_1)[32][2], float (*VAR_2)[32][2], int VAR_3)

{

    int VAR_4, VAR_5, VAR_6;



    float (*VAR_7)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_7;

    float (*VAR_8)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_8;

    float (*VAR_9)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_9;

    float (*VAR_10)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_10;

    int8_t *opd_hist = VAR_0->opd_hist;

    int8_t *ipd_hist = VAR_0->ipd_hist;

    int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];

    int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;

    int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;

    int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;

    int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;

    const int8_t *VAR_11 = VAR_3 ? k_to_i_34 : k_to_i_20;

    TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || VAR_0->icc_mode < 3) ? HA : HB;



    

    if (VAR_0->num_env_old) {

        memcpy(VAR_7[0][0], VAR_7[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_7[0][0][0]));

        memcpy(VAR_7[1][0], VAR_7[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_7[1][0][0]));

        memcpy(VAR_8[0][0], VAR_8[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[0][0][0]));

        memcpy(VAR_8[1][0], VAR_8[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[1][0][0]));

        memcpy(VAR_9[0][0], VAR_9[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[0][0][0]));

        memcpy(VAR_9[1][0], VAR_9[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[1][0][0]));

        memcpy(VAR_10[0][0], VAR_10[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[0][0][0]));

        memcpy(VAR_10[1][0], VAR_10[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[1][0][0]));

    }



    if (VAR_3) {

        remap34(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);

        remap34(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);

        if (VAR_0->enable_ipdopd) {

            remap34(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);

            remap34(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);

        }

        if (!VAR_0->is34bands_old) {

            map_val_20_to_34(VAR_7[0][0]);

            map_val_20_to_34(VAR_7[1][0]);

            map_val_20_to_34(VAR_8[0][0]);

            map_val_20_to_34(VAR_8[1][0]);

            map_val_20_to_34(VAR_9[0][0]);

            map_val_20_to_34(VAR_9[1][0]);

            map_val_20_to_34(VAR_10[0][0]);

            map_val_20_to_34(VAR_10[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    } else {

        remap20(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);

        remap20(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);

        if (VAR_0->enable_ipdopd) {

            remap20(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);

            remap20(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);

        }

        if (VAR_0->is34bands_old) {

            map_val_34_to_20(VAR_7[0][0]);

            map_val_34_to_20(VAR_7[1][0]);

            map_val_34_to_20(VAR_8[0][0]);

            map_val_34_to_20(VAR_8[1][0]);

            map_val_34_to_20(VAR_9[0][0]);

            map_val_34_to_20(VAR_9[1][0]);

            map_val_34_to_20(VAR_10[0][0]);

            map_val_34_to_20(VAR_10[1][0]);

            ipdopd_reset(ipd_hist, opd_hist);

        }

    }



    

    for (VAR_4 = 0; VAR_4 < VAR_0->num_env; VAR_4++) {

        for (VAR_5 = 0; VAR_5 < NR_PAR_BANDS[VAR_3]; VAR_5++) {

            float h11, h12, h21, h22;

            h11 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][0];

            h12 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][1];

            h21 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][2];

            h22 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][3];



            if (!PS_BASELINE && VAR_0->enable_ipdopd && 2*VAR_5 <= NR_PAR_BANDS[VAR_3]) {

                

                

                float h11i, h12i, h21i, h22i;

                float ipd_adj_re, ipd_adj_im;

                int opd_idx = opd_hist[VAR_5] * 8 + opd_mapped[VAR_4][VAR_5];

                int ipd_idx = ipd_hist[VAR_5] * 8 + ipd_mapped[VAR_4][VAR_5];

                float opd_re = pd_re_smooth[opd_idx];

                float opd_im = pd_im_smooth[opd_idx];

                float ipd_re = pd_re_smooth[ipd_idx];

                float ipd_im = pd_im_smooth[ipd_idx];

                opd_hist[VAR_5] = opd_idx & 0x3F;

                ipd_hist[VAR_5] = ipd_idx & 0x3F;



                ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;

                ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;

                h11i = h11 * opd_im;

                h11  = h11 * opd_re;

                h12i = h12 * ipd_adj_im;

                h12  = h12 * ipd_adj_re;

                h21i = h21 * opd_im;

                h21  = h21 * opd_re;

                h22i = h22 * ipd_adj_im;

                h22  = h22 * ipd_adj_re;

                VAR_7[1][VAR_4+1][VAR_5] = h11i;

                VAR_8[1][VAR_4+1][VAR_5] = h12i;

                VAR_9[1][VAR_4+1][VAR_5] = h21i;

                VAR_10[1][VAR_4+1][VAR_5] = h22i;

            }

            VAR_7[0][VAR_4+1][VAR_5] = h11;

            VAR_8[0][VAR_4+1][VAR_5] = h12;

            VAR_9[0][VAR_4+1][VAR_5] = h21;

            VAR_10[0][VAR_4+1][VAR_5] = h22;

        }

        for (VAR_6 = 0; VAR_6 < NR_BANDS[VAR_3]; VAR_6++) {

            float h[2][4];

            float h_step[2][4];

            int start = VAR_0->border_position[VAR_4];

            int stop  = VAR_0->border_position[VAR_4+1];

            float width = 1.f / (stop - start);

            VAR_5 = VAR_11[VAR_6];

            h[0][0] = VAR_7[0][VAR_4][VAR_5];

            h[0][1] = VAR_8[0][VAR_4][VAR_5];

            h[0][2] = VAR_9[0][VAR_4][VAR_5];

            h[0][3] = VAR_10[0][VAR_4][VAR_5];

            if (!PS_BASELINE && VAR_0->enable_ipdopd) {

            

            if ((VAR_3 && VAR_6 <= 13 && VAR_6 >= 9) || (!VAR_3 && VAR_6 <= 1)) {

                h[1][0] = -VAR_7[1][VAR_4][VAR_5];

                h[1][1] = -VAR_8[1][VAR_4][VAR_5];

                h[1][2] = -VAR_9[1][VAR_4][VAR_5];

                h[1][3] = -VAR_10[1][VAR_4][VAR_5];

            } else {

                h[1][0] = VAR_7[1][VAR_4][VAR_5];

                h[1][1] = VAR_8[1][VAR_4][VAR_5];

                h[1][2] = VAR_9[1][VAR_4][VAR_5];

                h[1][3] = VAR_10[1][VAR_4][VAR_5];

            }

            }

            

            h_step[0][0] = (VAR_7[0][VAR_4+1][VAR_5] - h[0][0]) * width;

            h_step[0][1] = (VAR_8[0][VAR_4+1][VAR_5] - h[0][1]) * width;

            h_step[0][2] = (VAR_9[0][VAR_4+1][VAR_5] - h[0][2]) * width;

            h_step[0][3] = (VAR_10[0][VAR_4+1][VAR_5] - h[0][3]) * width;

            if (!PS_BASELINE && VAR_0->enable_ipdopd) {

                h_step[1][0] = (VAR_7[1][VAR_4+1][VAR_5] - h[1][0]) * width;

                h_step[1][1] = (VAR_8[1][VAR_4+1][VAR_5] - h[1][1]) * width;

                h_step[1][2] = (VAR_9[1][VAR_4+1][VAR_5] - h[1][2]) * width;

                h_step[1][3] = (VAR_10[1][VAR_4+1][VAR_5] - h[1][3]) * width;

            }

            VAR_0->dsp.stereo_interpolate[!PS_BASELINE && VAR_0->enable_ipdopd](

                VAR_1[VAR_6] + start + 1, VAR_2[VAR_6] + start + 1,

                h, h_step, stop - start);

        }

    }

}

static void FUNC_0(PSContext *VAR_0, float (*VAR_1)[32][2], float (*VAR_2)[32][2], int VAR_3)
{ int VAR_4, VAR_5, VAR_6; float (*VAR_7)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_7; float (*VAR_8)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_8; float (*VAR_9)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_9; float (*VAR_10)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_10; int8_t *opd_hist = VAR_0->opd_hist; int8_t *ipd_hist = VAR_0->ipd_hist; int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf; int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf; int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf; int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf; const int8_t *VAR_11 = VAR_3 ? k_to_i_34 : k_to_i_20; TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || VAR_0->icc_mode < 3) ? HA : HB; if (VAR_0->num_env_old) { memcpy(VAR_7[0][0], VAR_7[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_7[0][0][0])); memcpy(VAR_7[1][0], VAR_7[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_7[1][0][0])); memcpy(VAR_8[0][0], VAR_8[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[0][0][0])); memcpy(VAR_8[1][0], VAR_8[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[1][0][0])); memcpy(VAR_9[0][0], VAR_9[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[0][0][0])); memcpy(VAR_9[1][0], VAR_9[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[1][0][0])); memcpy(VAR_10[0][0], VAR_10[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[0][0][0])); memcpy(VAR_10[1][0], VAR_10[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[1][0][0])); } if (VAR_3) { remap34(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1); remap34(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1); if (VAR_0->enable_ipdopd) { remap34(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0); remap34(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0); } if (!VAR_0->is34bands_old) { map_val_20_to_34(VAR_7[0][0]); map_val_20_to_34(VAR_7[1][0]); map_val_20_to_34(VAR_8[0][0]); map_val_20_to_34(VAR_8[1][0]); map_val_20_to_34(VAR_9[0][0]); map_val_20_to_34(VAR_9[1][0]); map_val_20_to_34(VAR_10[0][0]); map_val_20_to_34(VAR_10[1][0]); ipdopd_reset(ipd_hist, opd_hist); } } else { remap20(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1); remap20(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1); if (VAR_0->enable_ipdopd) { remap20(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0); remap20(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0); } if (VAR_0->is34bands_old) { map_val_34_to_20(VAR_7[0][0]); map_val_34_to_20(VAR_7[1][0]); map_val_34_to_20(VAR_8[0][0]); map_val_34_to_20(VAR_8[1][0]); map_val_34_to_20(VAR_9[0][0]); map_val_34_to_20(VAR_9[1][0]); map_val_34_to_20(VAR_10[0][0]); map_val_34_to_20(VAR_10[1][0]); ipdopd_reset(ipd_hist, opd_hist); } } for (VAR_4 = 0; VAR_4 < VAR_0->num_env; VAR_4++) { for (VAR_5 = 0; VAR_5 < NR_PAR_BANDS[VAR_3]; VAR_5++) { float h11, h12, h21, h22; h11 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][0]; h12 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][1]; h21 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][2]; h22 = H_LUT[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][3]; if (!PS_BASELINE && VAR_0->enable_ipdopd && 2*VAR_5 <= NR_PAR_BANDS[VAR_3]) { float h11i, h12i, h21i, h22i; float ipd_adj_re, ipd_adj_im; int opd_idx = opd_hist[VAR_5] * 8 + opd_mapped[VAR_4][VAR_5]; int ipd_idx = ipd_hist[VAR_5] * 8 + ipd_mapped[VAR_4][VAR_5]; float opd_re = pd_re_smooth[opd_idx]; float opd_im = pd_im_smooth[opd_idx]; float ipd_re = pd_re_smooth[ipd_idx]; float ipd_im = pd_im_smooth[ipd_idx]; opd_hist[VAR_5] = opd_idx & 0x3F; ipd_hist[VAR_5] = ipd_idx & 0x3F; ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im; ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im; h11i = h11 * opd_im; h11  = h11 * opd_re; h12i = h12 * ipd_adj_im; h12  = h12 * ipd_adj_re; h21i = h21 * opd_im; h21  = h21 * opd_re; h22i = h22 * ipd_adj_im; h22  = h22 * ipd_adj_re; VAR_7[1][VAR_4+1][VAR_5] = h11i; VAR_8[1][VAR_4+1][VAR_5] = h12i; VAR_9[1][VAR_4+1][VAR_5] = h21i; VAR_10[1][VAR_4+1][VAR_5] = h22i; } VAR_7[0][VAR_4+1][VAR_5] = h11; VAR_8[0][VAR_4+1][VAR_5] = h12; VAR_9[0][VAR_4+1][VAR_5] = h21; VAR_10[0][VAR_4+1][VAR_5] = h22; } for (VAR_6 = 0; VAR_6 < NR_BANDS[VAR_3]; VAR_6++) { float h[2][4]; float h_step[2][4]; int start = VAR_0->border_position[VAR_4]; int stop  = VAR_0->border_position[VAR_4+1]; float width = 1.f / (stop - start); VAR_5 = VAR_11[VAR_6]; h[0][0] = VAR_7[0][VAR_4][VAR_5]; h[0][1] = VAR_8[0][VAR_4][VAR_5]; h[0][2] = VAR_9[0][VAR_4][VAR_5]; h[0][3] = VAR_10[0][VAR_4][VAR_5]; if (!PS_BASELINE && VAR_0->enable_ipdopd) { if ((VAR_3 && VAR_6 <= 13 && VAR_6 >= 9) || (!VAR_3 && VAR_6 <= 1)) { h[1][0] = -VAR_7[1][VAR_4][VAR_5]; h[1][1] = -VAR_8[1][VAR_4][VAR_5]; h[1][2] = -VAR_9[1][VAR_4][VAR_5]; h[1][3] = -VAR_10[1][VAR_4][VAR_5]; } else { h[1][0] = VAR_7[1][VAR_4][VAR_5]; h[1][1] = VAR_8[1][VAR_4][VAR_5]; h[1][2] = VAR_9[1][VAR_4][VAR_5]; h[1][3] = VAR_10[1][VAR_4][VAR_5]; } } h_step[0][0] = (VAR_7[0][VAR_4+1][VAR_5] - h[0][0]) * width; h_step[0][1] = (VAR_8[0][VAR_4+1][VAR_5] - h[0][1]) * width; h_step[0][2] = (VAR_9[0][VAR_4+1][VAR_5] - h[0][2]) * width; h_step[0][3] = (VAR_10[0][VAR_4+1][VAR_5] - h[0][3]) * width; if (!PS_BASELINE && VAR_0->enable_ipdopd) { h_step[1][0] = (VAR_7[1][VAR_4+1][VAR_5] - h[1][0]) * width; h_step[1][1] = (VAR_8[1][VAR_4+1][VAR_5] - h[1][1]) * width; h_step[1][2] = (VAR_9[1][VAR_4+1][VAR_5] - h[1][2]) * width; h_step[1][3] = (VAR_10[1][VAR_4+1][VAR_5] - h[1][3]) * width; } VAR_0->dsp.stereo_interpolate[!PS_BASELINE && VAR_0->enable_ipdopd](
VAR_1[VAR_6] + start + 1, VAR_2[VAR_6] + start + 1,
h, h_step, stop - start); } } }