2012-07-18 13:29:18 +00:00
|
|
|
/*!
|
|
|
|
* \file freq_xlating_fir_filter.h
|
|
|
|
* \brief Adapts a gnuradio gr_freq_xlating_fir_filter designed with gr_remez
|
|
|
|
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
|
|
|
*
|
|
|
|
* Detailed description of the file here if needed.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-05-13 20:49:11 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR 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 of the License, or
|
2015-01-08 18:49:59 +00:00
|
|
|
* (at your option) any later version.
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR 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
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNSS_SDR_FREQ_XLATING_FIR_FILTER_H_
|
|
|
|
#define GNSS_SDR_FREQ_XLATING_FIR_FILTER_H_
|
|
|
|
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "complex_float_to_complex_byte.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include "gnss_block_interface.h"
|
|
|
|
#include "short_x2_to_cshort.h"
|
2018-08-31 11:52:35 +00:00
|
|
|
#ifdef GR_GREATER_38
|
|
|
|
#include <gnuradio/filter/freq_xlating_fir_filter.h>
|
|
|
|
#else
|
2012-11-25 11:15:11 +00:00
|
|
|
#include <gnuradio/filter/freq_xlating_fir_filter_ccf.h>
|
2013-10-14 16:51:47 +00:00
|
|
|
#include <gnuradio/filter/freq_xlating_fir_filter_fcf.h>
|
2014-11-29 13:00:15 +00:00
|
|
|
#include <gnuradio/filter/freq_xlating_fir_filter_scf.h>
|
2018-08-31 11:52:35 +00:00
|
|
|
#endif
|
2015-02-04 20:45:16 +00:00
|
|
|
#include <gnuradio/blocks/char_to_short.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/blocks/complex_to_float.h>
|
|
|
|
#include <gnuradio/blocks/file_sink.h>
|
2015-02-04 20:45:16 +00:00
|
|
|
#include <gnuradio/blocks/float_to_short.h>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2012-07-18 13:29:18 +00:00
|
|
|
|
|
|
|
class ConfigurationInterface;
|
|
|
|
|
|
|
|
/*!
|
2012-11-25 11:15:11 +00:00
|
|
|
* \brief This class adapts a gnuradio gr_freq_xlating_fir_filter designed with pm_remez
|
2012-07-18 13:29:18 +00:00
|
|
|
*
|
|
|
|
* Construct a FIR filter with the given taps and a composite frequency
|
2012-07-18 15:47:59 +00:00
|
|
|
* translation that shifts intermediate_freq_ down to zero Hz. The frequency
|
2012-07-18 13:29:18 +00:00
|
|
|
* translation logically comes before the filtering operation.
|
|
|
|
*
|
|
|
|
* See Parks-McClellan FIR filter design, http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm
|
|
|
|
* Calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response
|
|
|
|
* given a set of band edges, the desired response on those bands, and the weight given
|
|
|
|
* to the error in those bands.
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
class FreqXlatingFirFilter : public GNSSBlockInterface
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
FreqXlatingFirFilter(ConfigurationInterface* configuration,
|
2018-03-03 01:03:39 +00:00
|
|
|
std::string role, unsigned int in_streams,
|
|
|
|
unsigned int out_streams);
|
2012-07-18 13:29:18 +00:00
|
|
|
|
|
|
|
virtual ~FreqXlatingFirFilter();
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string role() override
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
|
|
|
return role_;
|
|
|
|
}
|
2013-02-04 00:16:22 +00:00
|
|
|
|
|
|
|
//! Returns "Freq_Xlating_Fir_Filter"
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string implementation() override
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
|
|
|
return "Freq_Xlating_Fir_Filter";
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline size_t item_size() override
|
2012-07-18 13:29:18 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
|
|
|
void connect(gr::top_block_sptr top_block) override;
|
|
|
|
void disconnect(gr::top_block_sptr top_block) override;
|
|
|
|
gr::basic_block_sptr get_left_block() override;
|
|
|
|
gr::basic_block_sptr get_right_block() override;
|
2012-07-18 13:29:18 +00:00
|
|
|
|
|
|
|
private:
|
2012-11-25 11:15:11 +00:00
|
|
|
gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_;
|
2013-10-14 16:51:47 +00:00
|
|
|
gr::filter::freq_xlating_fir_filter_fcf::sptr freq_xlating_fir_filter_fcf_;
|
2014-11-29 13:00:15 +00:00
|
|
|
gr::filter::freq_xlating_fir_filter_scf::sptr freq_xlating_fir_filter_scf_;
|
2012-07-18 13:29:18 +00:00
|
|
|
ConfigurationInterface* config_;
|
2018-08-02 10:46:08 +00:00
|
|
|
int decimation_factor_;
|
2012-07-18 13:29:18 +00:00
|
|
|
bool dump_;
|
|
|
|
std::string dump_filename_;
|
|
|
|
std::string input_item_type_;
|
2013-10-14 16:51:47 +00:00
|
|
|
size_t input_size_;
|
2012-07-18 13:29:18 +00:00
|
|
|
std::string output_item_type_;
|
|
|
|
std::string taps_item_type_;
|
2018-03-03 01:03:39 +00:00
|
|
|
std::vector<float> taps_;
|
2012-07-18 15:47:59 +00:00
|
|
|
double intermediate_freq_;
|
2012-07-18 13:29:18 +00:00
|
|
|
double sampling_freq_;
|
|
|
|
std::string role_;
|
|
|
|
unsigned int in_streams_;
|
|
|
|
unsigned int out_streams_;
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::blocks::file_sink::sptr file_sink_;
|
2015-02-04 20:45:16 +00:00
|
|
|
gr::blocks::complex_to_float::sptr complex_to_float_;
|
|
|
|
gr::blocks::char_to_short::sptr gr_char_to_short_;
|
|
|
|
gr::blocks::float_to_short::sptr float_to_short_1_;
|
|
|
|
gr::blocks::float_to_short::sptr float_to_short_2_;
|
|
|
|
short_x2_to_cshort_sptr short_x2_to_cshort_;
|
|
|
|
complex_float_to_complex_byte_sptr complex_to_complex_byte_;
|
2012-07-18 13:29:18 +00:00
|
|
|
};
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
#endif // GNSS_SDR_FREQ_XLATING_FIR_FILTER_H_
|