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
Shinya Kitaoka 120a6e
class DVAPI TRasterCodec {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRasterCodec(const std::string &name) : m_name(name) {}
Shinya Kitaoka 120a6e
  virtual ~TRasterCodec() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // virtual int getMaxCompressionSize(int size) = 0;
Shinya Kitaoka 120a6e
  // virtual void compress  (const TRasterP &inRas, int allocUnit, UCHAR**
Shinya Kitaoka 120a6e
  // outData, TINT32 &outDataSize) = 0;
Shinya Kitaoka 120a6e
  // virtual void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP
Shinya Kitaoka 120a6e
  // &outRas) = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // virtual int getHeaderSize() = 0;
Shinya Kitaoka 120a6e
  // virtual UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
Shinya Kitaoka 120a6e
  // &outDataSize, int &lx, int &ly) = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  std::string m_name;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TRasterCodecDummy final : public TRasterCodec {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRasterCodecDummy(const std::string &name) : TRasterCodec(name) {}
Shinya Kitaoka 120a6e
  ~TRasterCodecDummy() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // int getMaxCompressionSize(int size);
Shinya Kitaoka 120a6e
  // void compress(const TRasterP &inRas, int allocUnit, UCHAR** outData, TINT32
Shinya Kitaoka 120a6e
  // &outDataSize);
Shinya Kitaoka 120a6e
  // void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // int getHeaderSize();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
Shinya Kitaoka 120a6e
  // &outDataSize, int &lx, int &ly);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TRasterCodecQTL final : public TRasterCodec {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRasterCodecQTL(const std::string &name) : TRasterCodec(name) {}
Shinya Kitaoka 120a6e
  ~TRasterCodecQTL() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // int getMaxCompressionSize(int size);
Shinya Kitaoka 120a6e
  // void compress  (const TRasterP &inRas, int allocUnit, UCHAR** outData,
Shinya Kitaoka 120a6e
  // TINT32 &outDataSize);
Shinya Kitaoka 120a6e
  // void decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // UCHAR *removeHeader(const UCHAR* inData, TINT32 inDataSize, TINT32
Shinya Kitaoka 120a6e
  // &outDataSize, int &lx, int &ly);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // int getHeaderSize();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // static TRasterCodec *create(const std::string &name);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
/*class DVAPI TRasterCodecSnappy final : 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);
Shinya Kitaoka 120a6e
  bool decompress(const UCHAR* inData, TINT32 inDataSize, TRasterP &outRas, bool
Shinya Kitaoka 120a6e
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
Shinya Kitaoka 120a6e
class DVAPI TRasterCodecLz4 : public TRasterCodec {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRasterCodecLz4(const std::string &name, bool useCache);
Shinya Kitaoka 120a6e
  ~TRasterCodecLz4();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
Shinya Kitaoka 120a6e
  bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas,
Shinya Kitaoka 120a6e
                  bool safeMode);
Shinya Kitaoka 120a6e
  void decompress(const TRasterP &compressedRas, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void reset() {
Shinya Kitaoka 120a6e
    if (m_useCache) return;
Shinya Kitaoka 120a6e
    m_raster = TRasterGR8P();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TRasterGR8P m_raster;
Shinya Kitaoka 120a6e
  std::string m_cacheId;
Shinya Kitaoka 120a6e
  bool m_useCache;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TRasterCodecLZO final : public TRasterCodec {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TRasterCodecLZO(const std::string &name, bool useCache);
Shinya Kitaoka 120a6e
  ~TRasterCodecLZO();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRasterP compress(const TRasterP &inRas, int allocUnit, TINT32 &outDataSize);
Shinya Kitaoka 120a6e
  bool decompress(const UCHAR *inData, TINT32 inDataSize, TRasterP &outRas,
Shinya Kitaoka 120a6e
                  bool safeMode);
Shinya Kitaoka 120a6e
  void decompress(const TRasterP &compressedRas, TRasterP &outRas);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void reset() {
Shinya Kitaoka 120a6e
    if (m_useCache) return;
Shinya Kitaoka 120a6e
    m_raster = TRasterGR8P();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TRasterGR8P m_raster;
Shinya Kitaoka 120a6e
  std::string m_cacheId;
Shinya Kitaoka 120a6e
  bool m_useCache;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  UINT doCompress(const TRasterP &inRas, int allocUnit, TRasterGR8P &outRas);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif