void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,

                               int snr_offset, int floor,

                               const uint8_t *bap_tab, uint8_t *bap)

{

    int i, j, end1, v, address;



    /* special case, if snr offset is -960, set all bap's to zero */

    if (snr_offset == -960) {

        memset(bap, 0, 256);

        return;

    }



    i = start;

    j = bin_to_band_tab[start];

    do {

        v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor;

        end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end);

        for (; i < end1; i++) {

            address = av_clip((psd[i] - v) >> 5, 0, 63);

            bap[i] = bap_tab[address];

        }

    } while (end > band_start_tab[j++]);

}

void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,

                               int snr_offset, int floor,

                               const uint8_t *bap_tab, uint8_t *bap)

{

    int i, j, end1, v, address;



    

    if (snr_offset == -960) {

        memset(bap, 0, 256);

        return;

    }



    i = start;

    j = bin_to_band_tab[start];

    do {

        v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor;

        end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end);

        for (; i < end1; i++) {

            address = av_clip((psd[i] - v) >> 5, 0, 63);

            bap[i] = bap_tab[address];

        }

    } while (end > band_start_tab[j++]);

}

void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3,

                               int VAR_4, int VAR_5,

                               const uint8_t *VAR_6, uint8_t *VAR_7)

{

    int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;



    

    if (VAR_4 == -960) {

        memset(VAR_7, 0, 256);

        return;

    }



    VAR_8 = VAR_2;

    VAR_9 = bin_to_band_tab[VAR_2];

    do {

        VAR_11 = (FFMAX(VAR_0[VAR_9] - VAR_4 - VAR_5, 0) & 0x1FE0) + VAR_5;

        VAR_10 = FFMIN(band_start_tab[VAR_9] + ff_ac3_critical_band_size_tab[VAR_9], VAR_3);

        for (; VAR_8 < VAR_10; VAR_8++) {

            VAR_12 = av_clip((VAR_1[VAR_8] - VAR_11) >> 5, 0, 63);

            VAR_7[VAR_8] = VAR_6[VAR_12];

        }

    } while (VAR_3 > band_start_tab[VAR_9++]);

}

void FUNC_0(int16_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3,
int VAR_4, int VAR_5,
const uint8_t *VAR_6, uint8_t *VAR_7)
{ int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; if (VAR_4 == -960) { memset(VAR_7, 0, 256); return; } VAR_8 = VAR_2; VAR_9 = bin_to_band_tab[VAR_2]; do { VAR_11 = (FFMAX(VAR_0[VAR_9] - VAR_4 - VAR_5, 0) & 0x1FE0) + VAR_5; VAR_10 = FFMIN(band_start_tab[VAR_9] + ff_ac3_critical_band_size_tab[VAR_9], VAR_3); for (; VAR_8 < VAR_10; VAR_8++) { VAR_12 = av_clip((VAR_1[VAR_8] - VAR_11) >> 5, 0, 63); VAR_7[VAR_8] = VAR_6[VAR_12]; } } while (VAR_3 > band_start_tab[VAR_9++]); }