static av_cold void huff_build_tree(IdcinContext *s, int prev) {
    hnode_t *node, *hnodes;
     int num_hnodes, i;
    num_hnodes = HUF_TOKENS;
    hnodes = s->huff_nodes[prev];
    for(i = 0; i < HUF_TOKENS * 2; i++)
        hnodes[i].used = 0;
    while (1) {
        node = &hnodes[num_hnodes];
        node->children[0] = huff_smallest_node(hnodes, num_hnodes);
        if(node->children[0] == -1)
            break;
        node->children[1] = huff_smallest_node(hnodes, num_hnodes);
        if(node->children[1] == -1)
            break;
        node->count = hnodes[node->children[0]].count +
        hnodes[node->children[1]].count;
        num_hnodes++;
    }
    s->num_huff_nodes[prev] = num_hnodes - 1;
}
['static av_cold int idcin_decode_init(AVCodecContext *avctx)\n{\n    IdcinContext *s = avctx->priv_data;\n    int i, j, histogram_index = 0;\n    unsigned char *histograms;\n    s->avctx = avctx;\n    avctx->pix_fmt = PIX_FMT_PAL8;\n    if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {\n        av_log(s->avctx, AV_LOG_ERROR, "  Id CIN video: expected extradata size of %d\\n", HUFFMAN_TABLE_SIZE);\n        return -1;\n    }\n    histograms = (unsigned char *)s->avctx->extradata;\n    for (i = 0; i < 256; i++) {\n        for(j = 0; j < HUF_TOKENS; j++)\n            s->huff_nodes[i][j].count = histograms[histogram_index++];\n        huff_build_tree(s, i);\n    }\n    s->frame.data[0] = NULL;\n    return 0;\n}', 'static av_cold void huff_build_tree(IdcinContext *s, int prev) {\n    hnode_t *node, *hnodes;\n     int num_hnodes, i;\n    num_hnodes = HUF_TOKENS;\n    hnodes = s->huff_nodes[prev];\n    for(i = 0; i < HUF_TOKENS * 2; i++)\n        hnodes[i].used = 0;\n    while (1) {\n        node = &hnodes[num_hnodes];\n        node->children[0] = huff_smallest_node(hnodes, num_hnodes);\n        if(node->children[0] == -1)\n            break;\n        node->children[1] = huff_smallest_node(hnodes, num_hnodes);\n        if(node->children[1] == -1)\n            break;\n        node->count = hnodes[node->children[0]].count +\n        hnodes[node->children[1]].count;\n        num_hnodes++;\n    }\n    s->num_huff_nodes[prev] = num_hnodes - 1;\n}']