static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)

{

    int start = 0, i, w, w2, g;

    float M[128], S[128];

    float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;

    const float lambda = s->lambda;

    SingleChannelElement *sce0 = &cpe->ch[0];

    SingleChannelElement *sce1 = &cpe->ch[1];

    if (!cpe->common_window)

        return;

    for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {

        start = 0;

        for (g = 0;  g < sce0->ics.num_swb; g++) {

            if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {

                float dist1 = 0.0f, dist2 = 0.0f;

                for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {

                    FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];

                    FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];

                    float minthr = FFMIN(band0->threshold, band1->threshold);

                    float maxthr = FFMAX(band0->threshold, band1->threshold);

                    for (i = 0; i < sce0->ics.swb_sizes[g]; i+=4) {

                        M[i  ] = (sce0->coeffs[start+w2*128+i  ]

                                + sce1->coeffs[start+w2*128+i  ]) * 0.5;

                        M[i+1] = (sce0->coeffs[start+w2*128+i+1]

                                + sce1->coeffs[start+w2*128+i+1]) * 0.5;

                        M[i+2] = (sce0->coeffs[start+w2*128+i+2]

                                + sce1->coeffs[start+w2*128+i+2]) * 0.5;

                        M[i+3] = (sce0->coeffs[start+w2*128+i+3]

                                + sce1->coeffs[start+w2*128+i+3]) * 0.5;



                        S[i  ] =  M[i  ]

                                - sce1->coeffs[start+w2*128+i  ];

                        S[i+1] =  M[i+1]

                                - sce1->coeffs[start+w2*128+i+1];

                        S[i+2] =  M[i+2]

                                - sce1->coeffs[start+w2*128+i+2];

                        S[i+3] =  M[i+3]

                                - sce1->coeffs[start+w2*128+i+3];

                   }

                    abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);

                    abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);

                    abs_pow34_v(M34, M,                         sce0->ics.swb_sizes[g]);

                    abs_pow34_v(S34, S,                         sce0->ics.swb_sizes[g]);

                    dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],

                                                L34,

                                                sce0->ics.swb_sizes[g],

                                                sce0->sf_idx[(w+w2)*16+g],

                                                sce0->band_type[(w+w2)*16+g],

                                                lambda / band0->threshold, INFINITY, NULL, NULL, 0);

                    dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],

                                                R34,

                                                sce1->ics.swb_sizes[g],

                                                sce1->sf_idx[(w+w2)*16+g],

                                                sce1->band_type[(w+w2)*16+g],

                                                lambda / band1->threshold, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(s, M,

                                                M34,

                                                sce0->ics.swb_sizes[g],

                                                sce0->sf_idx[(w+w2)*16+g],

                                                sce0->band_type[(w+w2)*16+g],

                                                lambda / maxthr, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(s, S,

                                                S34,

                                                sce1->ics.swb_sizes[g],

                                                sce1->sf_idx[(w+w2)*16+g],

                                                sce1->band_type[(w+w2)*16+g],

                                                lambda / minthr, INFINITY, NULL, NULL, 0);

                }

                cpe->ms_mask[w*16+g] = dist2 < dist1;

            }

            start += sce0->ics.swb_sizes[g];

        }

    }

}

static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)

