dec_huffman.h (867B)
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_DEC_HUFFMAN_H_ 7 #define LIB_JXL_DEC_HUFFMAN_H_ 8 9 #include <memory> 10 #include <vector> 11 12 #include "lib/jxl/dec_bit_reader.h" 13 #include "lib/jxl/huffman_table.h" 14 15 namespace jxl { 16 17 static constexpr size_t kHuffmanTableBits = 8u; 18 19 struct HuffmanDecodingData { 20 // Decodes the Huffman code lengths from the bit-stream and fills in the 21 // pre-allocated table with the corresponding 2-level Huffman decoding table. 22 // Returns false if the Huffman code lengths can not de decoded. 23 bool ReadFromBitStream(size_t alphabet_size, BitReader* br); 24 25 uint16_t ReadSymbol(BitReader* br) const; 26 27 std::vector<HuffmanCode> table_; 28 }; 29 30 } // namespace jxl 31 32 #endif // LIB_JXL_DEC_HUFFMAN_H_