diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-01-12 12:34:58 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-01-12 12:34:58 -0500 |
commit | 65dbd67db55fd0b6456a9de025cfead699af527e (patch) | |
tree | 28a7607d5b293964a956462c3dc585517b0070e6 | |
parent | a2107f7c57059ea2dcb7037abd4f6ee6a8cf20f2 (diff) |
filter: fixing having the delay of the resampler as a negative number, which I think I backed into from making the other computations work.
-rw-r--r-- | gr-filter/lib/pfb_arb_resampler.cc | 18 | ||||
-rwxr-xr-x | 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 0ebc788284..5c87447149 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 9dbef7de08..0bac3e5c15 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) + \ |