{

    int start = 0, i, w, w2, g;

    float M[128], S[128];

    float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;

    const float lambda = s->lambda;

    SingleChannelElement *sce0 = &cpe->ch[0];

    SingleChannelElement *sce1 = &cpe->ch[1];

    if (!cpe->common_window)

        return;

    for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {

        start = 0;

        for (g = 0;  g < sce0->ics.num_swb; g++) {

            if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {

                float dist1 = 0.0f, dist2 = 0.0f;

                for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {

                    FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];

                    FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];

                    float minthr = FFMIN(band0->threshold, band1->threshold);

                    float maxthr = FFMAX(band0->threshold, band1->threshold);

                    for (i = 0; i < sce0->ics.swb_sizes[g]; i+=4) {

                        M[i  ] = (sce0->coeffs[start+w2*128+i  ]

                                + sce1->coeffs[start+w2*128+i  ]) * 0.5;

                        M[i+1] = (sce0->coeffs[start+w2*128+i+1]

                                + sce1->coeffs[start+w2*128+i+1]) * 0.5;

                        M[i+2] = (sce0->coeffs[start+w2*128+i+2]

                                + sce1->coeffs[start+w2*128+i+2]) * 0.5;

                        M[i+3] = (sce0->coeffs[start+w2*128+i+3]

                                + sce1->coeffs[start+w2*128+i+3]) * 0.5;



                        S[i  ] =  M[i  ]

                                - sce1->coeffs[start+w2*128+i  ];

                        S[i+1] =  M[i+1]

                                - sce1->coeffs[start+w2*128+i+1];

                        S[i+2] =  M[i+2]

                                - sce1->coeffs[start+w2*128+i+2];

                        S[i+3] =  M[i+3]

                                - sce1->coeffs[start+w2*128+i+3];

                   }

                    abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);

                    abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);

                    abs_pow34_v(M34, M,                         sce0->ics.swb_sizes[g]);

                    abs_pow34_v(S34, S,                         sce0->ics.swb_sizes[g]);

                    dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],

                                                L34,

                                                sce0->ics.swb_sizes[g],

                                                sce0->sf_idx[(w+w2)*16+g],

                                                sce0->band_type[(w+w2)*16+g],

                                                lambda / band0->threshold, INFINITY, NULL, NULL, 0);

                    dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],

                                                R34,

                                                sce1->ics.swb_sizes[g],

                                                sce1->sf_idx[(w+w2)*16+g],

                                                sce1->band_type[(w+w2)*16+g],

                                                lambda / band1->threshold, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(s, M,

                                                M34,

                                                sce0->ics.swb_sizes[g],

                                                sce0->sf_idx[(w+w2)*16+g],

                                                sce0->band_type[(w+w2)*16+g],

                                                lambda / maxthr, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(s, S,

                                                S34,

                                                sce1->ics.swb_sizes[g],

                                                sce1->sf_idx[(w+w2)*16+g],

                                                sce1->band_type[(w+w2)*16+g],

                                                lambda / minthr, INFINITY, NULL, NULL, 0);

                }

                cpe->ms_mask[w*16+g] = dist2 < dist1;

            }

            start += sce0->ics.swb_sizes[g];

        }

    }

}

    for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {             if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {     int start = 0, i, w, w2, g;             if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {                 float dist1 = 0.0f, dist2 = 0.0f;                     FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];                     FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];                     float minthr = FFMIN(band0->threshold, band1->threshold);                     float maxthr = FFMAX(band0->threshold, band1->threshold);                     for (i = 0; i < sce0->ics.swb_sizes[g]; i+=4) {                         M[i  ] = (sce0->coeffs[start+w2*128+i  ]                                 + sce1->coeffs[start+w2*128+i  ]) * 0.5;                         M[i+1] = (sce0->coeffs[start+w2*128+i+1]                                 + sce1->coeffs[start+w2*128+i+1]) * 0.5;                         M[i+2] = (sce0->coeffs[start+w2*128+i+2]                                 + sce1->coeffs[start+w2*128+i+2]) * 0.5;                         M[i+3] = (sce0->coeffs[start+w2*128+i+3]                                 + sce1->coeffs[start+w2*128+i+3]) * 0.5;                         S[i  ] =  M[i  ]                                 - sce1->coeffs[start+w2*128+i  ];                         S[i+1] =  M[i+1]                                 - sce1->coeffs[start+w2*128+i+1];                         S[i+2] =  M[i+2]                                 - sce1->coeffs[start+w2*128+i+2];                         S[i+3] =  M[i+3]                                 - sce1->coeffs[start+w2*128+i+3];                     abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);                     abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);                     abs_pow34_v(M34, M,                         sce0->ics.swb_sizes[g]);                     abs_pow34_v(S34, S,                         sce0->ics.swb_sizes[g]);                     dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],                                                 L34,                                                 sce0->ics.swb_sizes[g],                                                 sce0->sf_idx[(w+w2)*16+g],                                                 sce0->band_type[(w+w2)*16+g],                                                 lambda / band0->threshold, INFINITY, NULL, NULL, 0);                     dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],                                                 R34,                                                 sce1->ics.swb_sizes[g],                                                 sce1->sf_idx[(w+w2)*16+g],                                                 sce1->band_type[(w+w2)*16+g],                                                 lambda / band1->threshold, INFINITY, NULL, NULL, 0);                     dist2 += quantize_band_cost(s, M,                                                 M34,                                                 sce0->ics.swb_sizes[g],                                                 sce0->sf_idx[(w+w2)*16+g],                                                 sce0->band_type[(w+w2)*16+g],                                                 lambda / maxthr, INFINITY, NULL, NULL, 0);                     dist2 += quantize_band_cost(s, S,                                                 S34,                                                 sce1->ics.swb_sizes[g],                                                 sce1->sf_idx[(w+w2)*16+g],                                                 sce1->band_type[(w+w2)*16+g],                                                 lambda / minthr, INFINITY, NULL, NULL, 0);                 cpe->ms_mask[w*16+g] = dist2 < dist1;
