MrSID Decode SDK for Raster Reference Manual
9.5.4.4709
|
00001 /* $Id$ */ 00002 /* ////////////////////////////////////////////////////////////////////////// 00003 // // 00004 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, // 00005 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution // 00006 // prohibited. Access to and use of this code is permitted only under // 00007 // license from LizardTech, Inc. Portions of the code are protected by // 00008 // US and foreign patents and other filings. All Rights Reserved. // 00009 // // 00011 /* PUBLIC */ 00012 00013 #ifndef MRSIDIMAGEREADERBASE_H 00014 #define MRSIDIMAGEREADERBASE_H 00015 00016 // lt_lib_mrsid_core 00017 #include "lti_types.h" 00018 #include "lti_geoImageReader.h" 00019 00020 LT_BEGIN_NAMESPACE(LizardTech) 00021 00022 class MrSIDImageStageManager; 00023 class MrSIDPasswordDelegate; 00024 class MrSIDSimplePasswordDelegate; 00025 00026 00027 /* 00028 * memory settings for creating MrSID decoders 00029 * 00030 * "Small", "medium", and "large" refer to how much memory the 00031 * decoder will use when opening the image and constructing certain 00032 * internal data structures and tables. In general, decode 00033 * performance will increase if more memory can be used. 00034 */ 00035 enum MrSIDMemoryUsage 00036 { 00037 MRSID_MEMORY_USAGE_INVALID = 0, 00038 MRSID_MEMORY_USAGE_DEFAULT = 1, 00039 MRSID_MEMORY_USAGE_SMALL = 2, 00040 MRSID_MEMORY_USAGE_MEDIUM = 3, 00041 MRSID_MEMORY_USAGE_LARGE = 4 00042 }; 00043 00044 /* 00045 * stream settings for creating MrSID decoders 00046 * 00047 * Normally, the stream used by the decoder is 00048 * only opened when doing actual decode work, as resources like 00049 * file handles can be a scarce resource in some environments. This 00050 * obviously incurs a performance penalty; the "KeepStreamOpen" modes 00051 * can be used to change the behaviour. 00052 */ 00053 enum MrSIDStreamUsage 00054 { 00055 MRSID_STREAM_USAGE_INVALID = 0, 00056 MRSID_STREAM_USAGE_KEEPOPEN = 2, 00057 MRSID_STREAM_USAGE_KEEPCLOSED = 3, 00058 MRSID_STREAM_USAGE_DEFAULT = MRSID_STREAM_USAGE_KEEPCLOSED 00059 }; 00060 00061 00068 class MrSIDImageReaderInterface 00069 { 00070 LT_DISALLOW_COPY_CONSTRUCTOR(MrSIDImageReaderInterface); 00071 public: 00072 virtual ~MrSIDImageReaderInterface(); 00073 00083 virtual lt_uint8 getNumLevels() const = 0; 00084 00095 virtual bool isLocked() const = 0; 00096 00110 void setPasswordDelegate(MrSIDPasswordDelegate* passwordDelegate); 00111 00126 void setPassword(const lt_utf8* password); 00127 00128 public: 00143 virtual void setMaxWorkerThreads(int numThreads) = 0; 00144 00156 virtual int getMaxWorkerThreads() const = 0; 00157 00158 public: 00173 static LT_STATUS getMrSIDGeneration(const LTFileSpec& fileSpec, lt_uint8& gen, bool &raster); 00174 00189 static LT_STATUS getMrSIDGeneration(LTIOStreamInf& stream, lt_uint8 &gen, bool &raster); 00190 00205 static LT_STATUS getMrSIDGeneration(const lt_uint8 version[8], lt_uint8& gen, bool &raster); 00206 00219 LT_STATUS getMrSIDGeneration(lt_uint8 &gen, bool &raster) const; 00220 00235 LT_STATUS getMrSIDVersion(lt_uint8& major, lt_uint8& minor, 00236 lt_uint8& tweak, char& letter) const; 00237 00238 protected: 00239 MrSIDImageReaderInterface(); 00240 LT_STATUS init(MrSIDMemoryUsage memoryUsage, 00241 MrSIDStreamUsage streamUsage, 00242 const lt_uint8 preamble[8]); 00243 00244 static LT_STATUS getGeoCoordFromMetadata(LTIMetadataDatabase &metadata, 00245 LTIGeoCoord &geoCoord, 00246 bool &hasGeo); 00247 00248 static LTIOStreamInf *openWorldFileStream(const LTFileSpec &fileSpec, 00249 bool useWorldFile); 00250 00251 MrSIDMemoryUsage m_memoryUsage; 00252 MrSIDStreamUsage m_streamUsage; 00253 lt_uint8 m_magic[8]; 00254 00255 private: 00256 MrSIDPasswordDelegate* m_pwdDelegate; 00257 MrSIDSimplePasswordDelegate* m_localPwdDelegate; 00258 }; 00259 00260 00261 class MrSIDSingleImageReaderBase : public LTIGeoImageReader, 00262 public MrSIDImageReaderInterface 00263 { 00264 LT_DISALLOW_COPY_CONSTRUCTOR(MrSIDSingleImageReaderBase); 00265 public: 00266 // LTIImageStage 00267 virtual lt_int64 getEncodingCost(const LTIScene& scene) const; 00268 virtual lt_uint32 getModifications(const LTIScene &scene) const; 00269 00270 protected: 00271 MrSIDSingleImageReaderBase(bool supportBandSelection); 00272 ~MrSIDSingleImageReaderBase(void); 00273 00274 LT_STATUS init(MrSIDImageStageManager *manager); 00275 00276 MrSIDImageStageManager *m_manager; 00277 }; 00278 00279 LT_END_NAMESPACE(LizardTech) 00280 00281 #endif // MRSIDIMAGEREADERBASE_H