enc_huffman.h (759B)
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #ifndef LIB_JXL_ENC_HUFFMAN_H_ 7 #define LIB_JXL_ENC_HUFFMAN_H_ 8 9 #include "lib/jxl/enc_bit_writer.h" 10 11 namespace jxl { 12 13 // Builds a Huffman tree for the given histogram, and encodes it into writer 14 // in a format that can be read by HuffmanDecodingData::ReadFromBitstream. 15 // An allotment for `writer` must already have been created by the caller. 16 void BuildAndStoreHuffmanTree(const uint32_t* histogram, size_t length, 17 uint8_t* depth, uint16_t* bits, 18 BitWriter* writer); 19 20 } // namespace jxl 21 22 #endif // LIB_JXL_ENC_HUFFMAN_H_