int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)
{
    int len, index;
    uint32_t bits = 0;
    for (len = 32; len > 0; len--) {
        for (index = 0; index < 256; index++) {
            if (len_table[index] == len)
                dst[index] = bits++;
        }
        if (bits & 1) {
            av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
            return -1;
        }
        bits >>= 1;
    }
    return 0;
}
['static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)\n{\n    GetBitContext gb;\n    int i, ret;\n    if ((ret = init_get_bits(&gb, src, length * 8)) < 0)\n        return ret;\n    for (i = 0; i < 3; i++) {\n        if ((ret = read_len_table(s->len[i], &gb)) < 0)\n            return ret;\n        if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i])) < 0)\n            return ret;\n        ff_free_vlc(&s->vlc[i]);\n        if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,\n                            s->bits[i], 4, 4, 0)) < 0)\n            return ret;\n    }\n    if ((ret = generate_joint_tables(s)) < 0)\n        return ret;\n    return (get_bits_count(&gb) + 7) / 8;\n}', 'int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)\n{\n    int len, index;\n    uint32_t bits = 0;\n    for (len = 32; len > 0; len--) {\n        for (index = 0; index < 256; index++) {\n            if (len_table[index] == len)\n                dst[index] = bits++;\n        }\n        if (bits & 1) {\n            av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\\n");\n            return -1;\n        }\n        bits >>= 1;\n    }\n    return 0;\n}']