[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 08/16: digital: fix skipped sample handling
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 08/16: digital: fix skipped sample handling in burst_shaper |
Date: |
Sun, 26 Apr 2015 23:18:03 +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 06ec3aa4e9bd5152b2bd21f4d4cabd26c4631e0d
Author: Sean Nowlan <address@hidden>
Date: Fri Apr 24 15:28:28 2015 -0400
digital: fix skipped sample handling in burst_shaper
---
gr-digital/lib/burst_shaper_XX_impl.cc.t | 16 +++++++-------
gr-digital/lib/burst_shaper_XX_impl.h.t | 1 -
gr-digital/python/digital/qa_burst_shaper.py | 31 +++++++++++++++++-----------
3 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/gr-digital/lib/burst_shaper_XX_impl.cc.t
b/gr-digital/lib/burst_shaper_XX_impl.cc.t
index bd92665..398011a 100644
--- a/gr-digital/lib/burst_shaper_XX_impl.cc.t
+++ b/gr-digital/lib/burst_shaper_XX_impl.cc.t
@@ -68,7 +68,6 @@ namespace gr {
d_ncopy(0),
d_limit(0),
d_index(0),
- d_nprocessed(0),
d_finished(false),
d_state(STATE_WAIT)
{
@@ -118,7 +117,7 @@ namespace gr {
get_tags_in_window(length_tags, 0, 0, ninput_items[0],
d_length_tag_key);
get_tags_in_window(tags, 0, 0, ninput_items[0]);
std::sort(length_tags.rbegin(), length_tags.rend(),
tag_t::offset_compare);
- std::sort(tags.rbegin(), tags.rend(), tag_t::offset_compare);
+ std::sort(tags.begin(), tags.end(), tag_t::offset_compare);
while((nwritten < noutput_items) && (nread < ninput_items[0])) {
if(d_finished) {
@@ -128,11 +127,11 @@ namespace gr {
nspace = noutput_items - nwritten;
switch(d_state) {
case(STATE_WAIT):
- if(!tags.empty()) {
- curr_tag_index = tags.back().offset;
- d_ncopy = pmt::to_long(tags.back().value);
- tags.pop_back();
- nskip = (int)(curr_tag_index - d_nprocessed);
+ if(!length_tags.empty()) {
+ curr_tag_index = length_tags.back().offset;
+ d_ncopy = pmt::to_long(length_tags.back().value);
+ length_tags.pop_back();
+ nskip = (int)(curr_tag_index - nread - nitems_read(0));
add_length_tag(nwritten);
enter_prepad();
}
@@ -144,7 +143,7 @@ namespace gr {
boost::format("Dropping %1% samples") %
nskip);
nread += nskip;
- d_nprocessed += nskip;
+ in += nskip;
}
break;
@@ -274,7 +273,6 @@ namespace gr {
void
@IMPL_NAME@::enter_wait() {
d_finished = true;
- d_nprocessed += d_ncopy;
d_index = 0;
d_state = STATE_WAIT;
}
diff --git a/gr-digital/lib/burst_shaper_XX_impl.h.t
b/gr-digital/lib/burst_shaper_XX_impl.h.t
index 90c7df8..4fa1cad 100644
--- a/gr-digital/lib/burst_shaper_XX_impl.h.t
+++ b/gr-digital/lib/burst_shaper_XX_impl.h.t
@@ -48,7 +48,6 @@ namespace gr {
int d_ncopy;
int d_limit;
int d_index;
- uint64_t d_nprocessed;
bool d_finished;
state_t d_state;
diff --git a/gr-digital/python/digital/qa_burst_shaper.py
b/gr-digital/python/digital/qa_burst_shaper.py
index d00c230..b5aecd4 100755
--- a/gr-digital/python/digital/qa_burst_shaper.py
+++ b/gr-digital/python/digital/qa_burst_shaper.py
@@ -244,28 +244,35 @@ class qa_burst_shaper (gr_unittest.TestCase):
prepad = 10
postpad = 10
length = 20
- data = np.ones(2*length + 10) # need 10 more to push things through
+ gap_len = 5
+ data = np.arange(2*length + 10,
+ dtype=float) # need 10 more to push things through
window = np.concatenate((-2.0*np.ones(5), -4.0*np.ones(5)))
- tags = (make_length_tag(0, length), make_length_tag(length + 5,
length))
- expected = np.concatenate((np.zeros(prepad), window[0:5],
- np.ones(length - len(window)), window[5:10],
- np.zeros(postpad)))
- etags = (make_length_tag(0, length + prepad + postpad),
- make_length_tag(length + prepad + postpad,
- length + prepad + postpad))
+ ewindow = window * np.array([1,-1,1,-1,1,1,-1,1,-1,1],dtype=float)
+ tags = (make_length_tag(0, length),
+ make_length_tag(length + gap_len, length))
+ expected = np.concatenate((np.zeros(prepad), ewindow[0:5],
+ np.arange(0, length, dtype=float),
+ ewindow[5:10], np.zeros(postpad),
+ np.zeros(prepad), ewindow[0:5],
+ np.arange(length + gap_len,
+ 2*length + gap_len, dtype=float),
+ ewindow[5:10], np.zeros(postpad)))
+ burst_len = length + len(window) + prepad + postpad
+ etags = (make_length_tag(0, burst_len),
+ make_length_tag(burst_len, burst_len))
# flowgraph
source = blocks.vector_source_f(data, tags=tags)
shaper = digital.burst_shaper_ff(window, pre_padding=prepad,
- post_padding=postpad)
+ post_padding=postpad,
+ insert_phasing=True)
sink = blocks.vector_sink_f()
self.tb.connect(source, shaper, sink)
self.tb.run ()
# checks
- self.assertFloatTuplesAlmostEqual(sink.data(),
- np.concatenate((expected, expected),
- 6))
+ self.assertFloatTuplesAlmostEqual(sink.data(), expected, 6)
for i in xrange(len(etags)):
self.assertTrue(compare_tags(sink.tags()[i], etags[i]))
- [Commit-gnuradio] [gnuradio] branch master updated (c0a88be -> 327f070), git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'tom/qtgui/range_type', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'nowls/burst_shaping', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 04/16: grc: Add check for GTK initialization, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 13/16: Merge remote-tracking branch 'mmueller/pwr_squelch_add_tags', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'tom/ctrlport/fixes1', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 06/16: controlport: use proper default return value from prefs get_bool., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 08/16: digital: fix skipped sample handling in burst_shaper,
git <=
- [Commit-gnuradio] [gnuradio] 05/16: qtgui: improved type checking for range block and simplifies python., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 02/16: controlport: fixed up performance monitor., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 03/16: qtgui: adds Type setting for Range widget., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 01/16: controlport: fixed controlport probes., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 07/16: analog: Power Squelch now emit tags on start/end of bursts, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 09/16: digital: added tag propagation to burst_shaper blocks, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 10/16: blocks: better implementation of peak_detector2. Address #783., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 11/16: blocks: more fixups to peak_detector2., git, 2015/04/26