[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/07: qtgui: improves speed of time plots.
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/07: qtgui: improves speed of time plots. |
Date: |
Tue, 31 Mar 2015 14:51:20 +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 9e4b04c8dd2a63f67d7c81027bbd106330a62df7
Author: Tom Rondeau <address@hidden>
Date: Sun Mar 29 17:16:03 2015 -0700
qtgui: improves speed of time plots.
Waits until we're ready to plot before converting from float/complex
to doubles. Uses a bit more memory for each signal as a tradeoff.
---
gr-qtgui/lib/time_sink_c_impl.cc | 57 ++++++++++++++++++++++++----------------
gr-qtgui/lib/time_sink_c_impl.h | 1 +
gr-qtgui/lib/time_sink_f_impl.cc | 37 +++++++++++++++++---------
gr-qtgui/lib/time_sink_f_impl.h | 1 +
4 files changed, 61 insertions(+), 35 deletions(-)
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index 9515577..5260f7e 100644
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -71,6 +71,12 @@ namespace gr {
memset(d_buffers[n], 0, d_buffer_size*sizeof(double));
}
+ for(int n = 0; n < d_nconnections/2; n++) {
+
d_cbuffers.push_back((gr_complex*)volk_malloc(d_buffer_size*sizeof(gr_complex),
+ volk_get_alignment()));
+ memset(d_cbuffers[n], 0, d_buffer_size*sizeof(gr_complex));
+ }
+
// Set alignment properties for VOLK
const int alignment_multiple =
volk_get_alignment() / sizeof(gr_complex);
@@ -96,6 +102,9 @@ namespace gr {
for(int n = 0; n < d_nconnections; n++) {
volk_free(d_buffers[n]);
}
+ for(int n = 0; n < d_nconnections/2; n++) {
+ volk_free(d_cbuffers[n]);
+ }
delete d_argv;
}
@@ -333,6 +342,13 @@ namespace gr {
memset(d_buffers[n], 0, d_buffer_size*sizeof(double));
}
+ for(int n = 0; n < d_nconnections/2; n++) {
+ volk_free(d_cbuffers[n]);
+ d_cbuffers[n] =
(gr_complex*)volk_malloc(d_buffer_size*sizeof(gr_complex),
+ volk_get_alignment());
+ memset(d_cbuffers[n], 0, d_buffer_size*sizeof(gr_complex));
+ }
+
// If delay was set beyond the new boundary, pull it back.
if(d_trigger_delay >= d_size) {
GR_LOG_WARN(d_logger, boost::format("Trigger delay (%1%) outside of
display range (0:%2%). Moving to 50%% point.") \
@@ -427,19 +443,18 @@ namespace gr {
void
time_sink_c_impl::_reset()
{
- // Move the tail of the buffers to the front. This section
- // represents data that might have to be plotted again if a
- // trigger occurs and we have a trigger delay set. The tail
- // section is between (d_end-d_trigger_delay) and d_end.
int n;
if(d_trigger_delay) {
- for(n = 0; n < d_nconnections; n++) {
- memmove(d_buffers[n], &d_buffers[n][d_size-d_trigger_delay],
d_trigger_delay*sizeof(double));
- }
-
- // Also move the offsets of any tags that occur in the tail
- // section so they would be plotted again, too.
for(n = 0; n < d_nconnections/2; n++) {
+ // Move the tail of the buffers to the front. This section
+ // represents data that might have to be plotted again if a
+ // trigger occurs and we have a trigger delay set. The tail
+ // section is between (d_end-d_trigger_delay) and d_end.
+ memmove(d_cbuffers[n], &d_cbuffers[n][d_end-d_trigger_delay],
+ d_trigger_delay*sizeof(gr_complex));
+
+ // Also move the offsets of any tags that occur in the tail
+ // section so they would be plotted again, too.
std::vector<gr::tag_t> tmp_tags;
for(size_t t = 0; t < d_tags[n].size(); t++) {
if(d_tags[n][t].offset > (uint64_t)(d_size - d_trigger_delay)) {
@@ -593,7 +608,7 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- int n=0, idx=0;
+ int n=0;
const gr_complex *in;
_npoints_resize();
@@ -617,28 +632,26 @@ namespace gr {
}
// Copy data into the buffers.
- for(n = 0; n < d_nconnections; n+=2) {
- in = (const gr_complex*)input_items[idx];
- volk_32fc_deinterleave_64f_x2(&d_buffers[n][d_index],
- &d_buffers[n+1][d_index],
- &in[1], nitems);
+ for(n = 0; n < d_nconnections/2; n++) {
+ in = (const gr_complex*)input_items[n];
+ memcpy(&d_cbuffers[n][d_index], &in[1], nitems*sizeof(gr_complex));
- uint64_t nr = nitems_read(idx);
+ uint64_t nr = nitems_read(n);
std::vector<gr::tag_t> tags;
- get_tags_in_range(tags, idx, nr, nr + nitems + 1);
+ get_tags_in_range(tags, n, nr, nr + nitems + 1);
for(size_t t = 0; t < tags.size(); t++) {
tags[t].offset = tags[t].offset - nr + (d_index-d_start-1);
}
- d_tags[idx].insert(d_tags[idx].end(), tags.begin(), tags.end());
- idx++;
+ d_tags[n].insert(d_tags[n].end(), tags.begin(), tags.end());
}
d_index += nitems;
// If we've have a trigger and a full d_size of items in the buffers,
plot.
if((d_triggered) && (d_index == d_end)) {
// Copy data to be plotted to start of buffers.
- for(n = 0; n < d_nconnections; n++) {
- memmove(d_buffers[n], &d_buffers[n][d_start], d_size*sizeof(double));
+ for(n = 0; n < d_nconnections/2; n++) {
+ volk_32fc_deinterleave_64f_x2(d_buffers[2*n+0], d_buffers[2*n+1],
+ &d_cbuffers[n][d_start], d_size);
}
// Plot if we are able to update
diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h
index 5c0f1c9..3a836a3 100644
--- a/gr-qtgui/lib/time_sink_c_impl.h
+++ b/gr-qtgui/lib/time_sink_c_impl.h
@@ -41,6 +41,7 @@ namespace gr {
int d_nconnections;
int d_index, d_start, d_end;
+ std::vector<gr_complex*> d_cbuffers;
std::vector<double*> d_buffers;
std::vector< std::vector<gr::tag_t> > d_tags;
diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc
index b730eb5..3c83983 100644
--- a/gr-qtgui/lib/time_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -71,6 +71,10 @@ namespace gr {
d_buffers.push_back((double*)volk_malloc(d_buffer_size*sizeof(double),
volk_get_alignment()));
memset(d_buffers[n], 0, d_buffer_size*sizeof(double));
+
+ d_fbuffers.push_back((float*)volk_malloc(d_buffer_size*sizeof(float),
+ volk_get_alignment()));
+ memset(d_fbuffers[n], 0, d_buffer_size*sizeof(float));
}
// Set alignment properties for VOLK
@@ -97,6 +101,7 @@ namespace gr {
// d_main_gui is a qwidget destroyed with its parent
for(int n = 0; n < d_nconnections; n++) {
volk_free(d_buffers[n]);
+ volk_free(d_fbuffers[n]);
}
delete d_argv;
@@ -333,6 +338,11 @@ namespace gr {
d_buffers[n] = (double*)volk_malloc(d_buffer_size*sizeof(double),
volk_get_alignment());
memset(d_buffers[n], 0, d_buffer_size*sizeof(double));
+
+ volk_free(d_fbuffers[n]);
+ d_fbuffers[n] = (float*)volk_malloc(d_buffer_size*sizeof(float),
+ volk_get_alignment());
+ memset(d_fbuffers[n], 0, d_buffer_size*sizeof(float));
}
// If delay was set beyond the new boundary, pull it back.
@@ -429,19 +439,18 @@ namespace gr {
void
time_sink_f_impl::_reset()
{
- // Move the tail of the buffers to the front. This section
- // represents data that might have to be plotted again if a
- // trigger occurs and we have a trigger delay set. The tail
- // section is between (d_end-d_trigger_delay) and d_end.
int n;
if(d_trigger_delay) {
for(n = 0; n < d_nconnections; n++) {
- memmove(d_buffers[n], &d_buffers[n][d_size-d_trigger_delay],
d_trigger_delay*sizeof(double));
- }
-
- // Also move the offsets of any tags that occur in the tail
- // section so they would be plotted again, too.
- for(n = 0; n < d_nconnections; n++) {
+ // Move the tail of the buffers to the front. This section
+ // represents data that might have to be plotted again if a
+ // trigger occurs and we have a trigger delay set. The tail
+ // section is between (d_end-d_trigger_delay) and d_end.
+ memmove(d_fbuffers[n], &d_fbuffers[n][d_end-d_trigger_delay],
+ d_trigger_delay*sizeof(float));
+
+ // Also move the offsets of any tags that occur in the tail
+ // section so they would be plotted again, too.
std::vector<gr::tag_t> tmp_tags;
for(size_t t = 0; t < d_tags[n].size(); t++) {
if(d_tags[n][t].offset > (uint64_t)(d_size - d_trigger_delay)) {
@@ -615,8 +624,9 @@ namespace gr {
// Copy data into the buffers.
for(n = 0; n < d_nconnections; n++) {
in = (const float*)input_items[idx];
- volk_32f_convert_64f(&d_buffers[n][d_index],
- &in[1], nitems);
+ memcpy(&d_fbuffers[n][d_index], &in[1], nitems*sizeof(float));
+ //volk_32f_convert_64f(&d_buffers[n][d_index],
+ // &in[1], nitems);
uint64_t nr = nitems_read(idx);
std::vector<gr::tag_t> tags;
@@ -633,7 +643,8 @@ namespace gr {
if((d_triggered) && (d_index == d_end)) {
// Copy data to be plotted to start of buffers.
for(n = 0; n < d_nconnections; n++) {
- memmove(d_buffers[n], &d_buffers[n][d_start], d_size*sizeof(double));
+ //memmove(d_buffers[n], &d_buffers[n][d_start],
d_size*sizeof(double));
+ volk_32f_convert_64f(d_buffers[n], &d_fbuffers[n][d_start], d_size);
}
// Plot if we are able to update
diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h
index a9f63e3..4f8193e 100644
--- a/gr-qtgui/lib/time_sink_f_impl.h
+++ b/gr-qtgui/lib/time_sink_f_impl.h
@@ -41,6 +41,7 @@ namespace gr {
int d_nconnections;
int d_index, d_start, d_end;
+ std::vector<float*> d_fbuffers;
std::vector<double*> d_buffers;
std::vector< std::vector<gr::tag_t> > d_tags;
- [Commit-gnuradio] [gnuradio] branch master updated (1ef31a4 -> 066003f), git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 04/07: qtgui: improves speed of time plots.,
git <=
- [Commit-gnuradio] [gnuradio] 07/07: Merge remote-tracking branch 'tom/qtgui/controlpanel', git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 06/07: qtgui: better signal/slot usage to update the plots., git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 05/07: qtgui: controlpanel toggle in popup menu., git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 03/07: qtgui: changing style of grid lines for better readability., git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 02/07: qtgui: wip: adding control panel to time display., git, 2015/03/31
- [Commit-gnuradio] [gnuradio] 01/07: modtool: Added sample manifest file, git, 2015/03/31