diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-03-06 14:48:44 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-03-06 14:48:44 -0500 |
commit | ca69ec5d64b67dfc714917bd94162a5d1f131d69 (patch) | |
tree | 7e07cd9811eec3bbce6acba6ab7792db502ef9e4 | |
parent | 0b5950d3297212264777b6502a232d9e8458636e (diff) | |
parent | 8fbba12af7150c017f59a4fd25d607ed95a490d7 (diff) |
Merge branch 'maint'
-rw-r--r-- | gr-digital/lib/fll_band_edge_cc_impl.cc | 43 | ||||
-rw-r--r-- | gr-digital/lib/fll_band_edge_cc_impl.h | 20 |
2 files changed, 25 insertions, 38 deletions
diff --git a/gr-digital/lib/fll_band_edge_cc_impl.cc b/gr-digital/lib/fll_band_edge_cc_impl.cc index b1367448bc..583e8f5d77 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.cc +++ b/gr-digital/lib/fll_band_edge_cc_impl.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2009-2012 Free Software Foundation, Inc. - * + * Copyright 2009-2012,2014 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -67,22 +67,21 @@ namespace gr { throw std::out_of_range("fll_band_edge_cc: invalid number of sps. Must be > 0."); } d_sps = samps_per_sym; - + // Initialize rolloff factor if(rolloff < 0 || rolloff > 1.0) { throw std::out_of_range("fll_band_edge_cc: invalid rolloff factor. Must be in [0,1]."); } d_rolloff = rolloff; - + // Initialize filter length if(filter_size <= 0) { throw std::out_of_range("fll_band_edge_cc: invalid filter size. Must be > 0."); } d_filter_size = filter_size; - + // Build the band edge filters design_filter(d_sps, d_rolloff, d_filter_size); - d_output_hist.resize(filter_size,0); } fll_band_edge_cc_impl::~fll_band_edge_cc_impl() @@ -163,7 +162,7 @@ namespace gr { float k = -M + i*2.0/samps_per_sym; float tap = sinc(rolloff*k - 0.5) + sinc(rolloff*k + 0.5); power += tap; - + bb_taps.push_back(tap); } @@ -185,13 +184,13 @@ namespace gr { d_taps_lower[filter_size-i-1] = t1; d_taps_upper[filter_size-i-1] = t2; } - + d_updated = true; // Set the history to ensure enough input items for each filter set_history(filter_size+1); - d_filter_upper = new gr::filter::kernel::fir_filter_ccc(1, d_taps_upper); - d_filter_lower = new gr::filter::kernel::fir_filter_ccc(1, d_taps_lower); + d_filter_upper = new gr::filter::kernel::fir_filter_with_buffer_ccc(d_taps_upper); + d_filter_lower = new gr::filter::kernel::fir_filter_with_buffer_ccc(d_taps_lower); } void @@ -220,8 +219,6 @@ namespace gr { const gr_complex *in = (const gr_complex*)input_items[0]; gr_complex *out = (gr_complex*)output_items[0]; - d_fllbuffer.reserve(d_filter_size+noutput_items); - float *frq = NULL; float *phs = NULL; float *err = NULL; @@ -241,18 +238,15 @@ namespace gr { gr_complex nco_out; gr_complex out_upper, out_lower; gr_complex out_uppersse, out_lowersse; - copy(d_output_hist.begin(), d_output_hist.end(), d_fllbuffer.begin()); for(i = 0; i < noutput_items; i++) { nco_out = gr_expj(d_phase); - d_fllbuffer[i+d_filter_size] = in[i] * nco_out; + out[i] = in[i] * nco_out; + // Perform the dot product of the output with the filters - out_upper = 0; - out_lower = 0; + out_upper = d_filter_lower->filter(out[i]); + out_lower = d_filter_upper->filter(out[i]); - out_upper = d_filter_lower->filter(&d_fllbuffer[i]); - out_lower = d_filter_upper->filter(&d_fllbuffer[i]); - error = norm(out_lower) - norm(out_upper); advance_loop(error); @@ -266,11 +260,6 @@ namespace gr { } } - copy(d_fllbuffer.begin(), d_fllbuffer.begin()+noutput_items, out); - copy(d_fllbuffer.begin()+noutput_items, - d_fllbuffer.begin()+noutput_items+d_filter_size, - d_output_hist.begin()); - return noutput_items; } diff --git a/gr-digital/lib/fll_band_edge_cc_impl.h b/gr-digital/lib/fll_band_edge_cc_impl.h index 7bec745262..0049f59c29 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.h +++ b/gr-digital/lib/fll_band_edge_cc_impl.h @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2009,2011,2012 Free Software Foundation, Inc. - * + * Copyright 2009,2011,2012,2014 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -25,7 +25,7 @@ #include <gnuradio/digital/fll_band_edge_cc.h> #include <gnuradio/blocks/control_loop.h> -#include <gnuradio/filter/fir_filter.h> +#include <gnuradio/filter/fir_filter_with_buffer.h> namespace gr { namespace digital { @@ -41,10 +41,8 @@ namespace gr { std::vector<gr_complex> d_taps_lower; std::vector<gr_complex> d_taps_upper; bool d_updated; - std::vector<gr_complex> d_output_hist; - std::vector<gr_complex> d_fllbuffer; - gr::filter::kernel::fir_filter_ccc* d_filter_lower; - gr::filter::kernel::fir_filter_ccc* d_filter_upper; + gr::filter::kernel::fir_filter_with_buffer_ccc* d_filter_lower; + gr::filter::kernel::fir_filter_with_buffer_ccc* d_filter_upper; /*! * Design the band-edge filter based on the number of samples @@ -70,7 +68,7 @@ namespace gr { int filter_size() const; void print_taps(); - + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); |