static void FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1)

{

    int VAR_2 = 0, VAR_3, VAR_4, VAR_5, VAR_6;

    float VAR_7[128], VAR_8[128];

    float *VAR_9 = VAR_0->scoefs, *VAR_10 = VAR_0->scoefs + 128, *VAR_11 = VAR_0->scoefs + 128*2, *VAR_12 = VAR_0->scoefs + 128*3;

    const float VAR_13 = VAR_0->VAR_13;

    SingleChannelElement *sce0 = &VAR_1->ch[0];

    SingleChannelElement *sce1 = &VAR_1->ch[1];

    if (!VAR_1->common_window)

        return;

    for (VAR_4 = 0; VAR_4 < sce0->ics.num_windows; VAR_4 += sce0->ics.group_len[VAR_4]) {

        VAR_2 = 0;

        for (VAR_6 = 0;  VAR_6 < sce0->ics.num_swb; VAR_6++) {

            if (!VAR_1->ch[0].zeroes[VAR_4*16+VAR_6] && !VAR_1->ch[1].zeroes[VAR_4*16+VAR_6]) {

                float dist1 = 0.0f, dist2 = 0.0f;

                for (VAR_5 = 0; VAR_5 < sce0->ics.group_len[VAR_4]; VAR_5++) {

                    FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_4+VAR_5)*16+VAR_6];

                    FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_4+VAR_5)*16+VAR_6];

                    float minthr = FFMIN(band0->threshold, band1->threshold);

                    float maxthr = FFMAX(band0->threshold, band1->threshold);

                    for (VAR_3 = 0; VAR_3 < sce0->ics.swb_sizes[VAR_6]; VAR_3+=4) {

                        VAR_7[VAR_3  ] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3  ]

                                + sce1->coeffs[VAR_2+VAR_5*128+VAR_3  ]) * 0.5;

                        VAR_7[VAR_3+1] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+1]

                                + sce1->coeffs[VAR_2+VAR_5*128+VAR_3+1]) * 0.5;

                        VAR_7[VAR_3+2] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+2]

                                + sce1->coeffs[VAR_2+VAR_5*128+VAR_3+2]) * 0.5;

                        VAR_7[VAR_3+3] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+3]

                                + sce1->coeffs[VAR_2+VAR_5*128+VAR_3+3]) * 0.5;



                        VAR_8[VAR_3  ] =  VAR_7[VAR_3  ]

                                - sce1->coeffs[VAR_2+VAR_5*128+VAR_3  ];

                        VAR_8[VAR_3+1] =  VAR_7[VAR_3+1]

                                - sce1->coeffs[VAR_2+VAR_5*128+VAR_3+1];

                        VAR_8[VAR_3+2] =  VAR_7[VAR_3+2]

                                - sce1->coeffs[VAR_2+VAR_5*128+VAR_3+2];

                        VAR_8[VAR_3+3] =  VAR_7[VAR_3+3]

                                - sce1->coeffs[VAR_2+VAR_5*128+VAR_3+3];

                   }

                    abs_pow34_v(VAR_9, sce0->coeffs+VAR_2+(VAR_4+VAR_5)*128, sce0->ics.swb_sizes[VAR_6]);

                    abs_pow34_v(VAR_10, sce1->coeffs+VAR_2+(VAR_4+VAR_5)*128, sce0->ics.swb_sizes[VAR_6]);

                    abs_pow34_v(VAR_11, VAR_7,                         sce0->ics.swb_sizes[VAR_6]);

                    abs_pow34_v(VAR_12, VAR_8,                         sce0->ics.swb_sizes[VAR_6]);

                    dist1 += quantize_band_cost(VAR_0, &sce0->coeffs[VAR_2 + (VAR_4+VAR_5)*128],

                                                VAR_9,

                                                sce0->ics.swb_sizes[VAR_6],

                                                sce0->sf_idx[(VAR_4+VAR_5)*16+VAR_6],

                                                sce0->band_type[(VAR_4+VAR_5)*16+VAR_6],

                                                VAR_13 / band0->threshold, INFINITY, NULL, NULL, 0);

                    dist1 += quantize_band_cost(VAR_0, &sce1->coeffs[VAR_2 + (VAR_4+VAR_5)*128],

                                                VAR_10,

                                                sce1->ics.swb_sizes[VAR_6],

                                                sce1->sf_idx[(VAR_4+VAR_5)*16+VAR_6],

                                                sce1->band_type[(VAR_4+VAR_5)*16+VAR_6],

                                                VAR_13 / band1->threshold, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(VAR_0, VAR_7,

                                                VAR_11,

                                                sce0->ics.swb_sizes[VAR_6],

                                                sce0->sf_idx[(VAR_4+VAR_5)*16+VAR_6],

                                                sce0->band_type[(VAR_4+VAR_5)*16+VAR_6],

                                                VAR_13 / maxthr, INFINITY, NULL, NULL, 0);

                    dist2 += quantize_band_cost(VAR_0, VAR_8,

                                                VAR_12,

                                                sce1->ics.swb_sizes[VAR_6],

                                                sce1->sf_idx[(VAR_4+VAR_5)*16+VAR_6],

                                                sce1->band_type[(VAR_4+VAR_5)*16+VAR_6],

                                                VAR_13 / minthr, INFINITY, NULL, NULL, 0);

                }

                VAR_1->ms_mask[VAR_4*16+VAR_6] = dist2 < dist1;

            }

            VAR_2 += sce0->ics.swb_sizes[VAR_6];

        }

    }

}

