summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc')
-rw-r--r--third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc b/third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc
index 5c40dea770..82ae4bccc7 100644
--- a/third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc
+++ b/third_party/jpeg-xl/lib/jxl/enc_huffman_tree.cc
@@ -85,7 +85,8 @@ void CreateHuffmanTree(const uint32_t* data, const size_t length,
size_t i = 0; // Points to the next leaf node.
size_t j = n + 1; // Points to the next non-leaf node.
for (size_t k = n - 1; k != 0; --k) {
- size_t left, right;
+ size_t left;
+ size_t right;
if (tree[i].total_count <= tree[j].total_count) {
left = i;
++i;
@@ -112,7 +113,7 @@ void CreateHuffmanTree(const uint32_t* data, const size_t length,
tree.push_back(sentinel);
}
JXL_DASSERT(tree.size() == 2 * n + 1);
- SetDepth(tree[2 * n - 1], &tree[0], depth, 0);
+ SetDepth(tree[2 * n - 1], tree.data(), depth, 0);
// We need to pack the Huffman tree in tree_limit bits.
// If this was not successful, add fake entities to the lowest values