2018-10-07 03:37:09 +00:00
|
|
|
#pragma once
|
2014-09-09 16:36:29 +00:00
|
|
|
|
|
|
|
#include "LZ77/LZLookupTable.hpp"
|
|
|
|
|
2018-12-08 05:18:17 +00:00
|
|
|
class LZBase {
|
2014-09-09 16:36:29 +00:00
|
|
|
public:
|
2018-12-08 05:18:17 +00:00
|
|
|
explicit LZBase(atInt32 minimumOffset = 1, atInt32 slidingWindow = 4096, atInt32 minimumMatch = 3,
|
|
|
|
atInt32 blockSize = 8);
|
2019-08-16 03:31:02 +00:00
|
|
|
virtual ~LZBase();
|
2018-12-08 05:18:17 +00:00
|
|
|
|
|
|
|
virtual atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength) = 0;
|
|
|
|
virtual atUint32 decompress(const atUint8* src, atUint8** dest, atUint32 srcLength) = 0;
|
|
|
|
|
|
|
|
void setSlidingWindow(atInt32 SlidingWindow);
|
2019-08-16 03:19:24 +00:00
|
|
|
atInt32 slidingWindow() const;
|
2018-12-08 05:18:17 +00:00
|
|
|
void setReadAheadBuffer(atInt32 ReadAheadBuffer);
|
2019-08-16 03:19:24 +00:00
|
|
|
atInt32 readAheadBuffer() const;
|
2018-12-08 05:18:17 +00:00
|
|
|
void setMinMatch(atInt32 minimumMatch);
|
2019-08-16 03:19:24 +00:00
|
|
|
atInt32 minMatch() const;
|
2018-12-08 05:18:17 +00:00
|
|
|
void setBlockSize(atInt32 BlockSize);
|
2019-08-16 03:19:24 +00:00
|
|
|
atInt32 blockSize() const;
|
2018-12-08 05:18:17 +00:00
|
|
|
void setMinimumOffset(atUint32 minimumOffset);
|
2019-08-16 03:19:24 +00:00
|
|
|
atUint32 minimumOffset() const;
|
2015-05-19 03:24:56 +00:00
|
|
|
|
2014-09-09 16:36:29 +00:00
|
|
|
protected:
|
2019-08-16 03:19:24 +00:00
|
|
|
LZLengthOffset search(const atUint8* posPtr, const atUint8* dataBegin, const atUint8* dataEnd) const;
|
2018-12-08 05:18:17 +00:00
|
|
|
|
|
|
|
atInt32 m_slidingWindow;
|
|
|
|
atInt32 m_readAheadBuffer;
|
|
|
|
atInt32 m_minMatch; // Minimum number of bytes that have to matched to go through with compression
|
|
|
|
atInt32 m_blockSize;
|
|
|
|
atUint32 m_minOffset;
|
|
|
|
LZLookupTable m_lookupTable;
|
2014-09-09 16:36:29 +00:00
|
|
|
};
|