Add matched filter implementation for CW noise reduction

* The matched filter makes use of VOLK
* The examples directory contains a simple flowgraph that demonstrates
the performance of the matched filter
This commit is contained in:
Manolis Surligas 2016-01-17 23:59:05 +02:00
parent 5e231a8a07
commit b4dd0f1e14
16 changed files with 1101 additions and 146 deletions

1
examples/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.py

View File

@ -1,4 +0,0 @@
It is considered good practice to add examples in here to demonstrate the
functionality of your OOT module. Python scripts, GRC flow graphs or other
code can go here.

13
examples/README.md Normal file
View File

@ -0,0 +1,13 @@
# Examples
This directory contains a set of useful examples and flowgraphs
for testing and demonstrating the performance of the different components of this
OOT module
## Files
* `morse_ref.wav `: This is a reference file containing the `HELLO WORLD` message.
The file is sampled at 8 KHz and the audio frequency is 700 Hz. The Morse code
Words per Minute (WPM) is about 20.
## Flowgraphs
* `test_matched_filter.grc`: Demonstrates the performance of the implemented
matched filter for CW decoding.

BIN
examples/morse_ref.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,822 @@
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.8'?>
<flow_graph>
<timestamp>Sun Jan 17 23:03:00 2016</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>
<param>
<key>window_size</key>
<value></value>
</param>
<param>
<key>category</key>
<value>Custom</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>description</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(8, 8)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>generate_options</key>
<value>qt_gui</value>
</param>
<param>
<key>id</key>
<value>test_matched_filter</value>
</param>
<param>
<key>max_nouts</key>
<value>0</value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>thread_safe_setters</key>
<value></value>
</param>
<param>
<key>title</key>
<value></value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(8, 160)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>samp_rate</value>
</param>
<param>
<key>value</key>
<value>8000</value>
</param>
</block>
<block>
<key>analog_agc2_xx</key>
<param>
<key>attack_rate</key>
<value>6.25e-4</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>decay_rate</key>
<value>2e-6</value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(752, 320)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>gain</key>
<value>0.0</value>
</param>
<param>
<key>id</key>
<value>analog_agc2_xx_0</value>
</param>
<param>
<key>max_gain</key>
<value>65536</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>reference</key>
<value>0.3</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
</block>
<block>
<key>analog_fastnoise_source_x</key>
<param>
<key>amp</key>
<value>0.6</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(112, 455)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>analog_fastnoise_source_x_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>noise_type</key>
<value>analog.GR_GAUSSIAN</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>seed</key>
<value>0</value>
</param>
<param>
<key>samples</key>
<value>8192</value>
</param>
</block>
<block>
<key>audio_sink</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>device_name</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(1032, 348)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>audio_sink_0</value>
</param>
<param>
<key>num_inputs</key>
<value>1</value>
</param>
<param>
<key>ok_to_block</key>
<value>True</value>
</param>
<param>
<key>samp_rate</key>
<value>samp_rate</value>
</param>
</block>
<block>
<key>blocks_add_xx</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(416, 440)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>blocks_add_xx_0</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>num_inputs</key>
<value>2</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>blocks_wavfile_source</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>file</key>
<value>/home/surligas/workspace/gr-satnogs/examples/morse_ref.wav</value>
</param>
<param>
<key>_coordinate</key>
<value>(96, 237)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>blocks_wavfile_source_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>nchan</key>
<value>1</value>
</param>
<param>
<key>repeat</key>
<value>True</value>
</param>
</block>
<block>
<key>qtgui_time_sink_x</key>
<param>
<key>autoscale</key>
<value>False</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>ctrlpanel</key>
<value>True</value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>entags</key>
<value>True</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(952, 166)</value>
</param>
<param>
<key>gui_hint</key>
<value></value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>grid</key>
<value>False</value>
</param>
<param>
<key>id</key>
<value>qtgui_time_sink_x_0</value>
</param>
<param>
<key>legend</key>
<value>True</value>
</param>
<param>
<key>alpha1</key>
<value>1.0</value>
</param>
<param>
<key>color1</key>
<value>"blue"</value>
</param>
<param>
<key>label1</key>
<value>With AGC</value>
</param>
<param>
<key>marker1</key>
<value>-1</value>
</param>
<param>
<key>style1</key>
<value>1</value>
</param>
<param>
<key>width1</key>
<value>1</value>
</param>
<param>
<key>alpha10</key>
<value>1.0</value>
</param>
<param>
<key>color10</key>
<value>"blue"</value>
</param>
<param>
<key>label10</key>
<value></value>
</param>
<param>
<key>marker10</key>
<value>-1</value>
</param>
<param>
<key>style10</key>
<value>1</value>
</param>
<param>
<key>width10</key>
<value>1</value>
</param>
<param>
<key>alpha2</key>
<value>1.0</value>
</param>
<param>
<key>color2</key>
<value>"red"</value>
</param>
<param>
<key>label2</key>
<value>Without AGC</value>
</param>
<param>
<key>marker2</key>
<value>-1</value>
</param>
<param>
<key>style2</key>
<value>1</value>
</param>
<param>
<key>width2</key>
<value>1</value>
</param>
<param>
<key>alpha3</key>
<value>1.0</value>
</param>
<param>
<key>color3</key>
<value>"green"</value>
</param>
<param>
<key>label3</key>
<value></value>
</param>
<param>
<key>marker3</key>
<value>-1</value>
</param>
<param>
<key>style3</key>
<value>1</value>
</param>
<param>
<key>width3</key>
<value>1</value>
</param>
<param>
<key>alpha4</key>
<value>1.0</value>
</param>
<param>
<key>color4</key>
<value>"black"</value>
</param>
<param>
<key>label4</key>
<value></value>
</param>
<param>
<key>marker4</key>
<value>-1</value>
</param>
<param>
<key>style4</key>
<value>1</value>
</param>
<param>
<key>width4</key>
<value>1</value>
</param>
<param>
<key>alpha5</key>
<value>1.0</value>
</param>
<param>
<key>color5</key>
<value>"cyan"</value>
</param>
<param>
<key>label5</key>
<value></value>
</param>
<param>
<key>marker5</key>
<value>-1</value>
</param>
<param>
<key>style5</key>
<value>1</value>
</param>
<param>
<key>width5</key>
<value>1</value>
</param>
<param>
<key>alpha6</key>
<value>1.0</value>
</param>
<param>
<key>color6</key>
<value>"magenta"</value>
</param>
<param>
<key>label6</key>
<value></value>
</param>
<param>
<key>marker6</key>
<value>-1</value>
</param>
<param>
<key>style6</key>
<value>1</value>
</param>
<param>
<key>width6</key>
<value>1</value>
</param>
<param>
<key>alpha7</key>
<value>1.0</value>
</param>
<param>
<key>color7</key>
<value>"yellow"</value>
</param>
<param>
<key>label7</key>
<value></value>
</param>
<param>
<key>marker7</key>
<value>-1</value>
</param>
<param>
<key>style7</key>
<value>1</value>
</param>
<param>
<key>width7</key>
<value>1</value>
</param>
<param>
<key>alpha8</key>
<value>1.0</value>
</param>
<param>
<key>color8</key>
<value>"dark red"</value>
</param>
<param>
<key>label8</key>
<value></value>
</param>
<param>
<key>marker8</key>
<value>-1</value>
</param>
<param>
<key>style8</key>
<value>1</value>
</param>
<param>
<key>width8</key>
<value>1</value>
</param>
<param>
<key>alpha9</key>
<value>1.0</value>
</param>
<param>
<key>color9</key>
<value>"dark green"</value>
</param>
<param>
<key>label9</key>
<value></value>
</param>
<param>
<key>marker9</key>
<value>-1</value>
</param>
<param>
<key>style9</key>
<value>1</value>
</param>
<param>
<key>width9</key>
<value>1</value>
</param>
<param>
<key>name</key>
<value>""</value>
</param>
<param>
<key>nconnections</key>
<value>2</value>
</param>
<param>
<key>size</key>
<value>1024</value>
</param>
<param>
<key>srate</key>
<value>samp_rate</value>
</param>
<param>
<key>tr_chan</key>
<value>0</value>
</param>
<param>
<key>tr_delay</key>
<value>0</value>
</param>
<param>
<key>tr_level</key>
<value>0.0</value>
</param>
<param>
<key>tr_mode</key>
<value>qtgui.TRIG_MODE_NORM</value>
</param>
<param>
<key>tr_slope</key>
<value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
<key>tr_tag</key>
<value>""</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>update_time</key>
<value>0.10</value>
</param>
<param>
<key>ylabel</key>
<value>Amplitude</value>
</param>
<param>
<key>yunit</key>
<value>""</value>
</param>
<param>
<key>ymax</key>
<value>1</value>
</param>
<param>
<key>ymin</key>
<value>-1</value>
</param>
</block>
<block>
<key>satnogs_cw_matched_filter_ff</key>
<param>
<key>carrier_freq</key>
<value>700</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(536, 222)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>satnogs_cw_matched_filter_ff_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>sampling_rate</key>
<value>samp_rate</value>
</param>
<param>
<key>wpm</key>
<value>20</value>
</param>
</block>
<connection>
<source_block_id>analog_agc2_xx_0</source_block_id>
<sink_block_id>audio_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_agc2_xx_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_fastnoise_source_x_0</source_block_id>
<sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>blocks_add_xx_0</source_block_id>
<sink_block_id>satnogs_cw_matched_filter_ff_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_wavfile_source_0</source_block_id>
<sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>satnogs_cw_matched_filter_ff_0</source_block_id>
<sink_block_id>analog_agc2_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>satnogs_cw_matched_filter_ff_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
</flow_graph>

