2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TCODEC_INCLUDED
|
|
|
|
#define TCODEC_INCLUDED
|
|
|
|
|
|
|
|
#include "traster.h"
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TRASTERIMAGE_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI TRasterCodec {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterCodec(const std::string &name) : m_name(name) {}
|
|
|
|
virtual ~TRasterCodec() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// virtual int getMaxCompressionSize(int size) = 0;
|
|
|
|
// virtual void compress (const TRasterP &inRas, int allocUnit, UCHAR**
|
|
|
|
// outData, TINT32 &outDataSize) = 0;
|
|
|
|
// virtual void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP
|
|
|
|
// &outRas) = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// virtual int getHeaderSize() = 0;
|
|
|
|
// virtual UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
|
|
|
|
// &outDataSize, int &lx, int &ly) = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
static TRasterCodec *create(const std::string &name);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
std::string m_name;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TRasterCodecDummy final : public TRasterCodec {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterCodecDummy(const std::string &name) : TRasterCodec(name) {}
|
|
|
|
~TRasterCodecDummy() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// int getMaxCompressionSize(int size);
|
|
|
|
// void compress(const TRasterP &inRas, int allocUnit, UCHAR** outData, TINT32
|
|
|
|
// &outDataSize);
|
|
|
|
// void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// int getHeaderSize();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
|
|
|
|
// &outDataSize, int &lx, int &ly);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// static TRasterCodec *create(const std::string &name);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TRasterCodecQTL final : public TRasterCodec {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterCodecQTL(const std::string &name) : TRasterCodec(name) {}
|
|
|
|
~TRasterCodecQTL() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// int getMaxCompressionSize(int size);
|
|
|
|
// void compress (const TRasterP &inRas, int allocUnit, UCHAR** outData,
|
|
|
|
// TINT32 &outDataSize);
|
|
|
|
// void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
|
|
|
|
// &outDataSize, int &lx, int &ly);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// int getHeaderSize();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// static TRasterCodec *create(const std::string &name);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
/*class DVAPI TRasterCodecSnappy final : public TRasterCodec
|
2016-03-19 06:57:51 +13:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2016-04-19 19:32:17 +12:00
|
|
|
TRasterCodecSnappy(const std::string &name, bool useCache);
|
2016-03-19 06:57:51 +13:00
|
|
|
~TRasterCodecSnappy();
|
|
|
|
|
|
|
|
TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
|
2016-06-15 18:43:10 +12:00
|
|
|
bool decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas, bool
|
|
|
|
safeMode);
|
2016-03-19 06:57:51 +13:00
|
|
|
void decompress(const TRasterP & compressedRas, TRasterP &outRas);
|
|
|
|
|
|
|
|
void reset() { if (m_useCache) return; m_raster=TRasterGR8P(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
TRasterGR8P m_raster;
|
|
|
|
string m_cacheId;
|
|
|
|
bool m_useCache;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P& outRas);
|
|
|
|
};*/
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class DVAPI TRasterCodecLz4 : public TRasterCodec {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterCodecLz4(const std::string &name, bool useCache);
|
|
|
|
~TRasterCodecLz4();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
|
|
|
|
bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas,
|
|
|
|
bool safeMode);
|
|
|
|
void decompress(const TRasterP &compressedRas, TRasterP &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void reset() {
|
|
|
|
if (m_useCache) return;
|
|
|
|
m_raster = TRasterGR8P();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterGR8P m_raster;
|
|
|
|
std::string m_cacheId;
|
|
|
|
bool m_useCache;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TRasterCodecLZO final : public TRasterCodec {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterCodecLZO(const std::string &name, bool useCache);
|
|
|
|
~TRasterCodecLZO();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
|
|
|
|
bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas,
|
|
|
|
bool safeMode);
|
|
|
|
void decompress(const TRasterP &compressedRas, TRasterP &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void reset() {
|
|
|
|
if (m_useCache) return;
|
|
|
|
m_raster = TRasterGR8P();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterGR8P m_raster;
|
|
|
|
std::string m_cacheId;
|
|
|
|
bool m_useCache;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|