static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i, ret; int count = 3; if ((ret = init_get_bits(&gb, src, length * 8)) < 0) return ret; if (s->version > 2) count = 1 + s->alpha + 2*s->chroma; for (i = 0; i < count; i++) { if ((ret = read_len_table(s->len[i], &gb, s->vlc_n)) < 0) return ret; if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n)) < 0) return ret; ff_free_vlc(&s->vlc[i]); if ((ret = init_vlc(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0) return ret; } if ((ret = generate_joint_tables(s)) < 0) return ret; return (get_bits_count(&gb) + 7) / 8; }
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i; int ret; init_get_bits(&gb, src, length * 8); for (i = 0; i < 3; i++) { if (read_len_table(s->len[i], &gb) < 0) return -1; if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) { return -1; } ff_free_vlc(&s->vlc[i]); if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0) return ret; } if ((ret = generate_joint_tables(s)) < 0) return ret; return (get_bits_count(&gb) + 7) / 8; }