• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/libarchive/libarchive/

Lines Matching defs:hf

2541 lzh_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits)
2545 if (hf->bitlen == NULL) {
2546 hf->bitlen = malloc(len_size * sizeof(hf->bitlen[0]));
2547 if (hf->bitlen == NULL)
2550 if (hf->tbl == NULL) {
2555 hf->tbl = malloc(((size_t)1 << bits) * sizeof(hf->tbl[0]));
2556 if (hf->tbl == NULL)
2559 if (hf->tree == NULL && tbl_bits > HTBL_BITS) {
2560 hf->tree_avail = 1 << (tbl_bits - HTBL_BITS + 4);
2561 hf->tree = malloc(hf->tree_avail * sizeof(hf->tree[0]));
2562 if (hf->tree == NULL)
2565 hf->len_size = (int)len_size;
2566 hf->tbl_bits = tbl_bits;
2571 lzh_huffman_free(struct huffman *hf)
2573 free(hf->bitlen);
2574 free(hf->tbl);
2575 free(hf->tree);
2683 lzh_make_fake_table(struct huffman *hf, uint16_t c)
2685 if (c >= hf->len_size)
2687 hf->tbl[0] = c;
2688 hf->max_bits = 0;
2689 hf->shift_bits = 0;
2690 hf->bitlen[hf->tbl[0]] = 0;
2698 lzh_make_huffman_table(struct huffman *hf)
2713 if (hf->freq[i]) {
2714 ptn += hf->freq[i] * w;
2718 if (ptn != 0x10000 || maxbits > hf->tbl_bits)
2721 hf->max_bits = maxbits;
2745 weight[HTBL_BITS] * hf->freq[HTBL_BITS];
2746 p = &(hf->tbl[htbl_max]);
2747 while (p < &hf->tbl[1U<<HTBL_BITS])
2751 hf->shift_bits = diffbits;
2757 tbl = hf->tbl;
2758 bitlen = hf->bitlen;
2759 len_avail = hf->len_avail;
2760 hf->tree_used = 0;
2827 *p = len_avail + hf->tree_used;
2828 ht = &(hf->tree[hf->tree_used++]);
2829 if (hf->tree_used > hf->tree_avail)
2835 *p >= (len_avail + hf->tree_used))
2837 ht = &(hf->tree[*p - len_avail]);
2842 ht->left = len_avail + hf->tree_used;
2843 ht = &(hf->tree[hf->tree_used++]);
2844 if (hf->tree_used > hf->tree_avail)
2849 ht = &(hf->tree[ht->left - len_avail]);
2853 ht->right = len_avail + hf->tree_used;
2854 ht = &(hf->tree[hf->tree_used++]);
2855 if (hf->tree_used > hf->tree_avail)
2860 ht = &(hf->tree[ht->right - len_avail]);
2879 lzh_decode_huffman_tree(struct huffman *hf, unsigned rbits, int c)
2884 ht = hf->tree;
2885 extlen = hf->shift_bits;
2886 while (c >= hf->len_avail) {
2887 c -= hf->len_avail;
2888 if (extlen-- <= 0 || c >= hf->tree_used)
2899 lzh_decode_huffman(struct huffman *hf, unsigned rbits)
2906 c = hf->tbl[rbits >> hf->shift_bits];
2907 if (c < hf->len_avail || hf->len_avail == 0)
2910 return (lzh_decode_huffman_tree(hf, rbits, c));