Lines Matching refs:tree

135 static void SetBitDepths(const HuffmanTree* const tree,  in SetBitDepths()  argument
138 if (tree->pool_index_left_ >= 0) { in SetBitDepths()
139 SetBitDepths(&pool[tree->pool_index_left_], pool, bit_depths, level + 1); in SetBitDepths()
140 SetBitDepths(&pool[tree->pool_index_right_], pool, bit_depths, level + 1); in SetBitDepths()
142 bit_depths[tree->value_] = level; in SetBitDepths()
167 HuffmanTree* tree, int tree_depth_limit, in GenerateOptimalTree() argument
184 tree_pool = tree + tree_size_orig; in GenerateOptimalTree()
201 tree[idx].total_count_ = count; in GenerateOptimalTree()
202 tree[idx].value_ = j; in GenerateOptimalTree()
203 tree[idx].pool_index_left_ = -1; in GenerateOptimalTree()
204 tree[idx].pool_index_right_ = -1; in GenerateOptimalTree()
210 qsort(tree, tree_size, sizeof(*tree), CompareHuffmanTrees); in GenerateOptimalTree()
216 tree_pool[tree_pool_size++] = tree[tree_size - 1]; in GenerateOptimalTree()
217 tree_pool[tree_pool_size++] = tree[tree_size - 2]; in GenerateOptimalTree()
225 if (tree[k].total_count_ <= count) { in GenerateOptimalTree()
229 memmove(tree + (k + 1), tree + k, (tree_size - k) * sizeof(*tree)); in GenerateOptimalTree()
230 tree[k].total_count_ = count; in GenerateOptimalTree()
231 tree[k].value_ = -1; in GenerateOptimalTree()
233 tree[k].pool_index_left_ = tree_pool_size - 1; in GenerateOptimalTree()
234 tree[k].pool_index_right_ = tree_pool_size - 2; in GenerateOptimalTree()
238 SetBitDepths(&tree[0], tree_pool, bit_depths, 0); in GenerateOptimalTree()
240 bit_depths[tree[0].value_] = 1; in GenerateOptimalTree()
326 int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree, in VP8LCreateCompressedHuffmanTree() argument
330 const int depth_size = tree->num_symbols; in VP8LCreateCompressedHuffmanTree()
335 const int value = tree->code_lengths[i]; in VP8LCreateCompressedHuffmanTree()
338 while (k < depth_size && tree->code_lengths[k] == value) ++k; in VP8LCreateCompressedHuffmanTree()
374 static void ConvertBitDepthsToSymbols(HuffmanTreeCode* const tree) { in ConvertBitDepthsToSymbols() argument
381 assert(tree != NULL); in ConvertBitDepthsToSymbols()
382 len = tree->num_symbols; in ConvertBitDepthsToSymbols()
384 const int code_length = tree->code_lengths[i]; in ConvertBitDepthsToSymbols()
398 const int code_length = tree->code_lengths[i]; in ConvertBitDepthsToSymbols()
399 tree->codes[i] = ReverseBits(code_length, next_code[code_length]++); in ConvertBitDepthsToSymbols()