MrSID Decode SDK for Raster Reference Manual  9.5.1.4427
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    static LT_STATUS push(LTIImageStage *&pipeline, const LTIScene &dstScene);
00117    static LT_STATUS push(LTIImageStage *&pipeline, double mag);
00118 
00119 protected:
00120    LT_STATUS decodeBegin(const LTIPixel &pixelProps,
00121                          const LTIScene &fullScene);
00122    LT_STATUS decodeStrip(LTISceneBuffer &stripBuffer,
00123                          const LTIScene &stripScene);
00124    LT_STATUS decodeEnd(void);
00125 
00126 protected:
00127    enum Mode
00128    {
00129       MODE_INVALID,
00130       MODE_RESAMPLE,
00131       MODE_PASSTHROUGH,
00132       MODE_DOWNSAMPLE_FULLREAD,
00133       MODE_ALL_AT_ONCE
00134    };
00135 
00136    bool getChildScene(const LTIScene &scene,
00137                       Mode &mode,
00138                       double &xScale,
00139                       double &yScale,
00140                       LTIScene &childScene) const;
00141 
00142    enum
00143    {
00144       // The largest possible mag is based on the 2gb
00145       // scene limitation. Thus the largest scene we
00146       // should ever expect is approximately the square
00147       // root of (2gb / 3) pixels on a  side. If we
00148       // assume the smallest image we'll ever encounter
00149       // is 32x32 then the largest magnification can
00150       // be calculated. It's big, but we need a real number!
00151       kMaxMagnification = 512   // 51200% zoom!
00152    };
00153 
00154 private:
00155    struct StripCache;
00156 
00157    double m_deltaMagX;
00158    double m_deltaMagY;
00159    
00160    double m_magSnapThreshold;
00161 
00162    Mode m_mode;
00163    double m_xScale;
00164    double m_yScale;
00165    LTIScene m_childScene;
00166    double m_dx;
00167    double m_dy;
00168    double m_curY;
00169 
00170    lt_int32 m_childStrip;
00171    lt_int32 m_myStrip;
00172 
00173    lt_uint32 m_cacheStripHeight;
00174    StripCache *m_stripCache0;
00175    StripCache *m_stripCache1;
00176 
00177    LTIResampler *m_resampler;
00178 };
00179 
00180 
00181 LT_END_NAMESPACE(LizardTech)
00182 
00183 #endif // LTI_MULTIRESFILTER_H