[med-svn] [SCM] aghermann branch, master, updated. 83bfc7bafe1055d29be61afe3e8ec4482539aa1d

Andrei Zavada johnhommer at gmail.com
Thu Nov 22 23:45:48 UTC 2012


The following commit has been merged in the master branch:
commit 28d0a7150071e9f0e047c6eac1e83639ca72756f
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sat Nov 17 23:25:57 2012 +0200

    make some scalars double not TFloat in ext-filters

diff --git a/src/sigproc/ext-filters.cc b/src/sigproc/ext-filters.cc
index 78e4d37..63ace71 100644
--- a/src/sigproc/ext-filters.cc
+++ b/src/sigproc/ext-filters.cc
@@ -37,7 +37,7 @@ reset()
 
 void
 sigproc::CFilterIIR::
-reset( TFloat xn)
+reset( double xn)
 {
 	calculate_iir_coefficients();
 
@@ -55,13 +55,13 @@ calculate_iir_coefficients()
 {
 	CFilterIIR::calculate_iir_coefficients();
 
-	TFloat	ts = 1. / samplerate,
+	double	ts = 1. / samplerate,
 		fprewarp = tan( M_PI * minus_3db_frequency * ts) / (M_PI * ts),
 		r = 1. / (2. * M_PI * fprewarp),
 		s = ts / 2.;
-	zeros = {(TFloat)(gain * (s + r)),
-		 (TFloat)(gain * (s - r)),
-		 (TFloat)1.};
+	zeros = {(gain * (s + r)),
+		 (gain * (s - r)),
+		 1.};
 }
 
 void
@@ -70,7 +70,7 @@ calculate_iir_coefficients()
 {
 	CFilterIIR::calculate_iir_coefficients();
 
-	TFloat	ts = 1.0 / samplerate,
+	double	ts = 1.0 / samplerate,
 		fprewarp, r, s, t;
 
 	fprewarp = tan(f0 * M_PI * ts) / (M_PI * ts);
@@ -79,16 +79,16 @@ calculate_iir_coefficients()
 	// r:=sqr(2.0*pi*f0*Ts);                         No prewarping
 	s = 2. * M_PI * bandwidth * ts * 2.;
 	t = 4. + r + s;
-	poles = {(TFloat)1.,
-		 (TFloat)((8.0 - 2.0 * r) / t),
-		 (TFloat)((-4.0 + s - r) / t)};
+	poles = {1.,
+		 ((8.0 - 2.0 * r) / t),
+		 ((-4.0 + s - r) / t)};
 
 	fprewarp = tan(fc * M_PI * ts) / (M_PI * ts);
 	r = 2.0 / (2. * M_PI * fprewarp);
 	s = gain * 2. * M_PI * bandwidth * 2.;
-	zeros = {(TFloat)(s * (r + ts)   / t),
-		 (TFloat)(s * (-2.0 * r) / t),
-		 (TFloat)(s * (r - ts)   / t)};
+	zeros = {(s * (r + ts)   / t),
+		 (s * (-2.0 * r) / t),
+		 (s * (r - ts)   / t)};
 }
 
 
@@ -128,7 +128,7 @@ apply( const valarray<TFloat>& in, bool use_first_sample_to_reset)
 			use_first_sample_to_reset = false;
 		}
 		// Compute new output sample
-		TFloat r = 0.;
+		double r = 0.;
 		// Add past output-values
 		size_t j;
 		for ( j = 1; j < poles.size(); ++j )
diff --git a/src/sigproc/ext-filters.hh b/src/sigproc/ext-filters.hh
index f17b80f..f6bda85 100644
--- a/src/sigproc/ext-filters.hh
+++ b/src/sigproc/ext-filters.hh
@@ -55,7 +55,7 @@ class CFilterIIR : public CFilter_base {
     protected:
 	CFilterIIR( size_t samplerate_,
 		    TFilterDirection direction_,
-		    TFloat gain_, TFloat back_polate_)
+		    double gain_, double back_polate_)
 	      : CFilter_base (samplerate_, direction_),
 		anticipate (true),
 		gain (gain_),
@@ -64,15 +64,15 @@ class CFilterIIR : public CFilter_base {
 			calculate_iir_coefficients();
 		}
 	virtual void reset();
-	virtual void reset( TFloat use_this);
+	virtual void reset( double use_this);
 
 	bool anticipate;
-	valarray<TFloat>
+	valarray<double>
 		filter_state_p,
 		filter_state_z,
 		poles,
 		zeros;
-	TFloat	gain,
+	double	gain,
 		back_polate;
 
     public:
@@ -87,8 +87,8 @@ class CFilterSE : public CFilterIIR {
     public:
 	void calculate_iir_coefficients();
 	CFilterSE( size_t samplerate_, TFilterDirection direction_,
-		   TFloat gain_, TFloat back_polate_,
-		   TFloat f0_, TFloat fc_, TFloat bandwidth_)
+		   double gain_, double back_polate_,
+		   double f0_, double fc_, double bandwidth_)
 	      : CFilterIIR (samplerate_, direction_, gain_, back_polate_),
 		f0 (f0_),
 		fc (fc_),
@@ -99,7 +99,7 @@ class CFilterSE : public CFilterIIR {
 			calculate_iir_coefficients();
 		}
     private:
-	TFloat	f0,
+	double	f0,
 		fc,
 		bandwidth;
 };
@@ -118,7 +118,7 @@ class CFilterDUE : public CFilterIIR {
 			calculate_iir_coefficients();
 		}
     private:
-	TFloat	minus_3db_frequency;
+	double	minus_3db_frequency;
 };
 
 } // namespace sigproc

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list