View File

@ -16,7 +16,6 @@
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
install(FILES
DESTINATION share/gnuradio/grc/blocks
satnogs_cw_matched_filter_ff.xml DESTINATION share/gnuradio/grc/blocks
)

View File

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<block>
<name>CW Matched Filter</name>
<key>satnogs_cw_matched_filter_ff</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.cw_matched_filter_ff($sampling_rate, $carrier_freq, $wpm)</make>
<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>
<sink>
<name>in</name>
<type>float</type>
</sink>
<source>
<name>out</name>
<type>float</type>
</source>
</block>

View File

@ -22,5 +22,5 @@
########################################################################
install(FILES
api.h
DESTINATION include/satnogs
cw_matched_filter_ff.h DESTINATION include/satnogs
)

View File

@ -0,0 +1,57 @@
/* -*- 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
*/
static sptr make(double sampling_rate, double carrier_freq = 500,
size_t wpm = 20);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_H */

View File

@ -24,9 +24,8 @@ include(GrPlatform) #define LIB_SUFFIX
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND satnogs_sources
)
cw_matched_filter_ff_impl.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources)
@ -58,21 +57,21 @@ install(TARGETS gnuradio-satnogs
########################################################################
include(GrTest)
include_directories(${CPPUNIT_INCLUDE_DIRS})
#include_directories(${CPPUNIT_INCLUDE_DIRS})
list(APPEND test_satnogs_sources
${CMAKE_CURRENT_SOURCE_DIR}/test_satnogs.cc
${CMAKE_CURRENT_SOURCE_DIR}/qa_satnogs.cc
)
#list(APPEND test_satnogs_sources
# ${CMAKE_CURRENT_SOURCE_DIR}/test_satnogs.cc
# ${CMAKE_CURRENT_SOURCE_DIR}/qa_satnogs.cc
#)
add_executable(test-satnogs ${test_satnogs_sources})
#add_executable(test-satnogs ${test_satnogs_sources})
target_link_libraries(
test-satnogs
${GNURADIO_RUNTIME_LIBRARIES}
${Boost_LIBRARIES}
${CPPUNIT_LIBRARIES}
gnuradio-satnogs
)
#target_link_libraries(
# test-satnogs
# ${GNURADIO_RUNTIME_LIBRARIES}
# ${Boost_LIBRARIES}
# ${CPPUNIT_LIBRARIES}
# gnuradio-satnogs
#)
GR_ADD_TEST(test_satnogs test-satnogs)
#GR_ADD_TEST(test_satnogs test-satnogs)

View File

@ -0,0 +1,92 @@
/* -*- 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)
{
return gnuradio::get_initial_sptr
(new cw_matched_filter_ff_impl(sampling_rate, carrier_freq, wpm));
}
/*
* The private constructor
*/
cw_matched_filter_ff_impl::cw_matched_filter_ff_impl (double sampling_rate,
double carrier_freq,
size_t wpm) :
gr::sync_block ("cw_matched_filter_ff",
gr::io_signature::make (1, 1, sizeof(float)),
gr::io_signature::make (1, 1, sizeof(float))),
d_dot_duration(1.2/wpm),
d_dot_samples(d_dot_duration / (1.0 / sampling_rate))
{
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");
}
/* 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);
}
int
cw_matched_filter_ff_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
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_a(out + i, in + i, d_sin_wave,
d_dot_samples);
}
return noutput_items;
}
} /* namespace satnogs */
} /* namespace gr */