static void FUNC_0(AACEncContext *VAR_0, ChannelElement *VAR_1)
{ int VAR_2 = 0, VAR_3, VAR_4, VAR_5, VAR_6; float VAR_7[128], VAR_8[128]; float *VAR_9 = VAR_0->scoefs, *VAR_10 = VAR_0->scoefs + 128, *VAR_11 = VAR_0->scoefs + 128*2, *VAR_12 = VAR_0->scoefs + 128*3; const float VAR_13 = VAR_0->VAR_13; SingleChannelElement *sce0 = &VAR_1->ch[0]; SingleChannelElement *sce1 = &VAR_1->ch[1]; if (!VAR_1->common_window)
return; for (VAR_4 = 0; VAR_4 < sce0->ics.num_windows; VAR_4 += sce0->ics.group_len[VAR_4]) { VAR_2 = 0; for (VAR_6 = 0;  VAR_6 < sce0->ics.num_swb; VAR_6++) { if (!VAR_1->ch[0].zeroes[VAR_4*16+VAR_6] && !VAR_1->ch[1].zeroes[VAR_4*16+VAR_6]) { float dist1 = 0.0f, dist2 = 0.0f; for (VAR_5 = 0; VAR_5 < sce0->ics.group_len[VAR_4]; VAR_5++) { FFPsyBand *band0 = &VAR_0->psy.ch[VAR_0->cur_channel+0].psy_bands[(VAR_4+VAR_5)*16+VAR_6]; FFPsyBand *band1 = &VAR_0->psy.ch[VAR_0->cur_channel+1].psy_bands[(VAR_4+VAR_5)*16+VAR_6]; float minthr = FFMIN(band0->threshold, band1->threshold); float maxthr = FFMAX(band0->threshold, band1->threshold); for (VAR_3 = 0; VAR_3 < sce0->ics.swb_sizes[VAR_6]; VAR_3+=4) { VAR_7[VAR_3  ] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3  ]
+ sce1->coeffs[VAR_2+VAR_5*128+VAR_3  ]) * 0.5; VAR_7[VAR_3+1] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+1]
+ sce1->coeffs[VAR_2+VAR_5*128+VAR_3+1]) * 0.5; VAR_7[VAR_3+2] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+2]
+ sce1->coeffs[VAR_2+VAR_5*128+VAR_3+2]) * 0.5; VAR_7[VAR_3+3] = (sce0->coeffs[VAR_2+VAR_5*128+VAR_3+3]
+ sce1->coeffs[VAR_2+VAR_5*128+VAR_3+3]) * 0.5; VAR_8[VAR_3  ] =  VAR_7[VAR_3  ]
- sce1->coeffs[VAR_2+VAR_5*128+VAR_3  ]; VAR_8[VAR_3+1] =  VAR_7[VAR_3+1]
- sce1->coeffs[VAR_2+VAR_5*128+VAR_3+1]; VAR_8[VAR_3+2] =  VAR_7[VAR_3+2]
- sce1->coeffs[VAR_2+VAR_5*128+VAR_3+2]; VAR_8[VAR_3+3] =  VAR_7[VAR_3+3]
- sce1->coeffs[VAR_2+VAR_5*128+VAR_3+3]; } abs_pow34_v(VAR_9, sce0->coeffs+VAR_2+(VAR_4+VAR_5)*128, sce0->ics.swb_sizes[VAR_6]); abs_pow34_v(VAR_10, sce1->coeffs+VAR_2+(VAR_4+VAR_5)*128, sce0->ics.swb_sizes[VAR_6]); abs_pow34_v(VAR_11, VAR_7,                         sce0->ics.swb_sizes[VAR_6]); abs_pow34_v(VAR_12, VAR_8,                         sce0->ics.swb_sizes[VAR_6]); dist1 += quantize_band_cost(VAR_0, &sce0->coeffs[VAR_2 + (VAR_4+VAR_5)*128],
VAR_9,
sce0->ics.swb_sizes[VAR_6],
sce0->sf_idx[(VAR_4+VAR_5)*16+VAR_6],
sce0->band_type[(VAR_4+VAR_5)*16+VAR_6],
VAR_13 / band0->threshold, INFINITY, NULL, NULL, 0); dist1 += quantize_band_cost(VAR_0, &sce1->coeffs[VAR_2 + (VAR_4+VAR_5)*128],
VAR_10,
sce1->ics.swb_sizes[VAR_6],
sce1->sf_idx[(VAR_4+VAR_5)*16+VAR_6],
sce1->band_type[(VAR_4+VAR_5)*16+VAR_6],
VAR_13 / band1->threshold, INFINITY, NULL, NULL, 0); dist2 += quantize_band_cost(VAR_0, VAR_7,
VAR_11,
sce0->ics.swb_sizes[VAR_6],
sce0->sf_idx[(VAR_4+VAR_5)*16+VAR_6],
sce0->band_type[(VAR_4+VAR_5)*16+VAR_6],
VAR_13 / maxthr, INFINITY, NULL, NULL, 0); dist2 += quantize_band_cost(VAR_0, VAR_8,
VAR_12,
sce1->ics.swb_sizes[VAR_6],
sce1->sf_idx[(VAR_4+VAR_5)*16+VAR_6],
sce1->band_type[(VAR_4+VAR_5)*16+VAR_6],
VAR_13 / minthr, INFINITY, NULL, NULL, 0); } VAR_1->ms_mask[VAR_4*16+VAR_6] = dist2 < dist1; } VAR_2 += sce0->ics.swb_sizes[VAR_6]; } } }