Mudbox/ConvolutionKernel.h Source File

ConvolutionKernel.h
Go to the documentation of this file.
1 #if !defined CONVOLUTION_KERNEL_
2 #define CONVOLUTION_KERNEL_
3 //-----------------------------------------------------------------------------
81 //-----------------------------------------------------------------------------
82 
83 namespace mudbox {
84 
86  private:
87  float *m_Kernel; // floating point version.
88  short *m_fixedKernel; // fixed point version S4.11
89  int m_Size; // always square
90 
91  bool m_Generated; // true if the kernel is generated
92  // by the following parameters.
93  float m_Sharpness;
94  float m_Radius;
95  float m_Sigma;
96 
97  void Generate(void); // generate the FP kernel from the 3 parms
98  void makeFixed(void); // generate the fixed point kernel from the FP one
99 
100  public:
103 
106  ConvolutionKernel(float *kernel, int size);
107 
109  ConvolutionKernel(float sharpness = 0.5f,
110  float radius = 1.5f,
111  float sigma = (1.0f/3.0f));
112 
115 
116  void setSharpness(float val);
117  void setRadius(float val);
118  void setSigma(float val);
119 
121  void setKernel(float *f, int Size);
122 
123  float getSharpness() const { return m_Sharpness; }
124  float getRadius() const { return m_Radius; }
125  float getSigma() const { return m_Sigma; }
126 
128  bool isGenerated(void) const { return m_Generated; }
129 
131  int getSize (void) const { return m_Size; }
132 
134  void getKernel(float *targetBuffer) const;
135 
137  const float *getKernel(void) const { return m_Kernel; }
138 
145  const short *getFixedKernel(void) const { return m_fixedKernel; }
146 
148  void logPrintKernel(void) const;
149 };
150 
151 //-----------------------------------------------------------------------------
152 
153 //-
154 // ==================================================================
155 // (C) Copyright 2009 by Autodesk, Inc. All Rights Reserved. By using
156 // this code, you are agreeing to the terms and conditions of the
157 // License Agreement included in the documentation for this code.
158 // AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE
159 // CORRECTNESS OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE
160 // IT. AUTODESK PROVIDES THE CODE ON AN 'AS-IS' BASIS AND EXPLICITLY
161 // DISCLAIMS ANY LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL
162 // DAMAGES FOR ERRORS, OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
163 //
164 // Use, duplication, or disclosure by the U.S. Government is subject
165 // to restrictions set forth in FAR 52.227-19 (Commercial Computer
166 // Software Restricted Rights) as well as DFAR 252.227-7013(c)(1)(ii)
167 // (Rights in Technical Data and Computer Software), as applicable.
168 // ==================================================================
169 //+
170 #endif
171 
172 }; // end of namespace mudbox
void setSigma(float val)
void setKernel(float *f, int Size)
Copies the supplied kernel into this class.
bool isGenerated(void) const
void logPrintKernel(void) const
Prints the convolution kernel to the log. (for debugging purposes)
const short * getFixedKernel(void) const
void setRadius(float val)
const float * getKernel(void) const
~ConvolutionKernel()
destructor. Releases memory
void setSharpness(float val)
Class: ConvolutionKernel.
Definition: array.h:15
ConvolutionKernel(const ConvolutionKernel &k)
copy constructor
GLclampf f
Definition: GLee.h:9303
GLsizeiptr size
Definition: GLee.h:1561