View File

@ -0,0 +1,59 @@
/* -*- 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>
namespace gr {
namespace satnogs {
class cw_matched_filter_ff_impl : public cw_matched_filter_ff
{
private:
/**
* The duration of the dot in seconds
*/
const double d_dot_duration;
/**
* The duration of the dot in number of samples
*/
const size_t d_dot_samples;
float *d_sin_wave;
public:
cw_matched_filter_ff_impl(double sampling_rate, double carrier_freq,
size_t wpm);
~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);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_CW_MATCHED_FILTER_FF_IMPL_H */

View File

@ -1,36 +0,0 @@
/*
* Copyright 2012 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,
* Boston, MA 02110-1301, USA.
*/
/*
* This class gathers together all the test cases for the gr-filter
* directory into a single test suite. As you create new test cases,
* add them here.
*/
#include "qa_satnogs.h"
CppUnit::TestSuite *
qa_satnogs::suite()
{
CppUnit::TestSuite *s = new CppUnit::TestSuite("satnogs");
return s;
}

View File

@ -1,38 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2012 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,
* Boston, MA 02110-1301, USA.
*/
#ifndef _QA_SATNOGS_H_
#define _QA_SATNOGS_H_
#include <gnuradio/attributes.h>
#include <cppunit/TestSuite.h>
//! collect all the tests for the gr-filter directory
class __GR_ATTR_EXPORT qa_satnogs
{
public:
//! return suite of tests for all of gr-filter directory
static CppUnit::TestSuite *suite();
};
#endif /* _QA_SATNOGS_H_ */

View File

@ -1,48 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2012 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,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cppunit/TextTestRunner.h>
#include <cppunit/XmlOutputter.h>
#include <gnuradio/unittests.h>
#include "qa_satnogs.h"
#include <iostream>
#include <fstream>
int
main (int argc, char **argv)
{
CppUnit::TextTestRunner runner;
std::ofstream xmlfile(get_unittest_path("satnogs.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_satnogs::suite());
runner.setOutputter(xmlout);
bool was_successful = runner.run("", false);
return was_successful ? 0 : 1;
}

View File

@ -8,6 +8,8 @@
%include "satnogs_swig_doc.i"
%{
#include "satnogs/cw_matched_filter_ff.h"
%}
%include "satnogs/cw_matched_filter_ff.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_matched_filter_ff);