This commit is contained in:
Igor Pavlov
2005-05-30 00:00:00 +00:00
committed by Kornel Lesiński
parent 8c1b5c7b7e
commit 3c510ba80b
926 changed files with 40559 additions and 23519 deletions

View File

@@ -1,11 +1,9 @@
// DeflateDecoder.h
#pragma once
#ifndef __DEFLATE_DECODER_H
#define __DEFLATE_DECODER_H
#include "Common/MyCom.h"
#include "../../../Common/MyCom.h"
#include "../../ICoder.h"
#include "../../Common/LSBFDecoder.h"
@@ -14,6 +12,7 @@
#include "../Huffman/HuffmanDecoder.h"
#include "DeflateExtConst.h"
#include "DeflateConst.h"
namespace NCompress {
namespace NDeflate {
@@ -30,26 +29,24 @@ public:
};
typedef NStream::NLSBF::CDecoder<CInBuffer> CInBit;
typedef NCompress::NHuffman::CDecoder<kNumHuffmanBits> CHuffmanDecoder;
class CCoder
{
CLZOutWindow m_OutWindowStream;
CInBit m_InBitStream;
CHuffmanDecoder m_MainDecoder;
CHuffmanDecoder m_DistDecoder;
CHuffmanDecoder m_LevelDecoder; // table for decoding other tables;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kStaticMainTableSize> m_MainDecoder;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kStaticDistTableSize> m_DistDecoder;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
bool m_FinalBlock;
bool m_StoredMode;
UINT32 m_StoredBlockSize;
UInt32 m_StoredBlockSize;
bool _deflate64Mode;
void DeCodeLevelTable(BYTE *newLevels, int numLevels);
void DeCodeLevelTable(Byte *newLevels, int numLevels);
void ReadTables();
/*
void CCoder::ReleaseStreams()
{
m_OutWindowStream.ReleaseStream();
@@ -59,29 +56,30 @@ class CCoder
{
CCoder *m_Coder;
public:
CCoderReleaser(CCoder *coder): m_Coder(coder) {}
bool NeedFlush;
CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
~CCoderReleaser()
{
m_Coder->m_OutWindowStream.Flush();
if (NeedFlush)
m_Coder->m_OutWindowStream.Flush();
m_Coder->ReleaseStreams();
}
};
friend class CCoderReleaser;
*/
public:
CCoder(bool deflate64Mode = false);
HRESULT CodeReal(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UINT64 *inSize, const UINT64 *outSize,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
HRESULT BaseCode(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UINT64 *inSize, const UINT64 *outSize,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
// IGetInStreamProcessedSize
HRESULT BaseGetInStreamProcessedSize(UINT64 *aValue);
HRESULT BaseGetInStreamProcessedSize(UInt64 *aValue);
};
class CCOMCoder :
@@ -95,11 +93,11 @@ public:
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UINT64 *inSize, const UINT64 *outSize,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
// IGetInStreamProcessedSize
STDMETHOD(GetInStreamProcessedSize)(UINT64 *aValue);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *aValue);
CCOMCoder(): CCoder(false) {}
};
@@ -114,11 +112,11 @@ public:
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UINT64 *inSize, const UINT64 *outSize,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
// IGetInStreamProcessedSize
STDMETHOD(GetInStreamProcessedSize)(UINT64 *aValue);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *aValue);
CCOMCoder64(): CCoder(true) {}
};