diff options
Diffstat (limited to 'CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h')
-rwxr-xr-x | CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h b/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h new file mode 100755 index 00000000..9f7aeca1 --- /dev/null +++ b/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h @@ -0,0 +1,33 @@ +// ImplodeHuffmanDecoder.h + +#ifndef __IMPLODE_HUFFMAN_DECODER_H +#define __IMPLODE_HUFFMAN_DECODER_H + +#include "../../Common/LSBFDecoder.h" +#include "../../Common/InBuffer.h" + +namespace NCompress { +namespace NImplode { +namespace NHuffman { + +const int kNumBitsInLongestCode = 16; + +typedef NStream::NLSBF::CDecoder<CInBuffer> CInBit; + +class CDecoder +{ + UInt32 m_Limitits[kNumBitsInLongestCode + 2]; // m_Limitits[i] = value limit for symbols with length = i + UInt32 m_Positions[kNumBitsInLongestCode + 2]; // m_Positions[i] = index in m_Symbols[] of first symbol with length = i + UInt32 m_NumSymbols; // number of symbols in m_Symbols + UInt32 *m_Symbols; // symbols: at first with len=1 then 2, ... 15. +public: + CDecoder(UInt32 numSymbols); + ~CDecoder(); + + bool SetCodeLengths(const Byte *codeLengths); + UInt32 DecodeSymbol(CInBit *inStream); +}; + +}}} + +#endif |