Lines Matching full:heap

88  * need for the L_CODES extra codes used during heap construction. However
479 /* Index within the heap array of least frequent node in the Huffman tree */
483 * Remove the smallest element from the heap and recreate the heap with
484 * one less element. Updates heap and heap_len.
488 top = s->heap[SMALLEST]; \
489 s->heap[SMALLEST] = s->heap[s->heap_len--]; \
502 * Restore the heap property by moving down the tree starting at node k,
504 * when the heap property is re-established (each father smaller than its
508 int v = s->heap[k]; in pqdownheap()
513 smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { in pqdownheap()
517 if (smaller(tree, v, s->heap[j], s->depth)) break; in pqdownheap()
520 s->heap[k] = s->heap[j]; k = j; in pqdownheap()
525 s->heap[k] = v; in pqdownheap()
531 * IN assertion: the fields freq and dad are set, heap[heap_max] and
545 int h; /* heap index */ in gen_bitlen()
557 tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ in gen_bitlen()
560 n = s->heap[h]; in gen_bitlen()
601 m = s->heap[--h]; in gen_bitlen()
629 int n, m; /* iterate over heap elements */ in build_tree()
633 /* Construct the initial heap, with least frequent element in in build_tree()
634 * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. in build_tree()
635 * heap[0] is not used. in build_tree()
641 s->heap[++(s->heap_len)] = max_code = n; in build_tree()
654 node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); in build_tree()
662 /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, in build_tree()
673 m = s->heap[SMALLEST]; /* m = node of next least frequency */ in build_tree()
675 s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ in build_tree()
676 s->heap[--(s->heap_max)] = m; in build_tree()
689 /* and insert the new node in the heap */ in build_tree()
690 s->heap[SMALLEST] = node++; in build_tree()
695 s->heap[--(s->heap_max)] = s->heap[SMALLEST]; in build_tree()