#ifndef RLE_H
#define RLE_H
#include <cstddef>
#include "Defines.h"
NAMESPACE_LERC_START
class RLE
{
public:
RLE() : m_minNumEven(5) {}
virtual ~RLE() {}
size_t computeNumBytesRLE(const Byte* arr, size_t numBytes) const;
bool compress(const Byte* arr, size_t numBytes,
Byte** arrRLE, size_t& numBytesRLE, bool verify = false) const;
static bool decompress(const Byte* arrRLE, size_t nBytesRemaining, Byte** arr, size_t& numBytes);
static bool decompress(const Byte* arrRLE, size_t nBytesRemaining, Byte* arr, size_t arrSize);
protected:
int m_minNumEven;
static void writeCount(short cnt, Byte** ppCnt, Byte** ppDst);
static short readCount(const Byte** ppCnt);
};
NAMESPACE_LERC_END
#endif