static void calc_masking(DCAEncContext *c, const int32_t *input)

{

    int i, k, band, ch, ssf;

    int32_t data[512];



    for (i = 0; i < 256; i++)

        for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

            c->masking_curve_cb[ssf][i] = -2047;



    for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

        for (ch = 0; ch < c->fullband_channels; ch++) {

            const int chi = c->channel_order_tab[ch];



            for (i = 0, k = 128 + 256 * ssf; k < 512; i++, k++)

                data[i] = c->history[k][ch];

            for (k -= 512; i < 512; i++, k++)

                data[i] = input[k * c->channels + chi];

            adjust_jnd(c->samplerate_index, data, c->masking_curve_cb[ssf]);

        }

    for (i = 0; i < 256; i++) {

        int32_t m = 2048;



        for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

            if (c->masking_curve_cb[ssf][i] < m)

                m = c->masking_curve_cb[ssf][i];

        c->eff_masking_curve_cb[i] = m;

    }



    for (band = 0; band < 32; band++) {

        c->band_masking_cb[band] = 2048;

        walk_band_low(c, band, 0, update_band_masking, NULL);

        walk_band_high(c, band, 0, update_band_masking, NULL);

    }

}

static void calc_masking(DCAEncContext *c, const int32_t *input)

{

    int i, k, band, ch, ssf;

    int32_t data[512];



    for (i = 0; i < 256; i++)

        for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

            c->masking_curve_cb[ssf][i] = -2047;



    for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

        for (ch = 0; ch < c->fullband_channels; ch++) {

            const int chi = c->channel_order_tab[ch];



            for (i = 0, k = 128 + 256 * ssf; k < 512; i++, k++)

                data[i] = c->history[k][ch];

            for (k -= 512; i < 512; i++, k++)

                data[i] = input[k * c->channels + chi];

            adjust_jnd(c->samplerate_index, data, c->masking_curve_cb[ssf]);

        }

    for (i = 0; i < 256; i++) {

        int32_t m = 2048;



        for (ssf = 0; ssf < SUBSUBFRAMES; ssf++)

            if (c->masking_curve_cb[ssf][i] < m)

                m = c->masking_curve_cb[ssf][i];

        c->eff_masking_curve_cb[i] = m;

    }



    for (band = 0; band < 32; band++) {

        c->band_masking_cb[band] = 2048;

        walk_band_low(c, band, 0, update_band_masking, NULL);

        walk_band_high(c, band, 0, update_band_masking, NULL);

    }

}

static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;

    int32_t data[512];



    for (VAR_2 = 0; VAR_2 < 256; VAR_2++)

        for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)

            VAR_0->masking_curve_cb[VAR_6][VAR_2] = -2047;



    for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)

        for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) {

            const int chi = VAR_0->channel_order_tab[VAR_5];



            for (VAR_2 = 0, VAR_3 = 128 + 256 * VAR_6; VAR_3 < 512; VAR_2++, VAR_3++)

                data[VAR_2] = VAR_0->history[VAR_3][VAR_5];

            for (VAR_3 -= 512; VAR_2 < 512; VAR_2++, VAR_3++)

                data[VAR_2] = VAR_1[VAR_3 * VAR_0->channels + chi];

            adjust_jnd(VAR_0->samplerate_index, data, VAR_0->masking_curve_cb[VAR_6]);

        }

    for (VAR_2 = 0; VAR_2 < 256; VAR_2++) {

        int32_t m = 2048;



        for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)

            if (VAR_0->masking_curve_cb[VAR_6][VAR_2] < m)

                m = VAR_0->masking_curve_cb[VAR_6][VAR_2];

        VAR_0->eff_masking_curve_cb[VAR_2] = m;

    }



    for (VAR_4 = 0; VAR_4 < 32; VAR_4++) {

        VAR_0->band_masking_cb[VAR_4] = 2048;

        walk_band_low(VAR_0, VAR_4, 0, update_band_masking, NULL);

        walk_band_high(VAR_0, VAR_4, 0, update_band_masking, NULL);

    }

}

static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int32_t data[512]; for (VAR_2 = 0; VAR_2 < 256; VAR_2++) for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) VAR_0->masking_curve_cb[VAR_6][VAR_2] = -2047; for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) { const int chi = VAR_0->channel_order_tab[VAR_5]; for (VAR_2 = 0, VAR_3 = 128 + 256 * VAR_6; VAR_3 < 512; VAR_2++, VAR_3++) data[VAR_2] = VAR_0->history[VAR_3][VAR_5]; for (VAR_3 -= 512; VAR_2 < 512; VAR_2++, VAR_3++) data[VAR_2] = VAR_1[VAR_3 * VAR_0->channels + chi]; adjust_jnd(VAR_0->samplerate_index, data, VAR_0->masking_curve_cb[VAR_6]); } for (VAR_2 = 0; VAR_2 < 256; VAR_2++) { int32_t m = 2048; for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) if (VAR_0->masking_curve_cb[VAR_6][VAR_2] < m)
m = VAR_0->masking_curve_cb[VAR_6][VAR_2]; VAR_0->eff_masking_curve_cb[VAR_2] = m; } for (VAR_4 = 0; VAR_4 < 32; VAR_4++) { VAR_0->band_masking_cb[VAR_4] = 2048; walk_band_low(VAR_0, VAR_4, 0, update_band_masking, NULL); walk_band_high(VAR_0, VAR_4, 0, update_band_masking, NULL); } }