enc_huffman.h (837B)
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 <cstddef> 10 #include <cstdint> 11 12 #include "lib/jxl/base/status.h" 13 #include "lib/jxl/enc_bit_writer.h" 14 15 namespace jxl { 16 17 // Builds a Huffman tree for the given histogram, and encodes it into writer 18 // in a format that can be read by HuffmanDecodingData::ReadFromBitstream. 19 // An allotment for `writer` must already have been created by the caller. 20 Status BuildAndStoreHuffmanTree(const uint32_t* histogram, size_t length, 21 uint8_t* depth, uint16_t* bits, 22 BitWriter* writer); 23 24 } // namespace jxl 25 26 #endif // LIB_JXL_ENC_HUFFMAN_H_