icub-basic-demos
FastGauss.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 // Copyright: (C) 2006-2007 Alex Bernardino, ISR-IST
4 // Authors: Alex Bernardino
5 // CopyPolicy: Released under the terms of the GNU GPL v2.0.
6 
18 #ifndef _FASTGAUSS_H_
19 #define _FASTGAUSS_H_
20 
21 #include <complex>
22 using namespace std;
23 
24 
25 class FastGauss
26 {
27 private:
28 
29  bool m_bAllocated;
30  float * temp;
31 
32 protected:
33  long m_i_lines; //image height (pixels)
34  long m_i_cols; //image width (pixels)
35  long m_i_stridepix; //number of pixels in a line (for data aligment)
36  int stride; //number of bytes in a line (for data alignment) : stride = m_i_stridepix*sizeof(float)
37  double m_scale; //scale value (in pixels)
38  float *filt_coeffs; //filter coefficients (max 6 coeffs : 1 gain + 5 autoregressive coefs)
39  complex<double> *filt_poles; //filter poles (max 5 poles)
40  float *m_resid_step; //step forced response residuals for a 3 tap gauss filter.
41  float *m_resid_ic; //step natural response residuals for a 3 tap gauss filter.
42 
43 public:
44  FastGauss(void);
45  virtual ~FastGauss(void);
46  long GetLines();
47  long GetCols();
48  long GetStridePix();
49  double GetScale();
50  bool GaussFilt(float * in, float * out);
51  bool AllocateResources(long lines, long cols, double scale);
52  bool FreeResources();
53  bool IsAllocated();
54 
55  void compute_step_forward_ic(float bord_val, float *coeffs, float *i0);
56  void compute_natural_backward_ic( float *resid_ic, float *i0 );
57  void add_step_backward_ic( float *resid_step, float val, float *i0 );
58  void _iir_gaussfilt3_horz(float * in, float *tempbuf, float * out, int width, int height, int stridepix, float *coeffs, float *resid_ic, float *resid_step);
59  void _iir_gaussfilt3_vert(float * inout, float *tempbuf, int width, int height, int stridepix, float *coeffs, float *resid_ic, float *resid_step);
60  void _iir_gaussfilt3(float * in, float * out, float *tempbuf, int width, int height, int stridepix, float *coeffs, float *resid_ic, float *resid_step );
61  void _compute_gauss3_resids( complex<double> poles[], float *coeffs, float *resid_ic, float *resid_step );
62 };
63 
64 #endif /*_FASTGAUSS_H_*/