Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TCODEC_INCLUDED
Toshihiro Shimizu 890ddd
#define TCODEC_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TRASTERIMAGE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRasterCodec(const std::string &name) : m_name(name) {}
Toshihiro Shimizu 890ddd
	virtual ~TRasterCodec() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//virtual int getMaxCompressionSize(int size) = 0;
Toshihiro Shimizu 890ddd
	//virtual void compress  (const TRasterP &inRas, int allocUnit, UCHAR** outData, TINT32 &outDataSize) = 0;
Toshihiro Shimizu 890ddd
	//virtual void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas) = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//virtual int getHeaderSize() = 0;
Toshihiro Shimizu 890ddd
	//virtual UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32 &outDataSize, int &lx, int &ly) = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 3bfa54
	std::string m_name;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterCodecDummy : public TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRasterCodecDummy(const std::string &name) : TRasterCodec(name) {}
Toshihiro Shimizu 890ddd
	~TRasterCodecDummy() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//int getMaxCompressionSize(int size);
Toshihiro Shimizu 890ddd
	//void compress(const TRasterP &inRas, int allocUnit, UCHAR** outData, TINT32 &outDataSize);
Toshihiro Shimizu 890ddd
	//void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//int getHeaderSize();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32 &outDataSize, int &lx, int &ly);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	//static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterCodecQTL : public TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRasterCodecQTL(const std::string &name) : TRasterCodec(name) {}
Toshihiro Shimizu 890ddd
	~TRasterCodecQTL() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//int getMaxCompressionSize(int size);
Toshihiro Shimizu 890ddd
	//void compress  (const TRasterP &inRas, int allocUnit, UCHAR** outData, TINT32 &outDataSize);
Toshihiro Shimizu 890ddd
	//void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32 &outDataSize, int &lx, int &ly);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//int getHeaderSize();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	//static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*class DVAPI TRasterCodecSnappy : public TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
  TRasterCodecSnappy(const std::string &name, bool useCache);
Toshihiro Shimizu 890ddd
  ~TRasterCodecSnappy();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
Toshihiro Shimizu 890ddd
  bool decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas, bool safeMode);
Toshihiro Shimizu 890ddd
  void decompress(const TRasterP & compressedRas, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  void reset() { if (m_useCache) return; m_raster=TRasterGR8P(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  TRasterGR8P m_raster;
Toshihiro Shimizu 890ddd
  string m_cacheId;
Toshihiro Shimizu 890ddd
  bool m_useCache;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P& outRas);
Toshihiro Shimizu 890ddd
};*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterCodecLz4 : public TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRasterCodecLz4(const std::string &name, bool useCache);
Toshihiro Shimizu 890ddd
	~TRasterCodecLz4();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
Toshihiro Shimizu 890ddd
	bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas, bool safeMode);
Toshihiro Shimizu 890ddd
	void decompress(const TRasterP &compressedRas, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void reset()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (m_useCache)
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		m_raster = TRasterGR8P();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TRasterGR8P m_raster;
Shinya Kitaoka 3bfa54
	std::string m_cacheId;
Toshihiro Shimizu 890ddd
	bool m_useCache;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterCodecLZO : public TRasterCodec
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TRasterCodecLZO(const std::string &name, bool useCache);
Toshihiro Shimizu 890ddd
	~TRasterCodecLZO();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
Toshihiro Shimizu 890ddd
	bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas, bool safeMode);
Toshihiro Shimizu 890ddd
	void decompress(const TRasterP &compressedRas, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void reset()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (m_useCache)
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		m_raster = TRasterGR8P();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TRasterGR8P m_raster;
Shinya Kitaoka 3bfa54
	std::string m_cacheId;
Toshihiro Shimizu 890ddd
	bool m_useCache;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif