[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 06/08: qtgui: removes use of outputsize in
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 06/08: qtgui: removes use of outputsize in freq sinks. |
Date: |
Thu, 23 Oct 2014 22:03:16 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 88944c527ae56cc94fe530c53d5846714ab77b5c
Author: Tom Rondeau <address@hidden>
Date: Thu Oct 23 15:47:58 2014 -0400
qtgui: removes use of outputsize in freq sinks.
- Was a bit confusing and caused use of different FFT sizes than the user
specificed; often resulting in 1 more than a power of 2 for standard values
(would be slightly less efficient).
- The problem was more in the _resetXAxisPoints calculation; I think this
gets the desired effect of the frequency plots.
---
gr-qtgui/lib/FrequencyDisplayPlot.cc | 2 +-
gr-qtgui/lib/freq_sink_c_impl.cc | 36 ++++++++++++++++--------------------
gr-qtgui/lib/freq_sink_f_impl.cc | 36 ++++++++++++++++--------------------
3 files changed, 33 insertions(+), 41 deletions(-)
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc
b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 6e0983e..41050ed 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -509,7 +509,7 @@ void
FrequencyDisplayPlot::_resetXAxisPoints()
{
double fft_bin_size = (d_stop_frequency - d_start_frequency)
- / static_cast<double>(d_numPoints - (d_half_freq ? 0 : 1));
+ / static_cast<double>(d_numPoints);
double freqValue = d_start_frequency;
for(int64_t loc = 0; loc < d_numPoints; loc++) {
d_xdata[loc] = freqValue;
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index 9cb2aa3..f4614e9 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -82,22 +82,20 @@ namespace gr {
// this is usually desired when plotting
d_shift = true;
- d_outputsize = (2 * (d_fftsize / 2)) + 1;
-
d_fft = new fft::fft_complex(d_fftsize, true);
- d_fbuf = (float*)volk_malloc(d_outputsize*sizeof(float),
+ d_fbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
volk_get_alignment());
- memset(d_fbuf, 0, d_outputsize*sizeof(float));
+ memset(d_fbuf, 0, d_fftsize*sizeof(float));
d_index = 0;
for(int i = 0; i < d_nconnections; i++) {
d_residbufs.push_back((gr_complex*)volk_malloc(d_fftsize*sizeof(gr_complex),
volk_get_alignment()));
- d_magbufs.push_back((double*)volk_malloc(d_outputsize*sizeof(double),
+ d_magbufs.push_back((double*)volk_malloc(d_fftsize*sizeof(double),
volk_get_alignment()));
memset(d_residbufs[i], 0, d_fftsize*sizeof(gr_complex));
- memset(d_magbufs[i], 0, d_outputsize*sizeof(double));
+ memset(d_magbufs[i], 0, d_fftsize*sizeof(double));
}
buildwindow();
@@ -151,7 +149,7 @@ namespace gr {
d_main_gui = new FreqDisplayForm(d_nconnections, d_parent);
set_fft_window(d_wintype);
- set_fft_size(d_outputsize);
+ set_fft_size(d_fftsize);
set_frequency_range(d_center_freq, d_bandwidth);
if(d_name.size() > 0)
@@ -472,7 +470,6 @@ namespace gr {
gr::thread::scoped_lock lock(d_setlock);
int newfftsize = d_main_gui->getFFTSize();
- int newoutputsize = (2 * (newfftsize / 2)) + 1;
d_fftavg = d_main_gui->getFFTAverage();
if(newfftsize != d_fftsize) {
@@ -483,17 +480,16 @@ namespace gr {
d_residbufs[i] =
(gr_complex*)volk_malloc(newfftsize*sizeof(gr_complex),
volk_get_alignment());
- d_magbufs[i] = (double*)volk_malloc(newoutputsize*sizeof(double),
+ d_magbufs[i] = (double*)volk_malloc(newfftsize*sizeof(double),
volk_get_alignment());
memset(d_residbufs[i], 0, newfftsize*sizeof(gr_complex));
- memset(d_magbufs[i], 0, newoutputsize*sizeof(double));
+ memset(d_magbufs[i], 0, newfftsize*sizeof(double));
}
// Set new fft size and reset buffer index
// (throws away any currently held data, but who cares?)
d_fftsize = newfftsize;
- d_outputsize = newoutputsize;
d_index = 0;
// Reset window to reflect new size
@@ -504,9 +500,9 @@ namespace gr {
d_fft = new fft::fft_complex(d_fftsize, true);
volk_free(d_fbuf);
- d_fbuf = (float*)volk_malloc(d_outputsize*sizeof(float),
+ d_fbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
volk_get_alignment());
- memset(d_fbuf, 0, d_outputsize*sizeof(float));
+ memset(d_fbuf, 0, d_fftsize*sizeof(float));
d_last_time = 0;
@@ -590,7 +586,7 @@ namespace gr {
// If using auto trigger mode, trigger periodically even
// without a trigger event.
- if((d_trigger_mode == TRIG_MODE_AUTO) && (d_trigger_count >
d_outputsize)) {
+ if((d_trigger_mode == TRIG_MODE_AUTO) && (d_trigger_count > d_fftsize)) {
d_triggered = true;
d_trigger_count = 0;
}
@@ -614,16 +610,16 @@ namespace gr {
_gui_update_trigger();
gr::thread::scoped_lock lock(d_setlock);
- for(d_index = 0; d_index < noutput_items; d_index+=d_outputsize) {
+ for(d_index = 0; d_index < noutput_items; d_index+=d_fftsize) {
if((gr::high_res_timer_now() - d_last_time) > d_update_time) {
// Trigger off tag, if active
if((d_trigger_mode == TRIG_MODE_TAG) && !d_triggered) {
- _test_trigger_tags(d_index, d_outputsize);
+ _test_trigger_tags(d_index, d_fftsize);
if(d_triggered) {
// If not enough from tag position, early exit
- if((d_index + d_outputsize) >= noutput_items)
+ if((d_index + d_fftsize) >= noutput_items)
return d_index;
}
}
@@ -634,7 +630,7 @@ namespace gr {
memcpy(d_residbufs[n], &in[d_index], sizeof(gr_complex)*d_fftsize);
fft(d_fbuf, d_residbufs[n], d_fftsize);
- for(int x = 0; x < d_outputsize; x++) {
+ for(int x = 0; x < d_fftsize; x++) {
d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] +
(d_fftavg)*d_fbuf[x]);
}
//volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
@@ -642,14 +638,14 @@ namespace gr {
// Test trigger off signal power in d_magbufs
if((d_trigger_mode == TRIG_MODE_NORM) || (d_trigger_mode ==
TRIG_MODE_AUTO)) {
- _test_trigger_norm(d_outputsize, d_magbufs);
+ _test_trigger_norm(d_fftsize, d_magbufs);
}
// If a trigger (FREE always triggers), plot and reset state
if(d_triggered) {
d_last_time = gr::high_res_timer_now();
d_qApplication->postEvent(d_main_gui,
- new FreqUpdateEvent(d_magbufs,
d_outputsize));
+ new FreqUpdateEvent(d_magbufs,
d_fftsize));
_reset();
}
}
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index c50280e..14c8ff4 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -82,22 +82,20 @@ namespace gr {
// this is usually desired when plotting
d_shift = true;
- d_outputsize = (2 * (d_fftsize / 2)) + 1;
-
d_fft = new fft::fft_complex(d_fftsize, true);
- d_fbuf = (float*)volk_malloc(d_outputsize*sizeof(float),
+ d_fbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
volk_get_alignment());
- memset(d_fbuf, 0, d_outputsize*sizeof(float));
+ memset(d_fbuf, 0, d_fftsize*sizeof(float));
d_index = 0;
for(int i = 0; i < d_nconnections; i++) {
d_residbufs.push_back((float*)volk_malloc(d_fftsize*sizeof(float),
volk_get_alignment()));
- d_magbufs.push_back((double*)volk_malloc(d_outputsize*sizeof(double),
+ d_magbufs.push_back((double*)volk_malloc(d_fftsize*sizeof(double),
volk_get_alignment()));
memset(d_residbufs[i], 0, d_fftsize*sizeof(float));
- memset(d_magbufs[i], 0, d_outputsize*sizeof(double));
+ memset(d_magbufs[i], 0, d_fftsize*sizeof(double));
}
buildwindow();
@@ -151,7 +149,7 @@ namespace gr {
d_main_gui = new FreqDisplayForm(d_nconnections, d_parent);
set_fft_window(d_wintype);
- set_fft_size(d_outputsize);
+ set_fft_size(d_fftsize);
set_frequency_range(d_center_freq, d_bandwidth);
if(d_name.size() > 0)
@@ -478,7 +476,6 @@ namespace gr {
gr::thread::scoped_lock lock(d_setlock);
int newfftsize = d_main_gui->getFFTSize();
- int newoutputsize = (2 * (newfftsize / 2)) + 1;
d_fftavg = d_main_gui->getFFTAverage();
if(newfftsize != d_fftsize) {
@@ -489,17 +486,16 @@ namespace gr {
d_residbufs[i] = (float*)volk_malloc(newfftsize*sizeof(float),
volk_get_alignment());
- d_magbufs[i] = (double*)volk_malloc(newoutputsize*sizeof(double),
+ d_magbufs[i] = (double*)volk_malloc(newfftsize*sizeof(double),
volk_get_alignment());
memset(d_residbufs[i], 0, newfftsize*sizeof(float));
- memset(d_magbufs[i], 0, newoutputsize*sizeof(double));
+ memset(d_magbufs[i], 0, newfftsize*sizeof(double));
}
// Set new fft size and reset buffer index
// (throws away any currently held data, but who cares?)
d_fftsize = newfftsize;
- d_outputsize = newoutputsize;
d_index = 0;
// Reset window to reflect new size
@@ -510,9 +506,9 @@ namespace gr {
d_fft = new fft::fft_complex(d_fftsize, true);
volk_free(d_fbuf);
- d_fbuf = (float*)volk_malloc(d_outputsize*sizeof(float),
+ d_fbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
volk_get_alignment());
- memset(d_fbuf, 0, d_outputsize*sizeof(float));
+ memset(d_fbuf, 0, d_fftsize*sizeof(float));
d_last_time = 0;
@@ -596,7 +592,7 @@ namespace gr {
// If using auto trigger mode, trigger periodically even
// without a trigger event.
- if((d_trigger_mode == TRIG_MODE_AUTO) && (d_trigger_count >
d_outputsize)) {
+ if((d_trigger_mode == TRIG_MODE_AUTO) && (d_trigger_count > d_fftsize)) {
d_triggered = true;
d_trigger_count = 0;
}
@@ -620,16 +616,16 @@ namespace gr {
_gui_update_trigger();
gr::thread::scoped_lock lock(d_setlock);
- for(d_index = 0; d_index < noutput_items; d_index+=d_outputsize) {
+ for(d_index = 0; d_index < noutput_items; d_index+=d_fftsize) {
if((gr::high_res_timer_now() - d_last_time) > d_update_time) {
// Trigger off tag, if active
if((d_trigger_mode == TRIG_MODE_TAG) && !d_triggered) {
- _test_trigger_tags(d_index, d_outputsize);
+ _test_trigger_tags(d_index, d_fftsize);
if(d_triggered) {
// If not enough from tag position, early exit
- if((d_index + d_outputsize) >= noutput_items)
+ if((d_index + d_fftsize) >= noutput_items)
return d_index;
}
}
@@ -640,7 +636,7 @@ namespace gr {
memcpy(d_residbufs[n], &in[d_index], sizeof(float)*d_fftsize);
fft(d_fbuf, d_residbufs[n], d_fftsize);
- for(int x = 0; x < d_outputsize; x++) {
+ for(int x = 0; x < d_fftsize; x++) {
d_magbufs[n][x] = (double)((1.0-d_fftavg)*d_magbufs[n][x] +
(d_fftavg)*d_fbuf[x]);
}
//volk_32f_convert_64f_a(d_magbufs[n], d_fbuf, d_fftsize);
@@ -648,14 +644,14 @@ namespace gr {
// Test trigger off signal power in d_magbufs
if((d_trigger_mode == TRIG_MODE_NORM) || (d_trigger_mode ==
TRIG_MODE_AUTO)) {
- _test_trigger_norm(d_outputsize, d_magbufs);
+ _test_trigger_norm(d_fftsize, d_magbufs);
}
// If a trigger (FREE always triggers), plot and reset state
if(d_triggered) {
d_last_time = gr::high_res_timer_now();
d_qApplication->postEvent(d_main_gui,
- new FreqUpdateEvent(d_magbufs,
d_outputsize));
+ new FreqUpdateEvent(d_magbufs,
d_fftsize));
_reset();
}
}
- [Commit-gnuradio] [gnuradio] branch master updated (d814381 -> 82779dc), git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 04/08: qtgui: fixed comment., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 05/08: qtgui: added triggering to freq sinks., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 07/08: qtgui: removing malloc/free in fft function; doing once in ctor and when fftsize changes, instead., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 06/08: qtgui: removes use of outputsize in freq sinks.,
git <=
- [Commit-gnuradio] [gnuradio] 03/08: qtgui: allow toggle to only show positive half of waterfall spectrum., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 02/08: qtgui: fixed problem with setting fft size and averaging of the float waterfall at runtime., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 01/08: qtgui: allow float freq plot to only plot positive half of spectrum., git, 2014/10/23
- [Commit-gnuradio] [gnuradio] 08/08: Merge branch 'maint', git, 2014/10/23