static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)

{

    uint8_t  lens[MAX_ELEMS];

    uint16_t codes[MAX_ELEMS];

    int counts[17], prefixes[18];

    int i, cur_len;

    int max_bits = 0;

    GetBitContext gb;



    init_get_bits(&gb, data, elems * 4);



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

        counts[i] = 0;

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

        cur_len  = get_bits(&gb, 4) + 1;

        counts[cur_len]++;

        max_bits = FFMAX(max_bits, cur_len);

        lens[i]  = cur_len;

    }

    prefixes[1] = 0;

    for (i = 1; i <= 16; i++)

        prefixes[i + 1] = (prefixes[i] + counts[i]) << 1;



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

        codes[i] = prefixes[lens[i]]++;



    return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems,

                              lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);

}

static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)

{

    uint8_t  lens[MAX_ELEMS];

    uint16_t codes[MAX_ELEMS];

    int counts[17], prefixes[18];

    int i, cur_len;

    int max_bits = 0;

    GetBitContext gb;



    init_get_bits(&gb, data, elems * 4);



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

        counts[i] = 0;

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

        cur_len  = get_bits(&gb, 4) + 1;

        counts[cur_len]++;

        max_bits = FFMAX(max_bits, cur_len);

        lens[i]  = cur_len;

    }

    prefixes[1] = 0;

    for (i = 1; i <= 16; i++)

        prefixes[i + 1] = (prefixes[i] + counts[i]) << 1;



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

        codes[i] = prefixes[lens[i]]++;



    return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems,

                              lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);

}

    GetBitContext gb;     init_get_bits(&gb, data, elems * 4);         cur_len  = get_bits(&gb, 4) + 1;
static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    uint8_t  lens[MAX_ELEMS];

    uint16_t codes[MAX_ELEMS];

    int VAR_3[17], VAR_4[18];

    int VAR_5, VAR_6;

    int VAR_7 = 0;

    GetBitContext gb;



    init_get_bits(&gb, VAR_1, VAR_2 * 4);



    for (VAR_5 = 0; VAR_5 <= 16; VAR_5++)

        VAR_3[VAR_5] = 0;

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

        VAR_6  = get_bits(&gb, 4) + 1;

        VAR_3[VAR_6]++;

        VAR_7 = FFMAX(VAR_7, VAR_6);

        lens[VAR_5]  = VAR_6;

    }

    VAR_4[1] = 0;

    for (VAR_5 = 1; VAR_5 <= 16; VAR_5++)

        VAR_4[VAR_5 + 1] = (VAR_4[VAR_5] + VAR_3[VAR_5]) << 1;



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

        codes[VAR_5] = VAR_4[lens[VAR_5]]++;



    return ff_init_vlc_sparse(VAR_0, FFMIN(VAR_7, 9), VAR_2,

                              lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);

}

static int FUNC_0(VLC *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ uint8_t  lens[MAX_ELEMS]; uint16_t codes[MAX_ELEMS]; int VAR_3[17], VAR_4[18]; int VAR_5, VAR_6; int VAR_7 = 0; GetBitContext gb; init_get_bits(&gb, VAR_1, VAR_2 * 4); for (VAR_5 = 0; VAR_5 <= 16; VAR_5++) VAR_3[VAR_5] = 0; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { VAR_6  = get_bits(&gb, 4) + 1; VAR_3[VAR_6]++; VAR_7 = FFMAX(VAR_7, VAR_6); lens[VAR_5]  = VAR_6; } VAR_4[1] = 0; for (VAR_5 = 1; VAR_5 <= 16; VAR_5++) VAR_4[VAR_5 + 1] = (VAR_4[VAR_5] + VAR_3[VAR_5]) << 1; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) codes[VAR_5] = VAR_4[lens[VAR_5]]++; return ff_init_vlc_sparse(VAR_0, FFMIN(VAR_7, 9), VAR_2,
lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); }