24 #include "huffman.hpp"
25 #include "bititerator.hpp"
30 void HuffmanDecoder::printTable_(std::string prefix,
unsigned int pos)
const
32 const HuffmanNode &cur = m_p[pos];
34 std::cerr << prefix <<
" " << cur.data <<
"\n";
36 printTable_(prefix +
"0", pos + 1);
37 printTable_(prefix +
"1", cur.data);
41 HuffmanDecoder::HuffmanDecoder(
const HuffmanNode*
const p) : m_p(p)
45 void HuffmanDecoder::printTable()
const
50 unsigned int HuffmanDecoder::decode(BitIterator& i)
53 while (!m_p[cur].isLeaf) {
54 unsigned int bit = i.get(1);