[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/01: filter: fixing having the delay of t
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/01: filter: fixing having the delay of the resampler as a negative number, which I think I backed into from making the other computations work. |
Date: |
Tue, 13 Jan 2015 01:04:25 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit 65dbd67db55fd0b6456a9de025cfead699af527e
Author: Tom Rondeau <address@hidden>
Date: Mon Jan 12 12:34:58 2015 -0500
filter: fixing having the delay of the resampler as a negative number,
which I think I backed into from making the other computations work.
---
gr-filter/lib/pfb_arb_resampler.cc | 18 +++++++++---------
gr-filter/python/filter/qa_pfb_arb_resampler.py | 10 +++++-----
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gr-filter/lib/pfb_arb_resampler.cc
b/gr-filter/lib/pfb_arb_resampler.cc
index 0ebc788..5c87447 100644
--- a/gr-filter/lib/pfb_arb_resampler.cc
+++ b/gr-filter/lib/pfb_arb_resampler.cc
@@ -69,7 +69,7 @@ namespace gr {
// Delay is based on number of taps per filter arm. Round to
// the nearest integer.
- float delay = -rate * (taps_per_filter() - 1.0) / 2.0;
+ float delay = rate * (taps_per_filter() - 1.0) / 2.0;
d_delay = static_cast<int>(boost::math::iround(delay));
// This calculation finds the phase offset induced by the
@@ -77,11 +77,11 @@ namespace gr {
// at the filter's group delay plus the fractional offset
// between the samples. Calculated here based on the rotation
// around nfilts starting at start_filter.
- float accum = -d_delay * d_flt_rate;
+ float accum = d_delay * d_flt_rate;
int accum_int = static_cast<int>(accum);
float accum_frac = accum - accum_int;
int end_filter = static_cast<int>
- (boost::math::iround(fmodf(d_last_filter - d_delay * d_dec_rate +
accum_int, \
+ (boost::math::iround(fmodf(d_last_filter + d_delay * d_dec_rate +
accum_int, \
static_cast<float>(d_int_rate))));
d_est_phase_change = d_last_filter - (end_filter + accum_frac);
@@ -280,7 +280,7 @@ namespace gr {
// Delay is based on number of taps per filter arm. Round to
// the nearest integer.
- float delay = -rate * (taps_per_filter() - 1.0) / 2.0;
+ float delay = rate * (taps_per_filter() - 1.0) / 2.0;
d_delay = static_cast<int>(boost::math::iround(delay));
// This calculation finds the phase offset induced by the
@@ -288,11 +288,11 @@ namespace gr {
// at the filter's group delay plus the fractional offset
// between the samples. Calculated here based on the rotation
// around nfilts starting at start_filter.
- float accum = -d_delay * d_flt_rate;
+ float accum = d_delay * d_flt_rate;
int accum_int = static_cast<int>(accum);
float accum_frac = accum - accum_int;
int end_filter = static_cast<int>
- (boost::math::iround(fmodf(d_last_filter - d_delay * d_dec_rate +
accum_int, \
+ (boost::math::iround(fmodf(d_last_filter + d_delay * d_dec_rate +
accum_int, \
static_cast<float>(d_int_rate))));
d_est_phase_change = d_last_filter - (end_filter + accum_frac);
@@ -491,7 +491,7 @@ namespace gr {
// Delay is based on number of taps per filter arm. Round to
// the nearest integer.
- float delay = -rate * (taps_per_filter() - 1.0) / 2.0;
+ float delay = rate * (taps_per_filter() - 1.0) / 2.0;
d_delay = static_cast<int>(boost::math::iround(delay));
// This calculation finds the phase offset induced by the
@@ -499,11 +499,11 @@ namespace gr {
// at the filter's group delay plus the fractional offset
// between the samples. Calculated here based on the rotation
// around nfilts starting at start_filter.
- float accum = -d_delay * d_flt_rate;
+ float accum = d_delay * d_flt_rate;
int accum_int = static_cast<int>(accum);
float accum_frac = accum - accum_int;
int end_filter = static_cast<int>
- (boost::math::iround(fmodf(d_last_filter - d_delay * d_dec_rate +
accum_int, \
+ (boost::math::iround(fmodf(d_last_filter + d_delay * d_dec_rate +
accum_int, \
static_cast<float>(d_int_rate))));
d_est_phase_change = d_last_filter - (end_filter + accum_frac);
diff --git a/gr-filter/python/filter/qa_pfb_arb_resampler.py
b/gr-filter/python/filter/qa_pfb_arb_resampler.py
index 9dbef7d..0bac3e5 100755
--- a/gr-filter/python/filter/qa_pfb_arb_resampler.py
+++ b/gr-filter/python/filter/qa_pfb_arb_resampler.py
@@ -69,7 +69,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(delay, L+delay))
+ t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
# Data of the sinusoid at frequency freq with the delay and phase
offset.
expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
@@ -105,7 +105,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(delay, L+delay))
+ t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
# Data of the sinusoid at frequency freq with the delay and phase
offset.
expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
@@ -142,7 +142,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(delay, L+delay))
+ t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
# Data of the sinusoid at frequency freq with the delay and phase
offset.
expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
@@ -179,7 +179,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(delay, L+delay))
+ t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
# Data of the sinusoid at frequency freq with the delay and phase
offset.
expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
@@ -216,7 +216,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(delay, L+delay))
+ t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
# Data of the sinusoid at frequency freq with the delay and phase
offset.
expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \