Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ImplodeHuffmanDecoder.h « Implode « Compress « 7zip - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9f7aeca1987f3bd424e5d73ee7080f25acd526ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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