Remove CW matched filter block
CW decoding using match filtering is pretty much useless in LEO. The information about the tone frequency is very rare and carrier oscillations during the satellite pass reduce significantly the performance. The new next CW decoder is based on the autocorrelation of the received signal.
This commit is contained in:
parent
0f77998e9f
commit
e114eb0cd0
|
@ -28,7 +28,6 @@ list(APPEND debug_blocks
|
|||
|
||||
list(APPEND enabled_blocks
|
||||
satnogs_block_tree.xml
|
||||
satnogs_cw_matched_filter_ff.xml
|
||||
satnogs_morse_decoder.xml
|
||||
satnogs_multi_format_msg_sink.xml
|
||||
satnogs_ogg_encoder.xml
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>CW Matched Filter</name>
|
||||
<key>satnogs_cw_matched_filter_ff</key>
|
||||
<import>import satnogs</import>
|
||||
<make>satnogs.cw_matched_filter_ff($sampling_rate, $carrier_freq, $wpm, $energy)</make>
|
||||
<callback>set_new_freq_locked($carrier_freq)</callback>
|
||||
|
||||
<param>
|
||||
<name>Sampling Rate</name>
|
||||
<key>sampling_rate</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Audio Frequency (Hz)</name>
|
||||
<key>carrier_freq</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Words per Minute</name>
|
||||
<key>wpm</key>
|
||||
<value>20</value>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Compute Energy</name>
|
||||
<key>energy</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<sink>
|
||||
<name>freq</name>
|
||||
<type>message</type>
|
||||
<optional>1</optional>
|
||||
</sink>
|
||||
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>float</type>
|
||||
</sink>
|
||||
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>float</type>
|
||||
</source>
|
||||
</block>
|
|
@ -31,7 +31,6 @@ list(APPEND HEADER_FILES
|
|||
api.h
|
||||
ax25.h
|
||||
config.h
|
||||
cw_matched_filter_ff.h
|
||||
log.h
|
||||
morse_tree.h
|
||||
morse.h
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||
*
|
||||
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
||||
*
|
||||
* This program 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
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_H
|
||||
#define INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_H
|
||||
|
||||
#include <satnogs/api.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace satnogs {
|
||||
|
||||
/*!
|
||||
* \brief This block implements a matched filter to reduce the noise
|
||||
* level of the received CW signal.
|
||||
*
|
||||
* \ingroup satnogs
|
||||
*
|
||||
*/
|
||||
class SATNOGS_API cw_matched_filter_ff : virtual public gr::sync_block
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<cw_matched_filter_ff> sptr;
|
||||
|
||||
/*!
|
||||
* \brief Matched filter for CW noise reduction
|
||||
*
|
||||
* @param sampling_rate the sampling rate of the signal
|
||||
* @param carrier_freq the audio frequency of the CW signal
|
||||
* @param wpm Morse code Words per Minute
|
||||
* @param energy_out if true, the filter produces the energy of the
|
||||
* resulting filtered samples, otherwise the raw filter samples are
|
||||
* produced. This is handy, in order to save the flowgraph from
|
||||
* am additional signal energy block.
|
||||
*/
|
||||
static sptr make(double sampling_rate, double carrier_freq = 500,
|
||||
size_t wpm = 20,
|
||||
bool energy_out = false);
|
||||
|
||||
virtual void set_new_freq_locked(double freq) = 0;
|
||||
virtual void set_new_freq(double freq) = 0;
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_H */
|
||||
|
|
@ -39,7 +39,6 @@ list(APPEND satnogs_debug_sources
|
|||
leo_channel_impl.cc
|
||||
)
|
||||
list(APPEND satnogs_sources
|
||||
cw_matched_filter_ff_impl.cc
|
||||
morse_tree.cc
|
||||
morse_decoder_impl.cc
|
||||
multi_format_msg_sink_impl.cc
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||
*
|
||||
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
||||
*
|
||||
* This program 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
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include "cw_matched_filter_ff_impl.h"
|
||||
|
||||
#include <volk/volk.h>
|
||||
#include <gnuradio/fxpt_nco.h>
|
||||
|
||||
namespace gr {
|
||||
namespace satnogs {
|
||||
|
||||
cw_matched_filter_ff::sptr
|
||||
cw_matched_filter_ff::make(double sampling_rate, double carrier_freq,
|
||||
size_t wpm, bool energy_out)
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new cw_matched_filter_ff_impl(sampling_rate, carrier_freq,
|
||||
wpm, energy_out));
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
cw_matched_filter_ff_impl::cw_matched_filter_ff_impl (double sampling_rate,
|
||||
double carrier_freq,
|
||||
size_t wpm,
|
||||
bool energy_out) :
|
||||
gr::sync_block ("cw_matched_filter_ff",
|
||||
gr::io_signature::make (1, 1, sizeof(float)),
|
||||
gr::io_signature::make (1, 1, sizeof(float))),
|
||||
d_samp_rate(sampling_rate),
|
||||
d_dot_duration(1.2/wpm),
|
||||
d_produce_enrg(energy_out),
|
||||
d_dot_samples(d_dot_duration / (1.0 / sampling_rate))
|
||||
{
|
||||
const int alignment_multiple = volk_get_alignment() / sizeof(float);
|
||||
set_alignment(std::max(1,alignment_multiple));
|
||||
set_history(d_dot_samples);
|
||||
|
||||
d_sin_wave = (float *)volk_malloc(d_dot_samples * sizeof(float), 32);
|
||||
if(!d_sin_wave){
|
||||
throw std::runtime_error("Could not allocate sine wave buffer");
|
||||
}
|
||||
|
||||
/* Register the input port for frequency change messages */
|
||||
message_port_register_in(pmt::mp("freq"));
|
||||
set_msg_handler(pmt::mp("freq"),
|
||||
boost::bind(&cw_matched_filter_ff_impl::new_freq_msg_handler,
|
||||
this, _1));
|
||||
|
||||
/* Now fill the buffer with the appropriate sine wave */
|
||||
gr::fxpt_nco nco;
|
||||
nco.set_freq(2 * M_PI * carrier_freq / sampling_rate);
|
||||
nco.sin(d_sin_wave, d_dot_samples, 1.0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
cw_matched_filter_ff_impl::~cw_matched_filter_ff_impl()
|
||||
{
|
||||
volk_free(d_sin_wave);
|
||||
}
|
||||
|
||||
void
|
||||
cw_matched_filter_ff_impl::new_freq_msg_handler (pmt::pmt_t msg)
|
||||
{
|
||||
if(pmt::is_pair(msg)){
|
||||
set_new_freq(pmt::to_double(pmt::cdr(msg)));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
cw_matched_filter_ff_impl::work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
boost::mutex::scoped_lock lock (d_mutex);
|
||||
const float *in = (const float *) input_items[0];
|
||||
float *out = (float *) output_items[0];
|
||||
|
||||
for (int i = 0; i < noutput_items; i++) {
|
||||
volk_32f_x2_dot_prod_32f (out + i, in + i, d_sin_wave, d_dot_samples);
|
||||
}
|
||||
if (d_produce_enrg) {
|
||||
volk_32f_s32f_power_32f (out, out, 2, noutput_items);
|
||||
}
|
||||
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
void
|
||||
cw_matched_filter_ff_impl::set_new_freq (double freq)
|
||||
{
|
||||
gr::fxpt_nco nco;
|
||||
nco.set_freq(2 * M_PI * freq / d_samp_rate);
|
||||
nco.sin(d_sin_wave, d_dot_samples, 1.0);
|
||||
}
|
||||
|
||||
void
|
||||
cw_matched_filter_ff_impl::set_new_freq_locked(double freq)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(d_mutex);
|
||||
set_new_freq(freq);
|
||||
}
|
||||
|
||||
} /* namespace satnogs */
|
||||
} /* namespace gr */
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
||||
*
|
||||
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
||||
*
|
||||
* This program 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
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_IMPL_H
|
||||
#define INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_IMPL_H
|
||||
|
||||
#include <satnogs/cw_matched_filter_ff.h>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
namespace gr
|
||||
{
|
||||
namespace satnogs
|
||||
{
|
||||
|
||||
class cw_matched_filter_ff_impl : public cw_matched_filter_ff
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The sampling rate of the signal
|
||||
*/
|
||||
const double d_samp_rate;
|
||||
|
||||
/**
|
||||
* The duration of the dot in seconds
|
||||
*/
|
||||
const double d_dot_duration;
|
||||
/**
|
||||
* If set to true, this block produces the energy of the filtered
|
||||
* samples, rather the samples themselves
|
||||
*/
|
||||
const bool d_produce_enrg;
|
||||
/**
|
||||
* The duration of the dot in number of samples
|
||||
*/
|
||||
const size_t d_dot_samples;
|
||||
|
||||
float *d_sin_wave;
|
||||
|
||||
boost::mutex d_mutex;
|
||||
|
||||
void
|
||||
new_freq_msg_handler(pmt::pmt_t msg);
|
||||
|
||||
public:
|
||||
cw_matched_filter_ff_impl (double sampling_rate, double carrier_freq,
|
||||
size_t wpm, bool energy_out);
|
||||
~cw_matched_filter_ff_impl ();
|
||||
|
||||
// Where all the action really happens
|
||||
int
|
||||
work (int noutput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
void
|
||||
set_new_freq(double freq);
|
||||
|
||||
void
|
||||
set_new_freq_locked(double freq);
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_IMPL_H */
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
%include "satnogs_swig_doc.i"
|
||||
|
||||
%{
|
||||
#include "satnogs/cw_matched_filter_ff.h"
|
||||
#include "satnogs/morse_tree.h"
|
||||
#include "satnogs/morse_decoder.h"
|
||||
#include "satnogs/morse_debug_source.h"
|
||||
|
@ -39,9 +38,6 @@
|
|||
%}
|
||||
|
||||
|
||||
%include "satnogs/cw_matched_filter_ff.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_matched_filter_ff);
|
||||
|
||||
%include "satnogs/morse_tree.h"
|
||||
|
||||
%include "satnogs/morse_decoder.h"
|
||||
|
|
Loading…
Reference in New Issue