ConvolutionKernel.h

Go to the documentation of this file.
00001 #if !defined CONVOLUTION_KERNEL_
00002 #define CONVOLUTION_KERNEL_
00003 //-----------------------------------------------------------------------------
00081 //-----------------------------------------------------------------------------
00082 
00083 namespace mudbox {
00084 
00085 class ConvolutionKernel {
00086     private:
00087         float      *m_Kernel;        // floating point version.
00088         short      *m_fixedKernel;   // fixed point version S4.11
00089         int         m_Size;          // always square
00090 
00091         bool        m_Generated;     // true if the kernel is generated
00092                                      // by the following parameters.
00093         float       m_Sharpness;
00094         float       m_Radius;
00095         float       m_Sigma;
00096 
00097         void        Generate(void);  // generate the FP kernel from the 3 parms
00098         void        makeFixed(void); // generate the fixed point kernel from the FP one
00099 
00100     public:
00102         ConvolutionKernel(const ConvolutionKernel &k);
00103 
00106         ConvolutionKernel(float *kernel, int size);
00107 
00109         ConvolutionKernel(float sharpness = 0.5f,
00110                           float radius    = 1.5f,
00111                           float sigma     = (1.0f/3.0f));
00112 
00114         ~ConvolutionKernel();
00115 
00116         void  setSharpness(float val);
00117         void  setRadius(float val);
00118         void  setSigma(float val);
00119 
00121         void  setKernel(float *f, int Size);
00122 
00123         float getSharpness()     const { return m_Sharpness; }
00124         float getRadius()        const { return m_Radius;    }
00125         float getSigma()         const { return m_Sigma;     }
00126 
00128         bool  isGenerated(void)  const { return m_Generated; }
00129 
00131         int   getSize (void)     const { return m_Size; }
00132 
00134         void         getKernel(float *targetBuffer) const;
00135 
00137         const float *getKernel(void) const      { return m_Kernel; }
00138 
00145         const short *getFixedKernel(void) const { return m_fixedKernel; }
00146 
00148         void         logPrintKernel(void) const;
00149 };
00150 
00151 //-----------------------------------------------------------------------------
00152 
00153 //-
00154 // ==================================================================
00155 // (C) Copyright 2009 by Autodesk, Inc. All Rights Reserved. By using
00156 // this code,  you  are  agreeing  to the terms and conditions of the
00157 // License  Agreement  included  in  the documentation for this code.
00158 // AUTODESK  MAKES  NO  WARRANTIES,  EXPRESS  OR  IMPLIED,  AS TO THE
00159 // CORRECTNESS OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE
00160 // IT.  AUTODESK PROVIDES THE CODE ON AN 'AS-IS' BASIS AND EXPLICITLY
00161 // DISCLAIMS  ANY  LIABILITY,  INCLUDING CONSEQUENTIAL AND INCIDENTAL
00162 // DAMAGES  FOR ERRORS, OMISSIONS, AND  OTHER  PROBLEMS IN THE  CODE.
00163 //
00164 // Use, duplication,  or disclosure by the U.S. Government is subject
00165 // to  restrictions  set forth  in FAR 52.227-19 (Commercial Computer
00166 // Software Restricted Rights) as well as DFAR 252.227-7013(c)(1)(ii)
00167 // (Rights  in Technical Data and Computer Software),  as applicable.
00168 // ==================================================================
00169 //+
00170 #endif
00171 
00172 }; // end of namespace mudbox
00173