mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
62 lines
1.3 KiB
C++
Executable File
62 lines
1.3 KiB
C++
Executable File
// 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
|