MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
lti_multiresFilter.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 LTI_MULTIRESFILTER_H
00014 #define LTI_MULTIRESFILTER_H
00015 
00016 // lt_lib_mrsid_core
00017 #include "lti_imageFilter.h"
00018 #include "lti_imageStageOverrides.h"
00019 #include "lti_scene.h"
00020 
00021 LT_BEGIN_NAMESPACE(LizardTech)
00022 
00023 class LTIResampler;
00024 
00036 #ifdef SWIG
00037 class LTIMultiResFilter : public LTIImageFilter
00038 #else
00039 class LTIMultiResFilter : public LTIOverrideDimensions
00040                                  <LTIOverrideGeoCoord
00041                                  <LTIOverrideMagnification
00042                                  <LTIOverrideStripHeight
00043                                  <LTIImageFilter> > > >
00044 #endif
00045 {
00046    LTI_REFERENCE_COUNTED_BOILERPLATE(LTIMultiResFilter);
00047 public:
00060    LT_STATUS initialize(LTIImageStage* srcImage);
00061 
00077    LT_STATUS initialize(LTIImageStage* srcImage,
00078                         lt_int8 scaleFactor);
00079 
00080    LT_STATUS initialize(LTIImageStage* srcImage,
00081                         double deltaMag,
00082                         double minMag,
00083                         double maxMag);
00084 
00085    // LTIImage
00086    LT_STATUS getDimsAtMag(double mag,
00087                           lt_uint32 &width,
00088                           lt_uint32 &height) const;
00089 
00090    // LTIImageStage
00091    lt_int64 getEncodingCost(const LTIScene& scene) const;
00092    bool getReaderScene(const LTIScene &decodeScene,
00093                        LTIScene &readerScene) const;
00094    virtual lt_uint32 getModifications(const LTIScene &scene) const;
00095    bool getPipelineInfo(LTIPipelineInfo info) const;
00096 
00101    LT_STATUS setResampleMethod(LTIResampleMethod resampleMethod);
00102 
00103    void setMagSnapThreshold(double threshold);
00104 
00105    // for LizardTech internal use only
00106    // call this before initialize() if you want non-sq. pixels
00107    // (the deltaMag in the constructor is ignored)
00108    void setDeltaMagXY(double deltaMagX, double deltaMagY);
00109 
00110    // for LizardTech internal use only
00111    static double magForIcon(const LTIImage &image,
00112                             lt_uint32 iconSize);
00113    static double magForIcon(lt_uint32 width, lt_uint32 height,
00114                             lt_uint32 iconSize);
00115 
00116 protected:
00117    LT_STATUS decodeBegin(const LTIPixel &pixelProps,
00118                          const LTIScene &fullScene);
00119    LT_STATUS decodeStrip(LTISceneBuffer &stripBuffer,
00120                          const LTIScene &stripScene);
00121    LT_STATUS decodeEnd(void);
00122 
00123 protected:
00124    enum Mode
00125    {
00126       MODE_INVALID,
00127       MODE_RESAMPLE,
00128       MODE_PASSTHROUGH,
00129       MODE_DOWNSAMPLE_FULLREAD,
00130       MODE_ALL_AT_ONCE
00131    };
00132 
00133    bool getChildScene(const LTIScene &scene,
00134                       Mode &mode,
00135                       double &xScale,
00136                       double &yScale,
00137                       LTIScene &childScene) const;
00138 
00139    enum
00140    {
00141       // The largest possible mag is based on the 2gb
00142       // scene limitation. Thus the largest scene we
00143       // should ever expect is approximately the square
00144       // root of (2gb / 3) pixels on a  side. If we
00145       // assume the smallest image we'll ever encounter
00146       // is 32x32 then the largest magnification can
00147       // be calculated. It's big, but we need a real number!
00148       kMaxMagnification = 512   // 51200% zoom!
00149    };
00150 
00151 private:
00152    struct StripCache;
00153 
00154    double m_deltaMagX;
00155    double m_deltaMagY;
00156    
00157    double m_magSnapThreshold;
00158 
00159    Mode m_mode;
00160    double m_xScale;
00161    double m_yScale;
00162    LTIScene m_childScene;
00163    double m_dx;
00164    double m_dy;
00165    double m_curY;
00166 
00167    lt_int32 m_childStrip;
00168    lt_int32 m_myStrip;
00169 
00170    lt_uint32 m_cacheStripHeight;
00171    StripCache *m_stripCache0;
00172    StripCache *m_stripCache1;
00173 
00174    LTIResampler *m_resampler;
00175 };
00176 
00177 
00178 LT_END_NAMESPACE(LizardTech)
00179 
00180 #endif // LTI_MULTIRESFILTER_H