blob: ec700454ad47b849f9e9340989c406f3aef3d907 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// ImplodeDecoder.h
#ifndef ZIP7_INC_COMPRESS_IMPLODE_DECODER_H
#define ZIP7_INC_COMPRESS_IMPLODE_DECODER_H
#include "../../Common/MyCom.h"
#include "../ICoder.h"
#include "../Common/InBuffer.h"
#include "BitlDecoder.h"
#include "LzOutWindow.h"
namespace NCompress {
namespace NImplode {
namespace NDecoder {
typedef NBitl::CDecoder<CInBuffer> CInBit;
const unsigned kNumHuffmanBits = 16;
const unsigned kMaxHuffTableSize = 1 << 8;
class CHuffmanDecoder
{
UInt32 _limits[kNumHuffmanBits + 1];
UInt32 _poses[kNumHuffmanBits + 1];
Byte _symbols[kMaxHuffTableSize];
public:
bool Build(const Byte *lens, unsigned numSymbols) throw();
UInt32 Decode(CInBit *inStream) const throw();
};
Z7_CLASS_IMP_NOQIB_4(
CCoder
, ICompressCoder
, ICompressSetDecoderProperties2
, ICompressSetFinishMode
, ICompressGetInStreamProcessedSize
)
CLzOutWindow _outWindowStream;
CInBit _inBitStream;
CHuffmanDecoder _litDecoder;
CHuffmanDecoder _lenDecoder;
CHuffmanDecoder _distDecoder;
Byte _flags;
bool _fullStreamMode;
bool BuildHuff(CHuffmanDecoder &table, unsigned numSymbols);
HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
public:
CCoder();
};
}}}
#endif
|