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