static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms,

                         const int num)

{

    int i;

    int counts[17] = {0}, codes[17];

    uint16_t cw[size], syms[size];

    uint8_t bits2[size];

    int maxbits = 0, realsize = 0;



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

        if(bits[i]){

            bits2[realsize] = bits[i];

            syms[realsize] = insyms ? insyms[i] : i;

            realsize++;

            maxbits = FFMAX(maxbits, bits[i]);

            counts[bits[i]]++;

        }

    }



    codes[0] = 0;

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

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

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

        cw[i] = codes[bits2[i]]++;



    vlc->table = &table_data[table_offs[num]];

    vlc->table_allocated = table_offs[num + 1] - table_offs[num];

    init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize,

                    bits2, 1, 1,

                    cw,    2, 2,

                    syms,  2, 2, INIT_VLC_USE_NEW_STATIC);

}

static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms,

                         const int num)

{

    int i;

    int counts[17] = {0}, codes[17];

    uint16_t cw[size], syms[size];

    uint8_t bits2[size];

    int maxbits = 0, realsize = 0;



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

        if(bits[i]){

            bits2[realsize] = bits[i];

            syms[realsize] = insyms ? insyms[i] : i;

            realsize++;

            maxbits = FFMAX(maxbits, bits[i]);

            counts[bits[i]]++;

        }

    }



    codes[0] = 0;

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

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

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

        cw[i] = codes[bits2[i]]++;



    vlc->table = &table_data[table_offs[num]];

    vlc->table_allocated = table_offs[num + 1] - table_offs[num];

    init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize,

                    bits2, 1, 1,

                    cw,    2, 2,

                    syms,  2, 2, INIT_VLC_USE_NEW_STATIC);

}

static void FUNC_0(const uint8_t *VAR_0, int VAR_1, VLC *VAR_2, const uint8_t *VAR_3,

                         const int VAR_4)

{

    int VAR_5;

    int VAR_6[17] = {0}, VAR_7[17];

    uint16_t cw[VAR_1], syms[VAR_1];

    uint8_t bits2[VAR_1];

    int VAR_8 = 0, VAR_9 = 0;



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

        if(VAR_0[VAR_5]){

            bits2[VAR_9] = VAR_0[VAR_5];

            syms[VAR_9] = VAR_3 ? VAR_3[VAR_5] : VAR_5;

            VAR_9++;

            VAR_8 = FFMAX(VAR_8, VAR_0[VAR_5]);

            VAR_6[VAR_0[VAR_5]]++;

        }

    }



    VAR_7[0] = 0;

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

        VAR_7[VAR_5+1] = (VAR_7[VAR_5] + VAR_6[VAR_5]) << 1;

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

        cw[VAR_5] = VAR_7[bits2[VAR_5]]++;



    VAR_2->table = &table_data[table_offs[VAR_4]];

    VAR_2->table_allocated = table_offs[VAR_4 + 1] - table_offs[VAR_4];

    init_vlc_sparse(VAR_2, FFMIN(VAR_8, 9), VAR_9,

                    bits2, 1, 1,

                    cw,    2, 2,

                    syms,  2, 2, INIT_VLC_USE_NEW_STATIC);

}

static void FUNC_0(const uint8_t *VAR_0, int VAR_1, VLC *VAR_2, const uint8_t *VAR_3,
const int VAR_4)
{ int VAR_5; int VAR_6[17] = {0}, VAR_7[17]; uint16_t cw[VAR_1], syms[VAR_1]; uint8_t bits2[VAR_1]; int VAR_8 = 0, VAR_9 = 0; for(VAR_5 = 0; VAR_5 < VAR_1; VAR_5++){ if(VAR_0[VAR_5]){ bits2[VAR_9] = VAR_0[VAR_5]; syms[VAR_9] = VAR_3 ? VAR_3[VAR_5] : VAR_5; VAR_9++; VAR_8 = FFMAX(VAR_8, VAR_0[VAR_5]); VAR_6[VAR_0[VAR_5]]++; } } VAR_7[0] = 0; for(VAR_5 = 0; VAR_5 < 16; VAR_5++) VAR_7[VAR_5+1] = (VAR_7[VAR_5] + VAR_6[VAR_5]) << 1; for(VAR_5 = 0; VAR_5 < VAR_9; VAR_5++) cw[VAR_5] = VAR_7[bits2[VAR_5]]++; VAR_2->table = &table_data[table_offs[VAR_4]]; VAR_2->table_allocated = table_offs[VAR_4 + 1] - table_offs[VAR_4]; init_vlc_sparse(VAR_2, FFMIN(VAR_8, 9), VAR_9,
bits2, 1, 1,
cw,    2, 2,
syms,  2, 2, INIT_VLC_USE_NEW_STATIC); }