1
#ifndef __DEFLATE_ENCODER_H
2
#define __DEFLATE_ENCODER_H
5
#include "LSBFEncoder.h"
6
#include "HuffmanEncoder.h"
26
UINT16 *MatchDistances;
27
UINT16 LongestMatchLength;
28
UINT16 LongestMatchDistance;
29
void Init(UINT16 *aMatchDistances)
31
MatchDistances = aMatchDistances;
42
const int kNumOpts = 0x1000;
48
COptimal m_Optimum[kNumOpts];
50
NBT3Z::CInTree m_MatchFinder;
52
NStream::NLSBF::CEncoder m_OutStream;
53
NStream::NLSBF::CReverseEncoder m_ReverseOutStream;
55
NCompression::NHuffman::CEncoder m_MainCoder;
56
NCompression::NHuffman::CEncoder m_DistCoder;
57
NCompression::NHuffman::CEncoder m_LevelCoder;
59
BYTE m_LastLevels[kMaxTableSize];
64
UINT32 m_OptimumEndIndex;
65
UINT32 m_OptimumCurrentIndex;
66
UINT32 m_AdditionalOffset;
68
UINT32 m_LongestMatchLength;
69
UINT32 m_LongestMatchDistance;
70
UINT16 *m_MatchDistances;
72
UINT32 m_NumFastBytes;
73
UINT32 m_MatchLengthEdge;
75
BYTE m_LiteralPrices[256];
77
BYTE m_LenPrices[kNumLenCombinations];
78
BYTE m_PosPrices[kDistTableSize];
80
UINT32 m_CurrentBlockUncompressedSize;
82
COnePosMatches *m_OnePosMatchesArray;
83
UINT16 *m_OnePosMatchesMemory;
85
UINT64 m_BlockStartPostion;
93
void GetBacks(UINT32 aPos);
96
void MovePos(UINT32 aNum);
97
UINT32 Backward(UINT32 &aBackRes, UINT32 aCur);
98
UINT32 GetOptimal(UINT32 &aBackRes);
100
void InitStructures();
101
void CodeLevelTable(BYTE *aNewLevels, int aNumLevels, bool aCodeMode);
102
int WriteTables(bool aWriteMode, bool anFinalBlock);
103
void CopyBackBlockOp(UINT32 aDistance, UINT32 aLength);
104
void WriteBlockData(bool aWriteMode, bool anFinalBlock);
106
HRESULT CodeReal(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize);
112
HRESULT SetEncoderNumPasses(UINT32 A);
113
HRESULT SetEncoderNumFastBytes(UINT32 A);
114
HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize);