[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/07: Tabs -> spaces
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/07: Tabs -> spaces |
Date: |
Mon, 21 Sep 2015 04:44:36 +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 facb1e1500aecbf01654b228ad8a15511f5d3eae
Author: Doug Geiger <address@hidden>
Date: Thu Sep 17 12:32:24 2015 -0400
Tabs -> spaces
---
gr-fft/include/gnuradio/fft/fft.h | 16 ++---
gr-fft/include/gnuradio/fft/window.h | 14 ++--
gr-fft/lib/fft.cc | 122 +++++++++++++++++++----------------
gr-fft/lib/fft_vcc_fftw.cc | 114 ++++++++++++++++----------------
gr-fft/lib/fft_vcc_fftw.h | 8 +--
gr-fft/python/fft/qa_fft.py | 10 +--
6 files changed, 146 insertions(+), 138 deletions(-)
diff --git a/gr-fft/include/gnuradio/fft/fft.h
b/gr-fft/include/gnuradio/fft/fft.h
index 3aed9cc..81cd51d 100644
--- a/gr-fft/include/gnuradio/fft/fft.h
+++ b/gr-fft/include/gnuradio/fft/fft.h
@@ -69,11 +69,11 @@ namespace gr {
* \ingroup misc
*/
class FFT_API fft_complex {
- int d_fft_size;
+ int d_fft_size;
int d_nthreads;
gr_complex *d_inbuf;
gr_complex *d_outbuf;
- void *d_plan;
+ void *d_plan;
public:
fft_complex(int fft_size, bool forward = true, int nthreads=1);
@@ -112,11 +112,11 @@ namespace gr {
* \ingroup misc
*/
class FFT_API fft_real_fwd {
- int d_fft_size;
+ int d_fft_size;
int d_nthreads;
- float *d_inbuf;
+ float *d_inbuf;
gr_complex *d_outbuf;
- void *d_plan;
+ void *d_plan;
public:
fft_real_fwd (int fft_size, int nthreads=1);
@@ -155,11 +155,11 @@ namespace gr {
* \ingroup misc
*/
class FFT_API fft_real_rev {
- int d_fft_size;
+ int d_fft_size;
int d_nthreads;
gr_complex *d_inbuf;
- float *d_outbuf;
- void *d_plan;
+ float *d_outbuf;
+ void *d_plan;
public:
fft_real_rev(int fft_size, int nthreads=1);
diff --git a/gr-fft/include/gnuradio/fft/window.h
b/gr-fft/include/gnuradio/fft/window.h
index 4b13ddd..564753a 100644
--- a/gr-fft/include/gnuradio/fft/window.h
+++ b/gr-fft/include/gnuradio/fft/window.h
@@ -35,13 +35,13 @@ namespace gr {
public:
enum win_type {
- WIN_HAMMING = 0, //!< Hamming window; max attenuation 53 dB
- WIN_HANN = 1, //!< Hann window; max attenuation 44 dB
- WIN_BLACKMAN = 2, //!< Blackman window; max attenuation 74 dB
- WIN_RECTANGULAR = 3, //!< Basic rectangular window; max attenuation
21 dB
- WIN_KAISER = 4, //!< Kaiser window; max attenuation see
window::max_attenuation
- WIN_BLACKMAN_hARRIS = 5, //!< Blackman-harris window; max attenuation
92 dB
- WIN_BLACKMAN_HARRIS = 5, //!< alias to WIN_BLACKMAN_hARRIS for
capitalization consistency
+ WIN_HAMMING = 0, //!< Hamming window; max attenuation 53 dB
+ WIN_HANN = 1, //!< Hann window; max attenuation 44 dB
+ WIN_BLACKMAN = 2, //!< Blackman window; max attenuation 74 dB
+ WIN_RECTANGULAR = 3, //!< Basic rectangular window; max
attenuation 21 dB
+ WIN_KAISER = 4, //!< Kaiser window; max attenuation see
window::max_attenuation
+ WIN_BLACKMAN_hARRIS = 5, //!< Blackman-harris window; max attenuation
92 dB
+ WIN_BLACKMAN_HARRIS = 5, //!< alias to WIN_BLACKMAN_hARRIS for
capitalization consistency
WIN_BARTLETT = 6, //!< Barlett (triangular) window; max
attenuation 26 dB
WIN_FLATTOP = 7, //!< flat top window; useful in FFTs; max
attenuation 93 dB
};
diff --git a/gr-fft/lib/fft.cc b/gr-fft/lib/fft.cc
index 18e54f0..729600c 100644
--- a/gr-fft/lib/fft.cc
+++ b/gr-fft/lib/fft.cc
@@ -96,11 +96,11 @@ namespace gr {
const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "r");
if (fp != 0){
- int r = fftwf_import_wisdom_from_file (fp);
- fclose (fp);
- if (!r){
- fprintf (stderr, "gr::fft: can't import wisdom from %s\n", filename);
- }
+ int r = fftwf_import_wisdom_from_file (fp);
+ fclose (fp);
+ if (!r){
+ fprintf (stderr, "gr::fft: can't import wisdom from %s\n", filename);
+ }
}
}
@@ -111,10 +111,10 @@ namespace gr {
#ifdef FFTW3F_THREADS
if (fftw_threads_inited == 0)
- {
- fftw_threads_inited = 1;
- fftwf_init_threads();
- }
+ {
+ fftw_threads_inited = 1;
+ fftwf_init_threads();
+ }
fftwf_plan_with_nthreads(nthreads);
#endif
@@ -126,12 +126,12 @@ namespace gr {
const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "w");
if (fp != 0){
- fftwf_export_wisdom_to_file (fp);
- fclose (fp);
+ fftwf_export_wisdom_to_file (fp);
+ fclose (fp);
}
else {
- fprintf (stderr, "fft_impl_fftw: ");
- perror (filename);
+ fprintf (stderr, "fft_impl_fftw: ");
+ perror (filename);
}
}
@@ -144,18 +144,19 @@ namespace gr {
assert (sizeof (fftwf_complex) == sizeof (gr_complex));
- if (fft_size <= 0)
- throw std::out_of_range ("fft_impl_fftw: invalid fft_size");
+ if (fft_size <= 0){
+ throw std::out_of_range ("fft_impl_fftw: invalid fft_size");
+ }
d_fft_size = fft_size;
d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) *
inbuf_length ());
- if (d_inbuf == 0)
- throw std::runtime_error ("fftwf_malloc");
-
+ if (d_inbuf == 0) {
+ throw std::runtime_error ("fftwf_malloc");
+ }
d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) *
outbuf_length ());
- if (d_outbuf == 0){
- fftwf_free (d_inbuf);
- throw std::runtime_error ("fftwf_malloc");
+ if (d_outbuf == 0) {
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
}
d_nthreads = nthreads;
@@ -163,14 +164,14 @@ namespace gr {
import_wisdom(); // load prior wisdom from disk
d_plan = fftwf_plan_dft_1d (fft_size,
- reinterpret_cast<fftwf_complex *>(d_inbuf),
- reinterpret_cast<fftwf_complex *>(d_outbuf),
- forward ? FFTW_FORWARD : FFTW_BACKWARD,
- FFTW_MEASURE);
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ forward ? FFTW_FORWARD : FFTW_BACKWARD,
+ FFTW_MEASURE);
if (d_plan == NULL) {
- fprintf(stderr, "gr::fft: error creating plan\n");
- throw std::runtime_error ("fftwf_plan_dft_1d failed");
+ fprintf(stderr, "gr::fft: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_1d failed");
}
export_wisdom(); // store new wisdom to disk
}
@@ -188,8 +189,9 @@ namespace gr {
void
fft_complex::set_nthreads(int n)
{
- if (n <= 0)
- throw std::out_of_range ("gr::fft: invalid number of threads");
+ if (n <= 0) {
+ throw std::out_of_range ("gr::fft: invalid number of threads");
+ }
d_nthreads = n;
#ifdef FFTW3F_THREADS
@@ -212,18 +214,20 @@ namespace gr {
assert (sizeof (fftwf_complex) == sizeof (gr_complex));
- if (fft_size <= 0)
- throw std::out_of_range ("gr::fft: invalid fft_size");
+ if (fft_size <= 0) {
+ throw std::out_of_range ("gr::fft: invalid fft_size");
+ }
d_fft_size = fft_size;
d_inbuf = (float *) fftwf_malloc (sizeof (float) * inbuf_length ());
- if (d_inbuf == 0)
- throw std::runtime_error ("fftwf_malloc");
+ if (d_inbuf == 0) {
+ throw std::runtime_error ("fftwf_malloc");
+ }
d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) *
outbuf_length ());
- if (d_outbuf == 0){
- fftwf_free (d_inbuf);
- throw std::runtime_error ("fftwf_malloc");
+ if (d_outbuf == 0) {
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
}
d_nthreads = nthreads;
@@ -231,13 +235,13 @@ namespace gr {
import_wisdom(); // load prior wisdom from disk
d_plan = fftwf_plan_dft_r2c_1d (fft_size,
- d_inbuf,
- reinterpret_cast<fftwf_complex
*>(d_outbuf),
- FFTW_MEASURE);
+ d_inbuf,
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ FFTW_MEASURE);
if (d_plan == NULL) {
- fprintf(stderr, "gr::fft::fft_real_fwd: error creating plan\n");
- throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
+ fprintf(stderr, "gr::fft::fft_real_fwd: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
}
export_wisdom(); // store new wisdom to disk
}
@@ -255,8 +259,9 @@ namespace gr {
void
fft_real_fwd::set_nthreads(int n)
{
- if (n <= 0)
- throw std::out_of_range ("gr::fft::fft_real_fwd::set_nthreads: invalid
number of threads");
+ if (n <= 0) {
+ throw std::out_of_range ("gr::fft::fft_real_fwd::set_nthreads: invalid
number of threads");
+ }
d_nthreads = n;
#ifdef FFTW3F_THREADS
@@ -279,18 +284,20 @@ namespace gr {
assert (sizeof (fftwf_complex) == sizeof (gr_complex));
- if (fft_size <= 0)
- throw std::out_of_range ("gr::fft::fft_real_rev: invalid fft_size");
+ if (fft_size <= 0) {
+ throw std::out_of_range ("gr::fft::fft_real_rev: invalid fft_size");
+ }
d_fft_size = fft_size;
d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) *
inbuf_length ());
- if (d_inbuf == 0)
- throw std::runtime_error ("fftwf_malloc");
+ if (d_inbuf == 0) {
+ throw std::runtime_error ("fftwf_malloc");
+ }
d_outbuf = (float *) fftwf_malloc (sizeof (float) * outbuf_length ());
- if (d_outbuf == 0){
- fftwf_free (d_inbuf);
- throw std::runtime_error ("fftwf_malloc");
+ if (d_outbuf == 0) {
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
}
d_nthreads = nthreads;
@@ -301,13 +308,13 @@ namespace gr {
// will be called in multiple threads, we've got to ensure single
// threaded access. They are not thread-safe.
d_plan = fftwf_plan_dft_c2r_1d (fft_size,
- reinterpret_cast<fftwf_complex
*>(d_inbuf),
- d_outbuf,
- FFTW_MEASURE);
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ d_outbuf,
+ FFTW_MEASURE);
if (d_plan == NULL) {
- fprintf(stderr, "gr::fft::fft_real_rev: error creating plan\n");
- throw std::runtime_error ("fftwf_plan_dft_c2r_1d failed");
+ fprintf(stderr, "gr::fft::fft_real_rev: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_c2r_1d failed");
}
export_wisdom (); // store new wisdom to disk
}
@@ -325,8 +332,9 @@ namespace gr {
void
fft_real_rev::set_nthreads(int n)
{
- if (n <= 0)
- throw std::out_of_range ("gr::fft::fft_real_rev::set_nthreads: invalid
number of threads");
+ if (n <= 0) {
+ throw std::out_of_range ("gr::fft::fft_real_rev::set_nthreads: invalid
number of threads");
+ }
d_nthreads = n;
#ifdef FFTW3F_THREADS
diff --git a/gr-fft/lib/fft_vcc_fftw.cc b/gr-fft/lib/fft_vcc_fftw.cc
index 778042e..18ba56e 100644
--- a/gr-fft/lib/fft_vcc_fftw.cc
+++ b/gr-fft/lib/fft_vcc_fftw.cc
@@ -33,21 +33,21 @@ namespace gr {
namespace fft {
fft_vcc::sptr fft_vcc::make(int fft_size, bool forward,
- const std::vector<float> &window,
- bool shift, int nthreads)
+ const std::vector<float> &window,
+ bool shift, int nthreads)
{
return gnuradio::get_initial_sptr(new fft_vcc_fftw
- (fft_size, forward, window,
- shift, nthreads));
+ (fft_size, forward, window,
+ shift, nthreads));
}
fft_vcc_fftw::fft_vcc_fftw(int fft_size, bool forward,
- const std::vector<float> &window,
- bool shift, int nthreads)
+ const std::vector<float> &window,
+ bool shift, int nthreads)
: sync_block("fft_vcc_fftw",
- io_signature::make(1, 1, fft_size * sizeof(gr_complex)),
- io_signature::make(1, 1, fft_size * sizeof(gr_complex))),
- d_fft_size(fft_size), d_forward(forward), d_shift(shift)
+ io_signature::make(1, 1, fft_size * sizeof(gr_complex)),
+ io_signature::make(1, 1, fft_size * sizeof(gr_complex))),
+ d_fft_size(fft_size), d_forward(forward), d_shift(shift)
{
d_fft = new fft_complex(d_fft_size, forward, nthreads);
if(!set_window(window))
@@ -75,17 +75,17 @@ namespace gr {
fft_vcc_fftw::set_window(const std::vector<float> &window)
{
if(window.size()==0 || window.size()==d_fft_size) {
- d_window=window;
- return true;
+ d_window=window;
+ return true;
}
else
- return false;
+ return false;
}
int
fft_vcc_fftw::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
@@ -97,49 +97,49 @@ namespace gr {
while(count++ < noutput_items) {
- // copy input into optimally aligned buffer
- if(d_window.size()) {
- gr_complex *dst = d_fft->get_inbuf();
- if(!d_forward && d_shift) {
- unsigned int offset = (!d_forward && d_shift)?(d_fft_size/2):0;
- int fft_m_offset = d_fft_size - offset;
- for(unsigned int i = 0; i < offset; i++) // apply window
- dst[i+fft_m_offset] = in[i] * d_window[i];
- for(unsigned int i = offset; i < d_fft_size; i++) // apply window
- dst[i-offset] = in[i] * d_window[i];
- }
- else {
- for(unsigned int i = 0; i < d_fft_size; i++) //
apply window
- dst[i] = in[i] * d_window[i];
- }
- }
- else {
- if(!d_forward && d_shift) { // apply an ifft shift on the data
- gr_complex *dst = d_fft->get_inbuf();
- unsigned int len = (unsigned int)(floor(d_fft_size/2.0)); // half
length of complex array
- memcpy(&dst[0], &in[len], sizeof(gr_complex)*(d_fft_size - len));
- memcpy(&dst[d_fft_size - len], &in[0], sizeof(gr_complex)*len);
- }
- else {
- memcpy(d_fft->get_inbuf(), in, input_data_size);
- }
- }
-
- // compute the fft
- d_fft->execute();
-
- // copy result to our output
- if(d_forward && d_shift) { // apply a fft shift on the data
- unsigned int len = (unsigned int)(ceil(d_fft_size/2.0));
- memcpy(&out[0], &d_fft->get_outbuf()[len],
sizeof(gr_complex)*(d_fft_size - len));
- memcpy(&out[d_fft_size - len], &d_fft->get_outbuf()[0],
sizeof(gr_complex)*len);
- }
- else {
- memcpy (out, d_fft->get_outbuf (), output_data_size);
- }
-
- in += d_fft_size;
- out += d_fft_size;
+ // copy input into optimally aligned buffer
+ if(d_window.size()) {
+ gr_complex *dst = d_fft->get_inbuf();
+ if(!d_forward && d_shift) {
+ unsigned int offset = (!d_forward && d_shift)?(d_fft_size/2):0;
+ int fft_m_offset = d_fft_size - offset;
+ for(unsigned int i = 0; i < offset; i++) // apply window
+ dst[i+fft_m_offset] = in[i] * d_window[i];
+ for(unsigned int i = offset; i < d_fft_size; i++) // apply window
+ dst[i-offset] = in[i] * d_window[i];
+ }
+ else {
+ for(unsigned int i = 0; i < d_fft_size; i++) // apply window
+ dst[i] = in[i] * d_window[i];
+ }
+ }
+ else {
+ if(!d_forward && d_shift) { // apply an ifft shift on the data
+ gr_complex *dst = d_fft->get_inbuf();
+ unsigned int len = (unsigned int)(floor(d_fft_size/2.0)); // half
length of complex array
+ memcpy(&dst[0], &in[len], sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&dst[d_fft_size - len], &in[0], sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy(d_fft->get_inbuf(), in, input_data_size);
+ }
+ }
+
+ // compute the fft
+ d_fft->execute();
+
+ // copy result to our output
+ if(d_forward && d_shift) { // apply a fft shift on the data
+ unsigned int len = (unsigned int)(ceil(d_fft_size/2.0));
+ memcpy(&out[0], &d_fft->get_outbuf()[len],
sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&out[d_fft_size - len], &d_fft->get_outbuf()[0],
sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy (out, d_fft->get_outbuf (), output_data_size);
+ }
+
+ in += d_fft_size;
+ out += d_fft_size;
}
return noutput_items;
diff --git a/gr-fft/lib/fft_vcc_fftw.h b/gr-fft/lib/fft_vcc_fftw.h
index 9516020..375bb62 100644
--- a/gr-fft/lib/fft_vcc_fftw.h
+++ b/gr-fft/lib/fft_vcc_fftw.h
@@ -40,8 +40,8 @@ namespace gr {
public:
fft_vcc_fftw(int fft_size, bool forward,
- const std::vector<float> &window,
- bool shift, int nthreads=1);
+ const std::vector<float> &window,
+ bool shift, int nthreads=1);
~fft_vcc_fftw();
@@ -50,8 +50,8 @@ namespace gr {
bool set_window(const std::vector<float> &window);
int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
};
} /* namespace fft */
diff --git a/gr-fft/python/fft/qa_fft.py b/gr-fft/python/fft/qa_fft.py
index 3c7aa99..cc8a085 100755
--- a/gr-fft/python/fft/qa_fft.py
+++ b/gr-fft/python/fft/qa_fft.py
@@ -33,10 +33,10 @@ primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
class test_fft(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def assert_fft_ok2(self, expected_result, result_data):
expected_result = expected_result[:len(result_data)]
@@ -49,7 +49,7 @@ class test_fft(gr_unittest.TestCase):
abs_eps, rel_eps)
def test_001(self):
- tb = gr.top_block()
+ tb = gr.top_block()
fft_size = 32
src_data = tuple([complex(primes[2*i], primes[2*i+1]) for i in
range(fft_size)])
@@ -100,7 +100,7 @@ class test_fft(gr_unittest.TestCase):
self.assert_fft_ok2(expected_result, result_data)
def test_002(self):
- tb = gr.top_block()
+ tb = gr.top_block()
fft_size = 32
tmp_data = ((4377+4516j),
@@ -156,7 +156,7 @@ class test_fft(gr_unittest.TestCase):
def test_003(self):
# Same test as above, only use 2 threads
- tb = gr.top_block()
+ tb = gr.top_block()
fft_size = 32
tmp_data = ((4377+4516j),
- [Commit-gnuradio] [gnuradio] branch master updated (8e19986 -> a03893d), git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 05/07: Merge branch 'maint', git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 06/07: Merge remote-tracking branch 'daulpavid/patch-1', git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 01/07: blocks: Added updating callback for Tag Object and Vector Source, git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 04/07: VOLKize fft_vcc_fftw, git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 07/07: Merge remote-tracking branch 'geiger/volkize_fft', git, 2015/09/21
- [Commit-gnuradio] [gnuradio] 02/07: Tabs -> spaces,
git <=
- [Commit-gnuradio] [gnuradio] 03/07: Fix up QA tests: test windowing function, git, 2015/09/21