MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
MrSIDImageStageManager.h
Go to the documentation of this file.
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 __MRSID_IMAGE_STAGE_MANAGER_H__
00014 #define __MRSID_IMAGE_STAGE_MANAGER_H__
00015 
00016 // lt_lib_mrsid_core
00017 #include "lti_imageStageManager.h"
00018 #include "MrSIDImageReaderBase.h"
00019 
00020 LT_BEGIN_NAMESPACE(LizardTech)
00021 
00022 class MG3Container;
00023 class MG3SingleImageReader;
00024 class MG4SingleImageReader;
00025 class MG2ImageReader;
00026 
00027 class MrSIDImageStageManager : public LTIImageStageManager
00028 {
00029    LTI_REFERENCE_COUNTED_BOILERPLATE(MrSIDImageStageManager);
00030 public:
00038    LT_STATUS initialize(const LTFileSpec &fileSpec,
00039                         MrSIDMemoryUsage memoryUsage = MRSID_MEMORY_USAGE_DEFAULT,
00040                         MrSIDStreamUsage streamUsage = MRSID_STREAM_USAGE_DEFAULT);
00041 
00049    LT_STATUS initialize(LTIOStreamInf *stream,
00050                         MrSIDMemoryUsage memoryUsage = MRSID_MEMORY_USAGE_DEFAULT,
00051                         MrSIDStreamUsage streamUsage = MRSID_STREAM_USAGE_DEFAULT);
00052 
00053    // LTIImageStageManager overrides
00054    LT_STATUS createImageStage(lt_uint32 imageNumber,
00055                               LTIImageStage *&imageStage);
00056    LT_STATUS createOverviewImageStage(LTIImageStage *&imageStage);
00057 
00058    LT_STATUS createImageStage(lt_uint32 imageNumber,
00059                               MrSIDSingleImageReaderBase *&imageStage);
00060    LT_STATUS createOverviewImageStage(MrSIDSingleImageReaderBase *&imageStage);
00061    
00062    LT_STATUS getMrSIDVersion(lt_uint8& major, lt_uint8& minor,
00063                              lt_uint8& tweak, char& letter) const;
00064 
00065    void setMaxWorkerThreads(int numThreads);
00066    int getMaxWorkerThreads(void) const;
00067 
00068    // for LizardTech internal use only
00069    MrSIDMemoryUsage getMemoryUsage(void) const;
00070    // for LizardTech internal use only
00071    MrSIDStreamUsage getStreamUsage(void) const;
00072 
00073    // for LizardTech internal use only
00074    bool hasMG2Tiles(void) const;
00075    // for LizardTech internal use only
00076    bool hasMG3Tiles(void) const;
00077    // for LizardTech internal use only
00078    bool hasMG4Tiles(void) const;
00079    // for LizardTech internal use only
00080    bool isOptimizable(void) const;
00081    // for LizardTech internal use only
00082    bool hasOverviewImage(void) const;
00083    
00084    // for LizardTech internal use only
00088    enum CompositeImageType
00089    {
00090       COMPOSITETYPE_MG2 = 1,
00091       COMPOSITETYPE_MG3 = 2,
00092       COMPOSITETYPE_MG4 = 3,
00093    };
00094 
00095    // for LizardTech internal use only
00096    struct TileInfo
00097    {
00098       //lt_uint32 imageNumber;
00099       lt_uint32 id;
00100       CompositeImageType type;
00101 
00102       lt_uint8 numLevels;
00103       bool isLocked;
00104       bool isOptimizable;
00105 
00106       lt_uint32 subblockSize;
00107       //LTIGeoCoord geoCoord;
00108    };
00109 
00110    // for LizardTech internal use only
00111    const TileInfo *getTileInfo(lt_uint32 index) const;
00112    // for LizardTech internal use only
00113    const TileInfo *getOverviewInfo() const;
00114    // for LizardTech internal use only
00115    lt_uint32 findTileId(lt_uint32 id) const;
00116 
00117    // for LizardTech internal use only
00118    const MG3Container *getContainer(void) const;
00119 
00120    // for LizardTech internal use only
00121    void treatMG3asMG4(void);
00122 protected:
00123    LT_STATUS init(lt_uint32 numImages,
00124                   MrSIDMemoryUsage memoryUsage,
00125                   MrSIDStreamUsage streamUsage);
00126 
00127    virtual LT_STATUS updateMemoryModel();
00128    virtual LT_STATUS createMG2Reader(lt_uint32 imageNumber,
00129                                      MG2ImageReader *&mg2Reader);
00130    virtual LT_STATUS createMG3Reader(lt_uint32 imageNumber,
00131                                      MG3SingleImageReader *&mg3Reader);
00132    virtual LT_STATUS createMG4Reader(lt_uint32 imageNumber,
00133                                      MG4SingleImageReader *&mg4Reader);
00134 
00135    LTIOStreamInf *m_stream;
00136    bool m_ownStream;
00137 
00138    MrSIDMemoryUsage m_memoryUsage;
00139    MrSIDStreamUsage m_streamUsage;
00140    lt_uint8 m_major;
00141    lt_uint8 m_minor;
00142    lt_uint8 m_tweak;
00143    char m_letter;
00144    MG3Container *m_container;
00145    TileInfo *m_tileInfo;
00146    TileInfo *m_overviewInfo;
00147    bool m_hasMG2Tiles;
00148    bool m_hasMG3Tiles;
00149    bool m_hasMG4Tiles;
00150    int m_numThreads;
00151 };
00152 
00153 
00154 LT_END_NAMESPACE(LizardTech)
00155 
00156 
00157 #endif // __MRSID_IMAGE_STAGE_MANAGER_H__