[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/16: filter: fixes stability issue with I
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/16: filter: fixes stability issue with IIR filters. |
Date: |
Sun, 29 Mar 2015 02:27:25 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 81766fba0159fefdbc6526dea5b29d2f337e7dc8
Author: Brian Padalino <address@hidden>
Date: Sun Mar 22 08:51:04 2015 -0400
filter: fixes stability issue with IIR filters.
Addresses issue #773. IIR filters of some type combinations do not
appopriately handle the accumulator precision that can lead to
unstable results. This adds an accumulator data type template to
specify the precision that is needed internally here. The accumulator
should be of the highest precision data type used in the filter.
---
gr-filter/include/gnuradio/filter/iir_filter.h | 20 ++++++++++----------
gr-filter/lib/iir_filter.cc | 6 +++---
gr-filter/lib/iir_filter_ccc_impl.cc | 2 +-
gr-filter/lib/iir_filter_ccc_impl.h | 2 +-
gr-filter/lib/iir_filter_ccd_impl.cc | 2 +-
gr-filter/lib/iir_filter_ccd_impl.h | 2 +-
gr-filter/lib/iir_filter_ccf_impl.cc | 2 +-
gr-filter/lib/iir_filter_ccf_impl.h | 2 +-
gr-filter/lib/iir_filter_ccz_impl.cc | 2 +-
gr-filter/lib/iir_filter_ccz_impl.h | 2 +-
gr-filter/lib/iir_filter_ffd_impl.cc | 2 +-
gr-filter/lib/iir_filter_ffd_impl.h | 2 +-
12 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/gr-filter/include/gnuradio/filter/iir_filter.h
b/gr-filter/include/gnuradio/filter/iir_filter.h
index bf87ce1..5b1e5ee 100644
--- a/gr-filter/include/gnuradio/filter/iir_filter.h
+++ b/gr-filter/include/gnuradio/filter/iir_filter.h
@@ -35,7 +35,7 @@ namespace gr {
/*!
* \brief base class template for Infinite Impulse Response filter (IIR)
*/
- template<class i_type, class o_type, class tap_type>
+ template<class i_type, class o_type, class tap_type, class acc_type>
class iir_filter
{
public:
@@ -135,18 +135,18 @@ namespace gr {
std::vector<tap_type> d_fbtaps;
int d_latest_n;
int d_latest_m;
- std::vector<o_type> d_prev_output;
+ std::vector<acc_type> d_prev_output;
std::vector<i_type> d_prev_input;
};
//
// general case. We may want to specialize this
//
- template<class i_type, class o_type, class tap_type>
+ template<class i_type, class o_type, class tap_type, class acc_type>
o_type
- iir_filter<i_type, o_type, tap_type>::filter(const i_type input)
+ iir_filter<i_type, o_type, tap_type, acc_type>::filter(const i_type
input)
{
- o_type acc;
+ acc_type acc;
unsigned i = 0;
unsigned n = ntaps_ff();
unsigned m = ntaps_fb();
@@ -181,9 +181,9 @@ namespace gr {
return (o_type)acc;
}
- template<class i_type, class o_type, class tap_type>
+ template<class i_type, class o_type, class tap_type, class acc_type>
void
- iir_filter<i_type, o_type, tap_type>::filter_n(o_type output[],
+ iir_filter<i_type, o_type, tap_type, acc_type>::filter_n(o_type output[],
const i_type input[],
long n)
{
@@ -193,15 +193,15 @@ namespace gr {
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, float>::filter(const gr_complex
input);
+ iir_filter<gr_complex, gr_complex, float, gr_complex>::filter(const
gr_complex input);
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, double>::filter(const gr_complex
input);
+ iir_filter<gr_complex, gr_complex, double, gr_complexd>::filter(const
gr_complex input);
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, gr_complexd>::filter(const gr_complex
input);
+ iir_filter<gr_complex, gr_complex, gr_complexd,
gr_complexd>::filter(const gr_complex input);
} /* namespace kernel */
} /* namespace filter */
diff --git a/gr-filter/lib/iir_filter.cc b/gr-filter/lib/iir_filter.cc
index 0f5ba00..5219282 100644
--- a/gr-filter/lib/iir_filter.cc
+++ b/gr-filter/lib/iir_filter.cc
@@ -28,7 +28,7 @@ namespace gr {
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, float>::filter(const gr_complex input)
+ iir_filter<gr_complex, gr_complex, float, gr_complex>::filter(const
gr_complex input)
{
gr_complex acc;
unsigned i = 0;
@@ -67,7 +67,7 @@ namespace gr {
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, double>::filter(const gr_complex
input)
+ iir_filter<gr_complex, gr_complex, double, gr_complexd>::filter(const
gr_complex input)
{
gr_complexd acc;
unsigned i = 0;
@@ -106,7 +106,7 @@ namespace gr {
template<>
gr_complex
- iir_filter<gr_complex, gr_complex, gr_complexd>::filter(const gr_complex
input)
+ iir_filter<gr_complex, gr_complex, gr_complexd,
gr_complexd>::filter(const gr_complex input)
{
gr_complexd acc;
unsigned i = 0;
diff --git a/gr-filter/lib/iir_filter_ccc_impl.cc
b/gr-filter/lib/iir_filter_ccc_impl.cc
index e813cd9..7e8293c 100644
--- a/gr-filter/lib/iir_filter_ccc_impl.cc
+++ b/gr-filter/lib/iir_filter_ccc_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
io_signature::make(1, 1, sizeof(gr_complex))),
d_updated(false)
{
- d_iir = new kernel::iir_filter<gr_complex, gr_complex,
gr_complex>(fftaps, fbtaps, oldstyle);
+ d_iir = new kernel::iir_filter<gr_complex, gr_complex, gr_complex,
gr_complex>(fftaps, fbtaps, oldstyle);
}
iir_filter_ccc_impl::~iir_filter_ccc_impl()
diff --git a/gr-filter/lib/iir_filter_ccc_impl.h
b/gr-filter/lib/iir_filter_ccc_impl.h
index 5b849f9..77e08fd 100644
--- a/gr-filter/lib/iir_filter_ccc_impl.h
+++ b/gr-filter/lib/iir_filter_ccc_impl.h
@@ -33,7 +33,7 @@ namespace gr {
{
private:
bool d_updated;
- kernel::iir_filter<gr_complex, gr_complex, gr_complex> *d_iir;
+ kernel::iir_filter<gr_complex, gr_complex, gr_complex, gr_complex>
*d_iir;
std::vector<gr_complex> d_new_fftaps;
std::vector<gr_complex> d_new_fbtaps;
diff --git a/gr-filter/lib/iir_filter_ccd_impl.cc
b/gr-filter/lib/iir_filter_ccd_impl.cc
index ebe53e9..a090df0 100644
--- a/gr-filter/lib/iir_filter_ccd_impl.cc
+++ b/gr-filter/lib/iir_filter_ccd_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
io_signature::make(1, 1, sizeof(gr_complex))),
d_updated(false)
{
- d_iir = new kernel::iir_filter<gr_complex, gr_complex, double>(fftaps,
fbtaps, oldstyle);
+ d_iir = new kernel::iir_filter<gr_complex, gr_complex, double,
gr_complexd>(fftaps, fbtaps, oldstyle);
}
iir_filter_ccd_impl::~iir_filter_ccd_impl()
diff --git a/gr-filter/lib/iir_filter_ccd_impl.h
b/gr-filter/lib/iir_filter_ccd_impl.h
index 2ae2504..6a15d1a 100644
--- a/gr-filter/lib/iir_filter_ccd_impl.h
+++ b/gr-filter/lib/iir_filter_ccd_impl.h
@@ -33,7 +33,7 @@ namespace gr {
{
private:
bool d_updated;
- kernel::iir_filter<gr_complex, gr_complex, double> *d_iir;
+ kernel::iir_filter<gr_complex, gr_complex, double, gr_complexd> *d_iir;
std::vector<double> d_new_fftaps;
std::vector<double> d_new_fbtaps;
diff --git a/gr-filter/lib/iir_filter_ccf_impl.cc
b/gr-filter/lib/iir_filter_ccf_impl.cc
index bb19e45..9b15c29 100644
--- a/gr-filter/lib/iir_filter_ccf_impl.cc
+++ b/gr-filter/lib/iir_filter_ccf_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
io_signature::make(1, 1, sizeof(gr_complex))),
d_updated(false)
{
- d_iir = new kernel::iir_filter<gr_complex, gr_complex, float>(fftaps,
fbtaps, oldstyle);
+ d_iir = new kernel::iir_filter<gr_complex, gr_complex, float,
gr_complex>(fftaps, fbtaps, oldstyle);
}
iir_filter_ccf_impl::~iir_filter_ccf_impl()
diff --git a/gr-filter/lib/iir_filter_ccf_impl.h
b/gr-filter/lib/iir_filter_ccf_impl.h
index 420e35a..67265e7 100644
--- a/gr-filter/lib/iir_filter_ccf_impl.h
+++ b/gr-filter/lib/iir_filter_ccf_impl.h
@@ -33,7 +33,7 @@ namespace gr {
{
private:
bool d_updated;
- kernel::iir_filter<gr_complex, gr_complex, float> *d_iir;
+ kernel::iir_filter<gr_complex, gr_complex, float, gr_complex> *d_iir;
std::vector<float> d_new_fftaps;
std::vector<float> d_new_fbtaps;
diff --git a/gr-filter/lib/iir_filter_ccz_impl.cc
b/gr-filter/lib/iir_filter_ccz_impl.cc
index cb7b230..4227a30 100644
--- a/gr-filter/lib/iir_filter_ccz_impl.cc
+++ b/gr-filter/lib/iir_filter_ccz_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
io_signature::make(1, 1, sizeof(gr_complex))),
d_updated(false)
{
- d_iir = new kernel::iir_filter<gr_complex, gr_complex,
gr_complexd>(fftaps, fbtaps, oldstyle);
+ d_iir = new kernel::iir_filter<gr_complex, gr_complex, gr_complexd,
gr_complexd>(fftaps, fbtaps, oldstyle);
}
iir_filter_ccz_impl::~iir_filter_ccz_impl()
diff --git a/gr-filter/lib/iir_filter_ccz_impl.h
b/gr-filter/lib/iir_filter_ccz_impl.h
index 1e2a984..59bd53f 100644
--- a/gr-filter/lib/iir_filter_ccz_impl.h
+++ b/gr-filter/lib/iir_filter_ccz_impl.h
@@ -33,7 +33,7 @@ namespace gr {
{
private:
bool d_updated;
- kernel::iir_filter<gr_complex, gr_complex, gr_complexd> *d_iir;
+ kernel::iir_filter<gr_complex, gr_complex, gr_complexd, gr_complexd>
*d_iir;
std::vector<gr_complexd> d_new_fftaps;
std::vector<gr_complexd> d_new_fbtaps;
diff --git a/gr-filter/lib/iir_filter_ffd_impl.cc
b/gr-filter/lib/iir_filter_ffd_impl.cc
index 5aee517..f70e3a2 100644
--- a/gr-filter/lib/iir_filter_ffd_impl.cc
+++ b/gr-filter/lib/iir_filter_ffd_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
io_signature::make(1, 1, sizeof (float))),
d_updated(false)
{
- d_iir = new kernel::iir_filter<float,float,double>(fftaps, fbtaps,
oldstyle);
+ d_iir = new kernel::iir_filter<float,float,double,double>(fftaps,
fbtaps, oldstyle);
}
iir_filter_ffd_impl::~iir_filter_ffd_impl()
diff --git a/gr-filter/lib/iir_filter_ffd_impl.h
b/gr-filter/lib/iir_filter_ffd_impl.h
index 5cad8ec..a74ac7a 100644
--- a/gr-filter/lib/iir_filter_ffd_impl.h
+++ b/gr-filter/lib/iir_filter_ffd_impl.h
@@ -33,7 +33,7 @@ namespace gr {
{
private:
bool d_updated;
- kernel::iir_filter<float,float,double> *d_iir;
+ kernel::iir_filter<float,float,double,double> *d_iir;
std::vector<double> d_new_fftaps;
std::vector<double> d_new_fbtaps;
- [Commit-gnuradio] [gnuradio] 06/16: filter: exporting IIR filter kernels from library., (continued)
- [Commit-gnuradio] [gnuradio] 06/16: filter: exporting IIR filter kernels from library., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'drmpeg/dvb-s2', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 01/16: analog: Made CTCSS squelch find_tone() a static member function, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 13/16: Merge remote-tracking branch 'tom/iir_filter_stability', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 11/16: gr-dtv: Fix ATSC compile issue as reported on mailing list., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'jynik/ctcss_squelch_add_freq_getset', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'drmpeg/atsc-fix', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 05/16: docs: adding better docs for using IIR kernels., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 09/16: gr-dtv: Add DVB-S2 transmitter update., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 02/16: analog: Moved CTCSS squelch FFT parameter calculations, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 04/16: filter: fixes stability issue with IIR filters.,
git <=
- [Commit-gnuradio] [gnuradio] 07/16: gr-dtv: Add DVB-S2 transmitter., git, 2015/03/28