Lines Matching refs:tree
133 static void pqdownheap (deflate_state *s, ct_data *tree, int k);
135 static void gen_codes (ct_data *tree, int max_code, ush *bl_count);
137 static void scan_tree (deflate_state *s, ct_data *tree, int max_code);
138 static void send_tree (deflate_state *s, ct_data *tree, int max_code);
150 # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) argument
154 # define send_code(s, c, tree) \ argument
156 send_bits(s, tree[c].Code, tree[c].Len); }
296 #define pqremove(s, tree, top) \ argument
300 pqdownheap(s, tree, SMALLEST); \
307 #define smaller(tree, n, m, depth) \ argument
308 (tree[n].Freq < tree[m].Freq || \
309 (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
319 ct_data *tree, /* the tree to restore */ in pqdownheap() argument
328 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { in pqdownheap()
332 if (smaller(tree, v, s->heap[j], s->depth)) break; in pqdownheap()
358 ct_data *tree = desc->dyn_tree; in gen_bitlen() local
376 tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ in gen_bitlen()
380 bits = tree[tree[n].Dad].Len + 1; in gen_bitlen()
382 tree[n].Len = (ush)bits; in gen_bitlen()
390 f = tree[n].Freq; in gen_bitlen()
422 if (tree[m].Len != (unsigned) bits) { in gen_bitlen()
423 Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); in gen_bitlen()
424 s->opt_len += ((long)bits - (long)tree[m].Len) in gen_bitlen()
425 *(long)tree[m].Freq; in gen_bitlen()
426 tree[m].Len = (ush)bits; in gen_bitlen()
442 ct_data *tree, /* the tree to decorate */ in gen_codes() argument
466 int len = tree[n].Len; in gen_codes()
469 tree[n].Code = bitrev32((u32)(next_code[len]++)) >> (32 - len); in gen_codes()
471 Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", in gen_codes()
472 n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); in gen_codes()
489 ct_data *tree = desc->dyn_tree; in build_tree() local
503 if (tree[n].Freq != 0) { in build_tree()
507 tree[n].Len = 0; in build_tree()
518 tree[node].Freq = 1; in build_tree()
528 for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); in build_tree()
535 pqremove(s, tree, n); /* n = node of least frequency */ in build_tree()
542 tree[node].Freq = tree[n].Freq + tree[m].Freq; in build_tree()
544 tree[n].Dad = tree[m].Dad = (ush)node; in build_tree()
546 if (tree == s->bl_tree) { in build_tree()
548 node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); in build_tree()
553 pqdownheap(s, tree, SMALLEST); in build_tree()
565 gen_codes ((ct_data *)tree, max_code, s->bl_count); in build_tree()
574 ct_data *tree, /* the tree to be scanned */ in scan_tree() argument
581 int nextlen = tree[0].Len; /* length of next code */ in scan_tree()
587 tree[max_code+1].Len = (ush)0xffff; /* guard */ in scan_tree()
590 curlen = nextlen; nextlen = tree[n+1].Len; in scan_tree()
620 ct_data *tree, /* the tree to be scanned */ in send_tree() argument
627 int nextlen = tree[0].Len; /* length of next code */ in send_tree()
636 curlen = nextlen; nextlen = tree[n+1].Len; in send_tree()