Home | History | Annotate | Download | only in zopfli

Lines Matching defs:node

30 typedef struct Node Node;
35 struct Node {
37 Node* tail; /* Previous node(s) of this chain, or 0 if none. */
46 Node* nodes; /* The pool. */
47 Node* next; /* Pointer to a possibly free node in the pool. */
52 Initializes a chain node with the given values and marks it as in use.
54 static void InitNode(size_t weight, int count, Node* tail, Node* node) {
55 node->weight = weight;
56 node->count = count;
57 node->tail = tail;
58 node->inuse = 1;
65 pool: Memory pool to get free node from.
67 static Node* GetFreeNode(Node* (*lists)[2], int maxbits, NodePool* pool) {
77 Node* node;
78 for (node = lists[i / 2][i % 2]; node; node = node->tail) {
79 node->inuse = 1;
100 pool: the node memory pool.
105 static void BoundaryPM(Node* (*lists)[2], int maxbits,
106 Node* leaves, int numsymbols, NodePool* pool, int index, char final) {
107 Node* newchain;
108 Node* oldchain;
117 pointing to the new node, to let the garbage collection know it's in use. */
122 /* New leaf node in list 0. */
146 NodePool* pool, const Node* leaves, int maxbits, Node* (*lists)[2]) {
148 Node* node0 = GetFreeNode(0, maxbits, pool);
149 Node* node1 = GetFreeNode(0, maxbits, pool);
163 static void ExtractBitLengths(Node* chain, Node* leaves, unsigned* bitlengths) {
164 Node* node;
165 for (node = chain; node; node = node->tail) {
167 for (i = 0; i < node->count; i++) {
177 return ((const Node*)a)->weight - ((const Node*)b)->weight;
188 a time, so each list is a array of two Node*'s. */
189 Node* (*lists)[2];
192 Node* leaves = (Node*)malloc(n * sizeof(*leaves));
224 qsort(leaves, numsymbols, sizeof(Node), LeafComparator);
226 /* Initialize node memory pool. */
228 pool.nodes = (Node*)malloc(pool.size * sizeof(*pool.nodes));
234 lists = (Node* (*)[2])malloc(maxbits * sizeof(*lists));